Student starter code (30% baseline)
index.html
- Main HTML pagescript.js
- JavaScript logicstyles.css
- Styling and layoutpackage.json
- Dependenciessetup.sh
- Setup scriptREADME.md
- Instructions (below)๐ก Download the ZIP, extract it, and follow the instructions below to get started!
Complete deployment configuration package for deploying your Quest Tracker app to production using Netlify and Railway.
npm start
to view the deployment guideactivity-12-deployment/
โโโ frontend/
โ โโโ netlify.toml # Netlify deployment config
โ โโโ .env.example # Frontend environment variables
โ โโโ server.js # Development guide server
โโโ backend/
โ โโโ railway.toml # Railway deployment config
โ โโโ .env.example # Backend environment variables
โโโ scripts/
โ โโโ deploy-frontend.js # Automated frontend deployment
โ โโโ deploy-backend.js # Automated backend deployment
โ โโโ health-check.js # Post-deployment testing
โโโ package.json # Deployment scripts
โโโ README.md # This file
After completing this activity, you'll understand:
frontend/netlify.toml
)[build]
publish = "dist"
command = "npm run build"
[[redirects]]
from = "/api/*"
to = "https://your-api.railway.app/api/:splat"
status = 200
[[redirects]]
from = "/*"
to = "/index.html"
status = 200
[[headers]]
for = "/static/*"
[headers.values]
Cache-Control = "public, max-age=31536000"
backend/railway.toml
)[build]
builder = "NIXPACKS"
buildCommand = "npm install --production"
[deploy]
startCommand = "npm start"
healthcheckPath = "/health"
[env]
NODE_ENV = "production"
PORT = "$PORT"
# API Configuration
REACT_APP_API_URL=https://your-api.railway.app
REACT_APP_API_KEY=your-production-api-key
REACT_APP_ENVIRONMENT=production
# Analytics
REACT_APP_GOOGLE_ANALYTICS=GA-XXXXXXXXX
REACT_APP_SENTRY_DSN=your-sentry-dsn
# Feature Flags
REACT_APP_ENABLE_PWA=true
REACT_APP_ENABLE_NOTIFICATIONS=true
# Server Configuration
NODE_ENV=production
PORT=3000
# Database
DATABASE_URL=postgresql://user:pass@host:port/db
# Security
JWT_SECRET=your-jwt-secret
API_RATE_LIMIT=1000
# External Services
SENTRY_DSN=your-backend-sentry-dsn
# Deploy frontend to Netlify
npm run deploy:frontend
# Deploy backend to Railway
npm run deploy:backend
# Deploy both frontend and backend
npm run deploy:all
# Run comprehensive health checks
npm run health-check
# Monitor deployment status
npm run monitor
backend
as the root directoryfrontend
npm run build
frontend/build
The health check script validates:
# Test API performance
curl -w "@curl-format.txt" -o /dev/null -s "https://your-api.railway.app/api/quests?api_key=demo_key_12345"
# Test concurrent requests
for i in {1..10}; do curl -s "https://your-api.railway.app/health" & done; wait
npm run analyze
to check bundle size// Frontend error tracking
import * as Sentry from '@sentry/react';
Sentry.init({
dsn: process.env.REACT_APP_SENTRY_DSN,
environment: process.env.REACT_APP_ENVIRONMENT
});
// Backend error tracking
const Sentry = require('@sentry/node');
Sentry.init({
dsn: process.env.SENTRY_DSN,
environment: process.env.NODE_ENV
});
questtracker.yourdomain.com
)Type: CNAME
Name: questtracker
Value: your-netlify-site.netlify.app
api.yourdomain.com
)Type: CNAME
Name: api
Value: your-project.railway.app
# .github/workflows/deploy.yml
name: Deploy Quest Tracker
on:
push:
branches: [ main ]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Deploy to Railway
run: npm run deploy:backend
- name: Deploy to Netlify
run: npm run deploy:frontend
// Frontend PWA configuration
{
"name": "Quest Tracker",
"short_name": "QuestTracker",
"display": "standalone",
"start_url": "/",
"theme_color": "#3498db",
"background_color": "#ffffff",
"icons": [
{
"src": "icon-192.png",
"sizes": "192x192",
"type": "image/png"
}
]
}
// Add PostgreSQL to Railway
const { Pool } = require('pg');
const pool = new Pool({
connectionString: process.env.DATABASE_URL,
ssl: process.env.NODE_ENV === 'production' ? { rejectUnauthorized: false } : false
});
# Check deployment logs
netlify logs --site=your-site-id
railway logs
# Test API connectivity
curl -I https://your-api.railway.app/health
# Validate SSL certificate
openssl s_client -connect your-domain.com:443
# Check DNS propagation
nslookup your-domain.com
Set up monitoring for:
By completing this deployment activity, you'll have hands-on experience with:
Ready to take your Quest Tracker app live? Start with npm start
to view the deployment guide! ๐