Daftar Isi — Part 5: Deployment & DevOps
- Deployment Strategy — Vercel vs Railway vs Docker vs AWS
- CI/CD Pipeline — GitHub Actions: auto test, build, deploy
- Environment Management — Dev, staging, production secrets
- Vercel Deploy — Zero-config untuk Next.js
- Database Migration — Prisma migrate di production
- Monitoring Setup — Error tracking, uptime, performance
- Rollback Strategy — Kalau deployment gagal
- Launch Checklist
🚀
1. Deployment Strategy
Pilih berdasarkan: complexity, budget, scaling needs, team size| Strategy | Best For | Complexity | Cost | Scaling |
|---|---|---|---|---|
| Vercel (recommended) | Next.js, solo/small team, MVP | Very low | Free tier generous | Auto-scale |
| Railway | Fullstack + DB in one platform | Low | $5/mo+ | Auto-scale |
| Docker + VPS | Full control, custom infra | Medium | $5-50/mo | Manual |
| AWS/GCP | Enterprise, complex requirements | High | Variable | Unlimited |
⚙
2. CI/CD Pipeline — GitHub Actions
Auto-test, auto-build, auto-deploy di setiap PR dan merge ke mainname: CI/CD Pipeline
on:
push: { branches: [main] }
pull_request: { branches: [main] }
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with: { node-version: 20, cache: npm }
- run: npm ci
- run: npx tsc --noEmit # Type check
- run: npx eslint . # Lint
- run: npx vitest run # Unit + integration
- run: npx playwright install --with-deps
- run: npx playwright test # E2E
- run: npm audit --production # Security
deploy:
needs: test
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: amondnet/vercel-action@v25
with:
vercel-token: ${{ secrets.VERCEL_TOKEN }}
vercel-args: '--prod'
🔐
3. Environment Management
Dev, staging, production — NEVER share secrets antar environment| Variable | Dev (.env.local) | Production | Notes |
|---|---|---|---|
| DATABASE_URL | localhost:5432/dev | Neon production URL | NEVER same DB for dev & prod |
| NEXTAUTH_SECRET | dev-secret-123 | 64-char random string | openssl rand -base64 32 |
| NEXTAUTH_URL | http://localhost:3000 | https://taskflow.app | Must match actual domain |
| SENTRY_DSN | (optional) | https://sentry.io/prod | Error tracking |
📦
4. Vercel Deploy
Push ke main = auto deploy. Setup 5 menit.# 1. Install & link
$ npm i -g vercel && vercel link
# 2. Set env vars
$ vercel env add DATABASE_URL production
$ vercel env add NEXTAUTH_SECRET production
# 3. Deploy!
$ vercel --prod
# Deployed to https://taskflow.vercel.app in ~60s
# After this, every push to main auto-deploys!
$ git push origin main # Auto build + deploy
📊
5. Monitoring Setup
Error tracking + uptime + performance — know before users complain| What | Tool (Free) | Setup | Why |
|---|---|---|---|
| Error Tracking | Sentry | 5 min | Stack traces, user context, alerts |
| Performance | Vercel Analytics | 0 min (built-in) | Core Web Vitals, response times |
| Uptime | BetterUptime | 2 min | Alert when site goes down |
| Logs | Vercel Logs | 0 min (built-in) | Server-side logs |
| Analytics | PostHog / Plausible | 10 min | Privacy-friendly usage data |
✅
6. Launch Checklist
10 items sebelum announce launch| # | Item | Done? |
|---|---|---|
| 1 | CI/CD pipeline running (all tests pass) | |
| 2 | Production env vars set correctly | |
| 3 | Database migrations applied | |
| 4 | Custom domain + SSL active | |
| 5 | Sentry error tracking connected | |
| 6 | Uptime monitoring active | |
| 7 | Database backup configured | |
| 8 | Rate limiting enabled | |
| 9 | Security headers configured | |
| 10 | Load test passed |
FINALE: Part 6 — Maintenance & Iteration
Software tidak pernah selesai. Bug tracking, performance monitoring, refactoring dengan AI, feature iteration, dependency updates, cost optimization, dan scaling playbook.
SDLC
Tech Review Desk — Vibe Coding SDLC Bible
Sumber: GitHub Actions docs, Vercel docs, Neon docs, Sentry docs.