Royal Glow internal docs · now fully interactive — Steps, API tables, file trees & live status
Royal Glow Docs

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:

BranchEnvironmentNeon BranchPurpose
prodProductionprodLive traffic — real customers
pprdPre-productionpprdFinal validation before going live
testTest / QAtestIntegration tests, CI
devDevelopmentdevActive 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

BranchProtection
prodRequire manual approval + all CI checks passing
pprdRequire all CI checks (lint, test, Playwright, Lighthouse, k6)
testRequire lint + unit + integration + Playwright + Lighthouse CI
devRequire lint + type check + unit tests

Database Per Environment

All environments use Neon DB branches within a single Neon project — no separate paid projects needed.

BranchNeon BranchReset Policy
prodprodNever reset — live customer data
pprdpprdAuto-reset daily from prod + PII stripped
testtestWiped and reseeded before each CI run
devdevDeveloper 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 daily

CI/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/leads

Pre-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 --staged

This catches formatting issues and obvious lint errors before they ever reach CI — saving pipeline minutes and avoiding "fix lint" commits.

Secrets Management

SecretWhere Stored
DATABASE_URL_PROD/PPRD/TEST/DEVGitHub Actions encrypted secrets
DATABASE_URL_UNPOOLED_*GitHub Actions encrypted secrets
RESEND_API_KEYGitHub Actions encrypted secret
BETTER_AUTH_SECRETGitHub Actions encrypted secret
GOOGLE_OAUTH_CLIENT_ID/SECRETGitHub Actions encrypted secret

Never commit secrets to git. Use .env.local locally (gitignored) and GitHub Actions secrets in CI.

Deployment

  • rgss-web (theroyalglow.in) and rgss-admin (admin.theroyalglow.in), deployed via the OpenNext adapter (opennextjs-cloudflare deploy / wrangler deploy)
  • Automatic deployment on push to prod branch
  • Preview (versioned) deployments on every PR
  • Rollback: instant via wrangler rollback or the Workers & Pages → Deployments view
  • rgss-cms (cms.theroyalglow.in)
  • Auto-deploy on push to prod branch
  • 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.

OpenReport an issue

Was this page helpful?

On this page