Policy update (2026-09-09): Environment promotions now use checked fast-forward updates throughpromote.yml, preserving identical commits without promotion PRs. Release Please targetsdev. Seeknowledge-base/branch-promotions.mdfor the current procedure; older merge-based examples below are historical.
In one line: Collaborative workflow with four persistent branches
(
dev → test → pprd → prod), each mapped to a Neon DB branch. Gates get
stricter at every stage, no direct pushes to prod, and commits follow
Conventional Commits.Branch Strategy
The platform uses 4 persistent branches, each mapped to an environment:
Flow direction:
dev → test → pprd → prod
Work happens on dev (or short-lived feature branches off dev). Code must pass all CI gates at each stage before being promoted. No direct pushes to prod.
Branch Protection Rules
GitHub Rulesets are the only merge gate: a reviewed pull request into
dev that
satisfies the required status checks is merged directly. See
Engineering Workflow and
GitHub Rulesets for the current policy.
Database Per Environment
All environments use Neon DB branches within a single Neon project — no separate paid projects needed.Prod → pprd Data Replication
Every 24 hours, a GitHub Actions cron job uses the Neon Branch Reset API to sync pprd from prod.1
Reset the branch
Call the Neon API to reset the
pprd branch from prod.2
Anonymise PII
Run a PII anonymisation script — names, phone numbers, and emails are replaced with fake data.
3
Ready for UAT
pprd is now a clean, realistic copy of prod without real customer data.
pg_dump / pg_restore because Neon branching is a near-instant copy-on-write operation at the storage layer.
CI/CD Pipeline
Gates are cumulative — each stage adds checks on top of the previous one.- PR to dev
- PR to test
- PR to pprd
- PR to prod
Commit Conventions
Use Conventional Commits for clean history and automatic changelog generation:Pre-Commit Hooks
Everygit commit automatically runs Biome lint + format on staged files via Husky + lint-staged:
Secrets Management
Deployment
- AWS (current)
- Other workloads
apps/webandapps/admin: Lambda (ARM64) + CloudFront + S3 per app throughsst.aws.Nextjsdeploy-aws.ymlon push toprod: GitHub OIDC →bunx sst deploy --stage production; whenAWS_DOMAINS_LIVE=true, retry both public health endpoints up to 6 times with 15-second waits- Recovery: inspect SST/Pulumi logs, stack state, and both applications, then manually deploy a known-good
git_refif needed - Cloudflare remains authoritative DNS; SST manages only required validation and alias records
Weekly Backup
Every Sunday at 2 AM UTC, a GitHub Actions workflow:1
Dump
Run
pg_dump against the Neon prod branch.2
Upload
Upload the compressed dump to Cloudflare R2 (
backups/weekly/).3
Retain
Keep 8 weeks of backups.
4
Heartbeat
Ping the BetterStack heartbeat on success.
Related
- Testing — Full CI gate specifications
- Deployment — Platform configuration details
- Environment Variables — All secrets and their purpose
