This document defines the day-to-day development workflow for WatchVault.
WatchVault uses three branch roles:
main: production codestaging: integrated pre-production code- short-lived feature branches: isolated work in progress
This matches the hosted deployment model:
maindeploys to production Vercel domainsstagingdeploys to the shared preview Vercel domains- feature branches are temporary and should be merged or deleted quickly
- Start new work on a short-lived branch.
- Keep the branch focused on one feature, bug fix, or operational change.
- Merge the feature branch into
stagingfor integrated testing. - Verify the
stagingfrontend and backend previews on Vercel. - Merge
stagingintomainwhen the combined change set is ready for production. - Delete the short-lived branch after merge.
- Do not do random direct development on
main. - Do not use
stagingas a personal scratch branch forever. - Do not let
stagingdrift for long periods without either promoting it tomainor cleaning it up. - Do not make ad hoc console changes without documenting the corresponding repository or environment impact.
WatchVault has one codebase but multiple runtime environments.
- Local:
- frontend at
http://localhost:3000 - backend at
http://localhost:3001 - backend local env currently points at the Neon preview branch for safer testing
- frontend at
- Staging:
- frontend at
https://watch-vault-git-staging-trietlus-projects.vercel.app - backend at
https://watch-vault-api-git-staging-trietlus-projects.vercel.app - Neon preview branch
- frontend at
- Production:
- frontend at
https://mywatchvault.app - backend at
https://api.mywatchvault.app - Neon production branch
- frontend at
Clerk is shared between staging and production. That means the same signed-in Clerk user can authenticate in both, but the backend resolves that user against different Neon branches depending on which environment handled the request.
Frontend:
NEXT_PUBLIC_APP_BASE_URL: frontend originNEXT_PUBLIC_API_BASE_URL: backend originNEXT_PUBLIC_CLERK_PUBLISHABLE_KEY: Clerk web app binding
Backend:
APP_BASE_URL: expected frontend origin for auth and URL generationAPI_BASE_URL: public backend origin for file and public link generationDATABASE_URL: pooled Neon runtime connectionDIRECT_URL: direct Neon connection for Prisma workflowsCLERK_SECRET_KEY: Clerk server verification secret
For hosted preview, backend envs use two layers:
- Project-wide
Previewenvs:DATABASE_URLDIRECT_URLJWT_SECRETCLERK_SECRET_KEYBLOCKCHAIN_ENABLEDCHAIN_ENV=previewCHAIN_RPC_URL=https://sepolia.base.orgCHAIN_ID=84532CHAIN_PRIVATE_KEYCHAIN_CONTRACT_ADDRESSBLOB_READ_WRITE_TOKEN
- Branch-specific
Previewenvs:APP_BASE_URLAPI_BASE_URL
Why:
APP_BASE_URLmust match the active frontend preview origin for Clerk authorization and public-link generation.API_BASE_URLmust match the active backend preview origin for public file and API URL generation.DATABASE_URLandDIRECT_URLcan stay shared if all preview branches use the same Neon preview branch.- If each feature branch gets its own Neon branch later, then
DATABASE_URLandDIRECT_URLshould also become branch-specific.
If these values do not line up by environment, the most common failures are:
- empty watch lists because the frontend is calling the wrong backend
- auth failures because the backend
APP_BASE_URLdoes not match the active frontend origin - production and preview data mixing because the backend points at the wrong Neon branch
Prefer MCP-backed automation through Codex over direct console work when possible.
- Use Vercel MCP for deployments, domains, logs, and environment variables.
- Use Neon MCP for branch inspection, SQL, and schema checks.
- Manage Clerk-related app behavior through repository changes and Vercel environment variables first.
This keeps infrastructure changes reproducible and easier to review.
Before merging staging into main:
- Confirm the frontend
stagingpreview loads. - Confirm the backend
stagingpreview is healthy. - Confirm
stagingpoints at the Neon preview branch, not production. - Confirm production env values are still pointed at production domains and the production Neon branch.
- Merge
stagingintomain. - Verify production frontend and backend after deployment.