Git Workflow
Branch strategy, CI/CD pipeline, commit conventions, and database-per-environment for Royal Glow.
Git Workflow
In one line: Single-developer 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
Single developer workflow with 4 persistent branches, each mapped to an environment:
| Branch | Environment | Neon Branch | Purpose |
|---|---|---|---|
prod | Production | prod | Live traffic — real customers |
pprd | Pre-production | pprd | Final validation before going live |
test | Test / QA | test | Integration tests, CI |
dev | Development | dev | Active development work |
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
| Branch | Protection |
|---|---|
prod | Require manual approval + all CI checks passing |
pprd | Require all CI checks (lint, test, Playwright, Lighthouse, k6) |
test | Require lint + unit + integration + Playwright + Lighthouse CI |
dev | Require lint + type check + unit tests |
Database Per Environment
All environments use Neon DB branches within a single Neon project — no separate paid projects needed.
| Branch | Neon Branch | Reset Policy |
|---|---|---|
prod | prod | Never reset — live customer data |
pprd | pprd | Auto-reset daily from prod + PII stripped |
test | test | Wiped and reseeded before each CI run |
dev | dev | Developer sandbox, scales to zero when idle |
Prod → pprd Data Replication
Every 24 hours, a GitHub Actions cron job uses the Neon Branch Reset API to sync pprd from prod.
Reset the branch
Call the Neon API to reset the pprd branch from prod.
Anonymise PII
Run a PII anonymisation script — names, phone numbers, and emails are replaced with fake data.
Ready for UAT
pprd is now a clean, realistic copy of prod without real customer data.
This is faster than pg_dump / pg_restore because Neon branching is a near-instant copy-on-write operation at the storage layer.
# .github/workflows/replicate-prod-to-pprd.yml
on:
schedule:
- cron: '0 1 * * *' # 1 AM UTC dailyCI/CD Pipeline
Gates are cumulative — each stage adds checks on top of the previous one.
✅ Lint + Format (Biome + Ultracite)
✅ Type check (tsc --noEmit)
✅ Unit tests (Vitest)✅ Lint + Format
✅ Type check
✅ Unit tests
✅ Integration tests (Neon test branch)
✅ Playwright E2E tests
✅ Lighthouse CI (performance ≥ 95; accessibility, best practices, SEO = 100)✅ All tests from test branch
✅ k6 load test against pprd environment
✅ OWASP ZAP security scan
✅ Smoke test Playwright suite✅ All CI gates passing
✅ Manual approval required
🚀 Deploy to Cloudflare Workers (OpenNext adapter)Commit Conventions
Use Conventional Commits for clean history and automatic changelog generation:
feat: add booking confirmation email
fix: correct availability calculation for same-day slots
chore: update dependencies
docs: update testing plan
test: add E2E test for admin booking flow
refactor: extract pricing logic to service layer
perf: cache service catalog in Cloudflare KV
security: add rate limiting to /api/leadsPre-Commit Hooks
Every git commit automatically runs Biome lint + format on staged files via Husky + lint-staged:
# What runs on every commit (~200ms):
biome check --write --stagedThis catches formatting issues and obvious lint errors before they ever reach CI — saving pipeline minutes and avoiding "fix lint" commits.
Secrets Management
| Secret | Where Stored |
|---|---|
DATABASE_URL_PROD/PPRD/TEST/DEV | GitHub Actions encrypted secrets |
DATABASE_URL_UNPOOLED_* | GitHub Actions encrypted secrets |
RESEND_API_KEY | GitHub Actions encrypted secret |
BETTER_AUTH_SECRET | GitHub Actions encrypted secret |
GOOGLE_OAUTH_CLIENT_ID/SECRET | GitHub Actions encrypted secret |
Never commit secrets to git. Use .env.local locally (gitignored) and
GitHub Actions secrets in CI.
Deployment
rgss-web(theroyalglow.in) andrgss-admin(admin.theroyalglow.in), deployed via the OpenNext adapter (opennextjs-cloudflare deploy/wrangler deploy)- Automatic deployment on push to
prodbranch - Preview (versioned) deployments on every PR
- Rollback: instant via
wrangler rollbackor the Workers & Pages → Deployments view
rgss-cms(cms.theroyalglow.in)- Auto-deploy on push to
prodbranch - Zero-downtime deploys via Render's rolling restart
Weekly Backup
Every Sunday at 2 AM UTC, a GitHub Actions workflow:
Dump
Run pg_dump against the Neon prod branch.
Upload
Upload the compressed dump to Cloudflare R2 (backups/weekly/).
Retain
Keep 8 weeks of backups.
Heartbeat
Ping the BetterStack heartbeat on success.
Related
- Testing — Full CI gate specifications
- Deployment — Platform configuration details
- Environment Variables — All secrets and their purpose
Was this page helpful?