Deployment Recipes & Hosting Guides
This directory contains provider-specific deployment recipes layered on top of the application's shared runtime contract.
Shared Runtime Contract
All deployment targets consume the exact same application runtime contract, ensuring zero provider lock-in and seamless portability:
- Node.js & Package Manager Specification: Node.js v22.x LTS (
>=22.22.1 <23.0.0acrossengines.nodeanddevEngines.runtime) andnpm^10.9.0(enforced viaenginesanddevEnginesinpackage.json), Next.js App Router standalone build (output: 'standalone'). - Database Engine & ORM: PostgreSQL 15+ accessed via Prisma ORM v7.x (
@prisma/client).prisma.config.tsbindsdatasource.urltoDATABASE_URL(used by both runtime queries andnpx prisma migrate deploy) anddatasource.shadowDatabaseUrltoPOSTGRES_URL_NON_POOLING(used byprisma migrate dev). WhenDATABASE_URLroutes through a transaction-mode pooler like PgBouncer,npx prisma migrate deployrequires an explicitDATABASE_URLoverride pointing to a direct PostgreSQL connection. - Migration Mechanism: Migrations run prior to application startup via offline
./node_modules/.bin/prisma migrate deployin the Docker Composemigrationservice (docker-compose.yml), offline in the container entrypoint (docker-entrypoint.shwhenRUN_MIGRATIONS=trueorRUN_MIGRATIONS=1, backed by/opt/prisma-cli), or vianpx prisma migrate deployin PaaS release commands and CI/CD pipelines (.github/workflows/db-migrate.yml). - Environment Variable Validation: Validated at startup by
src/env.ts(Zod schema). Missing or invalid required production variables (DATABASE_URL,ADMIN_PASSWORD,ALLOWED_HOSTS,GUEST_PASSCODE,GUEST_SESSION_SECRET) fail fast during initialization, andE2E_TESTmust never be set totruein production; see the Application Runtime Contract for the complete environment variable matrix. - Asset Storage Abstraction: File uploads use local disk storage (
/app/public/uploads, persisted viauploads_dataindocker-compose.ymlor a Render Persistent Disk and streamed dynamically at/uploads/*in standalone mode withX-Content-Type-Options: nosniff) or provider-agnostic S3-compatible object storage (S3_BUCKET,S3_REGION,S3_ACCESS_KEY_ID,S3_SECRET_ACCESS_KEY,S3_ENDPOINT,S3_PUBLIC_URL). No provider-specific storage SDKs are included in core business logic. - Liveness, Readiness & Graceful Shutdown: Process liveness endpoint at
/api/livereturning HTTP 200{ "status": "alive", "timestamp": "..." }without querying PostgreSQL (for containerHEALTHCHECKand Cloud Run liveness probes), startup/rollout health endpoint at/api/health(isHealthProbe: true) returning HTTP 200{ "success": true, "data": { "status": "ok", "timestamp": "...", "database": "connected" } }for deployment verification (and HTTP 503{ "success": false, "status": "degraded", "database": "disconnected", "timestamp": "...", "error": "Database connection failed" }with sanitized error text when PostgreSQL is unreachable), unwrapped readiness endpoint at/api/ready(HTTP 200 / HTTP 503), andstop_grace_period: 15s(--stop-timeout 15on standalonedocker run) covering Next.js request completion plus the5000msPrisma pool drain. - Host Header Validation & Subdomain Scope: Enforced via
ALLOWED_HOSTSmatching (X-Forwarded-Hostevaluated only whenTRUST_PROXYis enabled before falling back toHostinsrc/utils/hostValidation.ts,src/middleware.ts, andsrc/lib/config.ts), while stateless read-only (GET/HEAD) probes to/api/live,/api/health, and/api/readyenforce syntacticHostvalidation (isHostSyntaxValid) without requiringALLOWED_HOSTSmembership. WhenMULTISITE_ENABLED=true, subdomain routing switchesAppConfigbranding/profile rows and validatessiteId/subdomainsession cookie claims whileprisma/schema.prismashares all other persisted models across subdomains without tenant row isolation (see the Application Runtime Contract). - Webhooks & Scheduled Broadcasts: Stripe
payment_intent.succeededwebhooks post to/api/registry/webhook/stripe(verified viastripe-signatureandSTRIPE_WEBHOOK_SECRETwithout requiring session cookies), and scheduled broadcasts trigger/api/cron/broadcastswithAuthorization: Bearer <CRON_SECRET>(configured viavercel.jsonon Vercel or platform schedulers elsewhere).
Support Tier Matrix
To distinguish officially verified deployment targets from community-maintained examples, hosting options are classified into support tiers:
| Target Platform | Category | Support Tier | Primary Artifact |
|---|---|---|---|
| Generic Docker / VPS | Canonical Portable Baseline | Tier 1 — Officially Tested | Root Dockerfile & docker-compose.yml |
| Google Cloud Run | Container / Serverless | Tier 1 — Officially Tested | ghcr.io digest image + .github/workflows/deploy.yml |
| Vercel | Serverless Node / Edge | Tier 1 — Officially Tested | Next.js serverless runtime adapter |
| Railway & Render | PaaS Target | Tier 2 — Community Supported | Container image / Nixpacks build |
| GitHub Pages | Unified Portal, Static Demo & Storybook | Tier 1 — Officially Tested | VitePress + /demo/ + /storybook/ via .github/workflows/ci.yml |
Available Deployment Recipes
- Generic Docker / VPS Deployment Guide: Canonical portable container baseline suitable for Ubuntu, Debian, AWS EC2, DigitalOcean, or Hetzner.
- Google Cloud Run Deployment Guide: Fully managed serverless container target deploying immutable
ghcr.ioOCI digests to isolated Cloud Run services (wedding-website-stagingandwedding-website, configurable viaCLOUD_RUN_SERVICE/CLOUD_RUN_REGION) using Workload Identity Federation OIDC (orGCP_SA_KEYfallback), GCP Secret Manager, and Cloud SQL. - Vercel Deployment Guide: Serverless Node.js deployment target with serverless PostgreSQL connection pooling.
- Railway & Render PaaS Guide: Low-friction PaaS deployment targets with integrated database provisioning.
- GitHub Pages Workflow: Automated workflow resolving normalized Pages base paths (
portal_base_path,demo_base_path, andstorybook_base_pathviascripts/build-pages-bundle.mjs --resolve-base-pathsinverify), compiling the VitePress documentation portal (verify), interactive static demo (static-export-build), and Storybook component showcase (storybook-build) in parallel CI jobs, verifying the merged bundle viapages-verify(npm run pages:verify), preparing the verifiedpages-bundleartifact in read-onlyprepare-docs, and publishing via checkout-freedeploy-docs.
GitHub Pages Deployment Prerequisites
To publish the unified documentation portal (/), interactive static demo (/demo/), and Storybook component showcase (/storybook/) to GitHub Pages using the automated workflow (.github/workflows/ci.yml), ensure the following repository settings are configured in GitHub:
- Enable GitHub Actions Pages Source:
- In GitHub, navigate to repository Settings > Pages.
- Under Build and deployment > Source, select GitHub Actions (rather than "Deploy from a branch").
- Default repository subpaths (
/<repo>/,/<repo>/demo/,/<repo>/storybook/),<owner>.github.iouser/organization sites (/,/demo/,/storybook/), and custom domains (/,/demo/,/storybook/viaCNAMEor GitHub Pages settings) are resolved once inverify(portal_base_path,demo_base_path,storybook_base_path) and verified againstactions/configure-pagesinprepare-docs.
- Environment Configuration:
- Verify that the
github-pagesdeployment environment is created or permitted under repository Settings > Environments. - Review or configure deployment branch rules and protection gates if needed (by default, read-only
prepare-docsruns strictly on pushes tomainafterverify,ci-complete— verifying all 9 CI verification jobs —static-export-build— includingnpm run test:e2e:static—storybook-build, andpages-verifysucceed, verifyingorigin/mainHEADfreshness, reusing the verifiedpages-bundleartifact wheneveractions/configure-pagesmatchesverifyoutputs across/,<owner>.github.io, custom domains, and/<repo>/forks, or rebuilding all three surfaces otherwise, and verifyingindex.html,demo/index.html,storybook/index.html, and.nojekyllbefore uploading the Pages artifact; isolated checkout-freedeploy-docsthen publishes inside a serializedgithub-pagesFIFO concurrency queue (queue: max) whenis_latest == 'true').
- Verify that the
- Workflow Permissions:
- The
.github/workflows/ci.ymlworkflow scopescontents: readonprepare-docsandcontents: read,pages: write, andid-token: writeon the checkout-freedeploy-docsjob. - Ensure repository settings under Settings > Actions > General > Workflow permissions permit workflows to read and write tokens.
- The