Prerequisites
Before deploying, ensure the following are in place:- Vercel account with a Team Plan (Pro or Enterprise) — required for environment variable scoping, deployment protection, and team audit logs
- GitHub repository connected to the Vercel team
- Neon PostgreSQL database provisioned (separate databases for staging and production)
- Cloudflare account with
pensionsportal.iedomain configured
Initial Vercel Setup
Follow these steps to configure the Vercel project from scratch:- Connect GitHub repository — In the Vercel Dashboard, click “Add New Project” and import the
IORP-II-Apprepository from GitHub. - Set Framework Preset — Vercel auto-detects Next.js. Confirm the preset is set to Next.js.
- Set Build Command —
npm run build - Set Output Directory —
.next(auto-configured by Vercel for Next.js) - Set Install Command —
npm install - Set Node.js Version — Select 20.x in Project Settings → General → Node.js Version.
Domain Mapping
To add the custom domain:
- Go to Vercel Dashboard → Your Project → Settings → Domains
- Add
app.pensionsportal.ie - Vercel will display a CNAME record to add in Cloudflare DNS
- In Cloudflare, add the CNAME pointing to
cname.vercel-dns.comwith Proxy status: Proxied
Environment Variable Matrix
Configure environment variables in Vercel Dashboard → Project → Settings → Environment Variables. Set each variable for the correct environment scope (Development, Preview, Production).Production secrets must never appear in
.env files committed to the repository. All sensitive values must be set exclusively through the Vercel Dashboard with appropriate environment scoping.Generating Secrets
GenerateAUTH_SECRET:
PPS_ENCRYPTION_KEY:
CI Enforcement on Vercel
Vercel automatically runs the following checks during each deployment build. All must pass before the deployment is promoted:npm run lint— ESLint must report zero errors- TypeScript compilation — Run as part of the Next.js build step; type errors fail the build
npm run build— Full Next.js production build must complete without errors
Recommended GitHub Actions Integration
Add the following required status checks in GitHub Branch Protection Rules so that Vercel deployments are gated on CI results:main.
Rollback Procedure
Use this procedure when a production deployment introduces a regression:- Go to Vercel Dashboard → Your Project → Deployments
- Identify the last known-good deployment (check timestamps and commit messages)
- Click the ”…” menu next to that deployment → Promote to Production
- Verify
https://app.pensionsportal.ieis serving the correct version (check the deployment SHA in response headers or the health endpoint) - If a database migration was included in the bad deployment: run the rollback migration against production:
- Alert the team in Slack
#opswith:- Incident start time
- Affected deployment SHA
- Rollback deployment SHA
- Any data impact assessment
Preview Deployments
Vercel automatically creates a preview deployment for every pull request.- Preview URLs follow the pattern:
https://iorp-ii-app-<hash>.vercel.app - Preview deployments use Preview scoped environment variables (staging values)
- Share preview URLs with stakeholders for review before merging
Production Health Checks
The application exposes the following health endpoints. Configure an external uptime monitor (e.g., BetterUptime, UptimeRobot, or Vercel Monitoring) to poll these on a schedule.
Example: BetterUptime monitor configuration
latencyMs on the /api/health/db endpoint consistently exceeds 500ms, investigate Neon connection pooling configuration and Vercel region alignment.
Database Migration Process
Schema changes must be applied to staging before production. Never run migrations directly against production without staging validation.- Run migration against staging first:
- Validate staging — smoke test key flows (login, scheme creation, compliance check) against the staging URL.
- For significant schema changes, consider maintenance mode — place production in a read-only or maintenance state to prevent writes during migration. For additive-only migrations (new columns with defaults, new tables), maintenance mode is optional.
- Run migration against production:
- Deploy the new application code via Vercel (merge to
mainor trigger a manual promotion).
Neon supports branching — consider creating a Neon branch from production to test migrations against a copy of real schema before applying to production. See Neon Branching for details.