Deployment Checklist
This checklist covers deploying the docs site itself (this site) as well as verifying that features requiring the live app — like the interactive API reference — work correctly after deployment.
Prerequisites
Section titled “Prerequisites”-
vercelCLI installed:npm install -g vercel - Logged in:
vercel whoami(runvercel loginif not) - The main TheTerms app is deployed to
app.theterms.app
Deploy the Docs Site
Section titled “Deploy the Docs Site”-
Build locally to catch errors first
Terminal window npm run buildExpected: all pages build without errors.
-
Link to Vercel project (first time only)
Terminal window vercel linkSelect the existing
theterms-docsproject or create a new one. -
Deploy to production
Terminal window vercel --prodThe CLI prints a production URL on success (e.g.,
https://docs.theterms.app). -
Verify the deployment
Open the production URL and check:
- Homepage loads
- Sidebar navigation works
- Search (Pagefind) returns results
- Dark/light mode toggle works
Verifying the Interactive API Reference
Section titled “Verifying the Interactive API Reference”The API Reference page embeds the Scalar UI, which fetches the OpenAPI spec directly from the browser. It requires:
- The main app to be deployed and accessible at
https://app.theterms.app - The app’s
/api/v1/openapi.jsonendpoint to return CORS headers that allowhttps://docs.theterms.app
Troubleshooting: “Document could not be loaded”
Section titled “Troubleshooting: “Document could not be loaded””If the Scalar viewer shows “Document ‘api-1’ could not be loaded”:
Cause: The browser’s fetch() for https://app.theterms.app/api/v1/openapi.json is being blocked. This is most commonly a CORS issue — the app needs to include Access-Control-Allow-Origin: https://docs.theterms.app (or *) on the OpenAPI spec endpoint.
Diagnosis steps:
- Open browser DevTools → Network tab
- Reload the
/api-reference/reference/page - Find the request to
openapi.json - Check for a CORS error in the response headers or console
Fix in the main app:
Ensure the Hono app includes a CORS middleware on /api/v1/openapi.json. In apps/web/src/server/api/v1/index.ts, the cors() middleware should include the docs domain:
app.use('/openapi.json', cors({ origin: 'https://docs.theterms.app' }))Or for development, use origin: '*' temporarily.
Local testing:
To test the Scalar viewer locally against a local app instance:
- Run the main app:
pnpm dev(in thethetermsrepo) - Run the docs:
npm run dev(in this repo) - Temporarily update
reference.mdx’sdata-urltohttp://localhost:3000/api/v1/openapi.json - Revert before committing