This guide covers deploying the Online School Registration System to production.
Frontend: Vercel
Backend: Railway
Database: Railway PostgreSQL
Frontend: Vercel
Backend: Render
Database: Render PostgreSQL
Frontend + Backend: Render
Database: Render PostgreSQL
cd frontend
# Build to check for errors
npm run build
# Install Vercel CLI
npm install -g vercel
# Login
vercel login
# Deploy
vercel --prod
Go to Vercel Dashboard โ Your Project โ Settings โ Environment Variables
Add:
NEXT_PUBLIC_API_URL=https://your-backend-url.com/api
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_live_your_key
# Add start script to package.json
{
"scripts": {
"start": "node server.js",
"build": "prisma generate"
}
}
In Railway Dashboard, add all variables from .env.example:
DATABASE_URL=${RAILWAY_PROVIDED_URL}
JWT_SECRET=your-production-secret
CLOUDINARY_CLOUD_NAME=your-cloud-name
CLOUDINARY_API_KEY=your-api-key
CLOUDINARY_API_SECRET=your-api-secret
STRIPE_SECRET_KEY=sk_live_your_key
EMAIL_HOST=smtp.gmail.com
EMAIL_PORT=587
EMAIL_USER=your-email@gmail.com
EMAIL_PASSWORD=your-app-password
EMAIL_FROM=School Registration <noreply@school.com>
PORT=5000
NODE_ENV=production
FRONTEND_URL=https://your-frontend-url.vercel.app
In Railway, run:
npx prisma migrate deploy
Visit render.com and sign up
school-registration-dbnpm install && npx prisma generatenpm startAdd all variables from .env.example using the Render dashboard
Render will automatically deploy on push to main branch
npx prisma migrate deploy
postgresql://postgres:[password]@[host]:5432/postgresIn server.js:
app.use(
cors({
origin: process.env.FRONTEND_URL,
credentials: true,
})
);
Generate a strong secret:
node -e "console.log(require('crypto').randomBytes(64).toString('hex'))"
Both Vercel and Railway/Render provide automatic HTTPS
Install and configure:
npm install express-rate-limit
import rateLimit from "express-rate-limit";
const limiter = rateLimit({
windowMs: 15 * 60 * 1000,
max: 100,
});
app.use("/api/", limiter);
EMAIL_PASSWORDutils/email.jsComplete business verification at stripe.com
Dashboard โ Developers โ API keys
STRIPE_SECRET_KEY=sk_live_your_production_key
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_live_your_production_key
For payment confirmations:
https://your-api.com/api/webhooks/stripepayment_intent.succeededEnable in Vercel Dashboard โ Analytics
View in Railway Dashboard โ Deployments โ Logs
Integrate Sentry:
npm install @sentry/node @sentry/nextjs
Create .github/workflows/deploy.yml:
name: Deploy
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: "18"
- run: npm install
- run: npm run build
Success: 4242 4242 4242 4242
Decline: 4000 0000 0000 0002
The app is responsive by default. Test on:
# Clear cache
rm -rf node_modules .next
npm install
npm run build
# Create migration
npx prisma migrate dev --name migration_name
# Deploy to production
npx prisma migrate deploy
Both Vercel and Railway support zero-downtime deployments
For deployment issues:
Congratulations! Your School Registration System is now live! ๐