Complete guide for deploying the Landing Page Contact Form on various platforms.
Setup Time: 2 minutes
Difficulty: β Easy
Free Tier: Unlimited (personal projects)
npm i -g vercel
vercel login
vercel- Go to vercel.com/new
- Import GitHub repository
- Configure environment variables
- Deploy
GITHUB_TOKEN=your_github_token
GITHUB_REPO_OWNER=your_username
GITHUB_REPO_NAME=your_repoAdvantages:
- Auto-deploy on every push to
main - Built-in CDN (99.99% uptime)
- Automatic HTTPS certificate
- Edge Functions optimization
Setup Time: 3 minutes
Difficulty: β Easy
Free Tier: 100GB bandwidth/month
npm install -g netlify-cli
netlify login
netlify init
netlify deploy --prod- Go to app.netlify.com
- New site from Git
- Connect GitHub repository
- Build command:
npm run build - Publish directory:
.next - Add environment variables
[build]
command = "npm run build"
publish = ".next"
[[redirects]]
from = "/*"
to = "/index.html"
status = 200Advantages:
- Instant rollback
- Built-in forms (alternative to GitHub Issues)
- Split testing
- Serverless functions
Setup Time: 5 minutes
Difficulty: ββ Medium
Free Tier: $5 credit/month (500 hours)
npm i -g @railway/cli
railway login
railway init
railway up- Go to railway.app
- New Project β Deploy from GitHub
- Select repository
- Railway auto-detects Next.js
- Add environment variables
Create railway.json:
{
"$schema": "https://railway.app/railway.schema.json",
"build": {
"builder": "NIXPACKS"
},
"deploy": {
"startCommand": "npm start",
"restartPolicyType": "ON_FAILURE"
}
}Advantages:
- Database integration (Postgres, MySQL, Redis)
- Private networking
- Container-based (more control)
- Usage monitoring
Setup Time: 5 minutes
Difficulty: ββ Medium
Free Tier: 750 hours/month (static sites unlimited)
- Go to render.com
- New β Static Site (or Web Service for SSR)
- Connect GitHub repository
- Build Command:
npm run build - Publish Directory:
out(for static) or keep empty (for SSR) - Add environment variables
Modify next.config.js:
module.exports = {
output: 'export',
images: {
unoptimized: true
}
}Then:
npm run build
# Generates /out folderAdvantages:
- Free SSL certificates
- Custom domains
- Background jobs
- Preview environments
Setup Time: 10 minutes
Difficulty: βββ Advanced
Cost: Depends on hosting provider
FROM node:18-alpine AS base
# Install dependencies
FROM base AS deps
RUN apk add --no-cache libc6-compat
WORKDIR /app
COPY package*.json ./
RUN npm ci
# Build application
FROM base AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
RUN npm run build
# Production image
FROM base AS runner
WORKDIR /app
ENV NODE_ENV production
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs
COPY --from=builder /app/public ./public
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
USER nextjs
EXPOSE 3000
ENV PORT 3000
CMD ["node", "server.js"]version: '3.8'
services:
app:
build: .
ports:
- "3000:3000"
environment:
- GITHUB_TOKEN=${GITHUB_TOKEN}
- GITHUB_REPO_OWNER=${GITHUB_REPO_OWNER}
- GITHUB_REPO_NAME=${GITHUB_REPO_NAME}
restart: unless-stopped# Build image
docker build -t gitforms .
# Run container
docker run -p 3000:3000 --env-file .env gitforms
# With docker-compose
docker-compose up -dAdvantages:
- Total portability
- Consistent environments
- Easy scaling
- Deployable anywhere (AWS, GCP, Azure, DigitalOcean)
Setup Time: 7 minutes
Difficulty: βββ Advanced
Free Tier: 1000 build minutes/month, 15GB storage
- Go to AWS Amplify Console
- New app β Host web app
- Connect GitHub repository
- Build settings (auto-detected for Next.js)
- Add environment variables
- Deploy
version: 1
frontend:
phases:
preBuild:
commands:
- npm ci
build:
commands:
- npm run build
artifacts:
baseDirectory: .next
files:
- '**/*'
cache:
paths:
- node_modules/**/*Advantages:
- AWS infrastructure integration
- CDN via CloudFront
- Custom domain with Route 53
- Branch-based deployments
rm -rf node_modules package-lock.json
npm install
npm run buildCheck that environment variables are correctly configured:
echo $GITHUB_TOKEN # Should not be empty- Check Node.js version (18+ required)
- Verify all environment variables are set
- Check build logs for specific error
- Ensure
npm run buildworks locally
- Verify GitHub token has
reposcope - Check
GITHUB_REPO_OWNERandGITHUB_REPO_NAMEare correct - Ensure Issues are enabled in repository settings
- Check browser console for errors
| Platform | Difficulty | Free Tier | Best For |
|---|---|---|---|
| Vercel | β | Unlimited | Quick deployment, Next.js projects |
| Netlify | β | 100GB/month | Static sites, forms |
| Railway | ββ | $5 credit | Full-stack apps with databases |
| Render | ββ | 750h/month | Static + dynamic projects |
| Docker | βββ | - | Total control, portability |
| AWS Amplify | βββ | 1000 min/month | AWS ecosystem integration |
- Development: Local with
npm run dev - Staging: Vercel preview deployments (automatic)
- Production: Vercel main branch (automatic)
- Monitoring: Vercel Analytics (built-in)
- Next.js Deployment Documentation
- Vercel Documentation
- Docker Best Practices for Next.js
- GitHub Issues API
Need help? Open an issue on GitHub