Skip to Content
StandardsDeployment

Deployment

Every app in the Frequency monorepo deploys as its own Vercel project with its own domain, environment variables, and preview environments. This gives each site independent deployment lifecycles while sharing the same codebase.

Deployment Model

Brand Site

apps/public/brand

Public

Brand guidelines and component showcase. Own Vercel project, own domain.

Public Template

apps/public/template-public

Public

Public documentation template. Own Vercel project, own domain.

Standards

apps/private/standards

Auth Required

This site. Requires Supabase auth. Own Vercel project, own domain.

Private Template

apps/private/template-private

Auth Required

Authenticated documentation template. Own Vercel project, own domain.

Each app is a separate Vercel project with:

  • Its own production domain
  • Its own preview environments (per PR)
  • Its own environment variables (though Supabase creds are shared)
  • Independent deployment triggers and rollbacks

Quick Setup

The fastest path to deploying a new app:

/setup-project yourdomain.com

This automates all the steps below. For manual setup or understanding what happens under the hood, read on.

Each app in the monorepo needs its own Vercel project:

# Navigate to the app directory cd apps/private/standards # Link to a new Vercel project vercel link --yes

This creates .vercel/project.json with your org and project IDs.

Important: Repeat this for each app you want to deploy. Each app = one Vercel project.

Step 2: Add Custom Domain

vercel domains add standards.yourdomain.com

Step 3: Configure DNS (Route 53)

Apex Domain (yourdomain.com)

Record TypeNameValue
A@76.76.21.21

Subdomains (app.yourdomain.com)

Record TypeNameValue
CNAMEstandardscname.vercel-dns.com
CNAMEbrandcname.vercel-dns.com

PR Preview Wildcard

For automatic PR preview environments:

Record TypeNameValue
CNAME*.branchcname.vercel-dns.com

Step 4: GitHub Secrets

Add these secrets to your GitHub repository for CI/CD:

SecretSource
VERCEL_ORG_ID.vercel/project.jsonorgId
VERCEL_PROJECT_ID.vercel/project.jsonprojectId
VERCEL_TOKENVercel Settings → Tokens 

Note: If deploying multiple apps, you’ll need separate VERCEL_PROJECT_ID values per app (store as VERCEL_PROJECT_ID_STANDARDS, VERCEL_PROJECT_ID_BRAND, etc.).

Step 5: Environment Variables

Add required environment variables for each Vercel project:

# Per-app: navigate to app dir first cd apps/private/standards vercel env add NEXT_PUBLIC_SUPABASE_URL vercel env add NEXT_PUBLIC_SUPABASE_ANON_KEY

Environment Scopes

Vercel supports three scopes per variable:

ScopeWhen Used
Developmentvercel dev locally
PreviewPR preview deployments
ProductionProduction deployments

All apps share the same Supabase project, so the Supabase credentials are identical across apps and scopes.

Step 6: Deploy

# Production deployment vercel --prod # Preview deployment (automatic on PR) vercel

PR Preview Environments

Every pull request automatically gets a preview deployment:

  • URL: Unique Vercel URL per deployment
  • Deployed on: Every push to the PR branch
  • Torn down: When the PR is merged or closed
  • Environment: Uses “Preview” scope environment variables

How It Works

  1. Developer opens a PR
  2. GitHub Actions triggers vercel deploy for each affected app
  3. Vercel builds and deploys to a preview URL
  4. The PR gets a comment with the preview link
  5. Reviewers can test the changes in a live environment

Build Configuration

Next.js + Nextra Config

// next.config.mjs const withNextra = nextra({}); export default withNextra({ reactStrictMode: true, transpilePackages: ['@frequencyads/components'], experimental: { optimizePackageImports: ['@mantine/core', '@mantine/hooks', '@tabler/icons-react'], }, });

Build Commands

CommandPurpose
pnpm buildFull production build (via Turborepo)
pnpm postbuildGenerate Pagefind search index
pnpm startStart production server locally

Build Optimizations

  • Turborepo caching — unchanged packages skip rebuilds
  • Output file tracing — only deploy files that are actually used
  • Automatic code splitting — per-route bundles
  • Static generation — pages without dynamic data are pre-rendered
  • Package import optimization — tree-shakes Mantine and Tabler icons

Monitoring

Health Check

// src/app/api/public/health/route.ts export function GET() { return Response.json({ status: 'healthy', timestamp: new Date().toISOString(), version: process.env.NEXT_PUBLIC_APP_VERSION, }); }

Rollback

If a production deployment has issues:

  1. Instant rollback via Vercel dashboard → Deployments → Previous → Promote
  2. CLI rollback: vercel rollback
  3. Git revert: Revert the commit, push, and let CI/CD redeploy

Each app can be rolled back independently since they’re separate Vercel projects.

Deployment Checklist

Before deploying to production:

  • Type checking passes (pnpm type-check)
  • Build succeeds locally (pnpm build)
  • Environment variables set for production scope (per Vercel project)
  • DNS records configured and propagated
  • GitHub secrets configured for CI/CD
  • PR preview tested by at least one reviewer
  • Quality gates (VALIDITUS, GATED) passed
Last updated on