Guides · Shipping & operations
Environments & going live
Develop on isolated personal branches, validate pull requests automatically and lock down endpoints, origins and backups before launch.
- In the schema
- —
What you’ll build#
This guide establishes the workflow from local feature development to production. You iterate against an isolated personal branch, validate every pull request on an ephemeral pr-<number> preview branch and deploy your schema and query catalog alongside the app before hardening main for live traffic.
Isolated preview branches
Personal and pull-request branches isolate rows, service keys and sessions from production.
Checked schema pushes
Every schema push compiles your saved queries before applying changes to production.
Map each stage to a branch#
You don’t install a local database daemon to develop on Napalm. Every stage runs against an isolated database on your project: a personal branch during local development, an automatic branch per pull request during review and main in production. Each branch starts from main’s schema and sign-in settings while maintaining separate rows, service keys and sessions.
| Stage | Target database | Provisioned by |
|---|---|---|
| Local development | Personal branch | Provisioned byCreated once with napalm branches create |
| Pull request | pr-<number> | Provisioned byThe Napalm GitHub App or a CI workflow step |
| Production | main | Provisioned byRepository merge or napalm schema push in CI |
Develop against a personal branch#
Create a personal branch for local iteration, enable its HTTPS endpoint for your dev server and push schema changes directly as you work.
# Create an isolated personal branch (pass --data to copy main's rows as well)napalm branches create notes dev-ada # Enable the branch API for your local dev servernapalm endpoint notes --branch dev-ada --enable --allow-origin http://localhost:5173 # Push local schema edits directly to your personal branchnapalm schema push notes --branch dev-ada --yesPoint your local environment file at the branch URL.
# .env.local: append /branches/<name> to the project base URLVITE_NAPALM_URL=https://<project-address>/branches/dev-adaNamed deployed queries belong to main, so non-main branches execute statement text sent by your SDK client (generated without --deployed). Running napalm generate notes --lang ts --branch dev-ada typechecks every query file against your branch’s schema at generation time. Set the branch’s passthrough mode to all for browser sessions and service keys, or keys for backend-only keys.
- User sessions
- Each branch maintains isolated user accounts and rejects session tokens issued on
main. Register test accounts directly on your branch. - Service keys
- Service keys belong to a single branch (
napalm keys create notes --branch dev-ada), and branches reject keys issued formain. - Local action handlers
- External action handlers must be reachable over HTTPS. Expose your local dev server through a tunnel and attach the action URL to your personal branch alone.
- Cleanup
napalm branches remove notes dev-adadeletes the branch along with its rows and service keys.
Give every pull request a branch#
Install the Napalm GitHub App from the console and connect your repository. Opening a pull request creates an isolated pr-<number> branch, applies the proposed schema, posts a migration-plan comment and runs a status check that fails if any deployed query breaks. Merging applies the migration to main and removes the preview branch.
napalm repository follow notes acme/notes-app --copy schemanapalm repository show notesPass --copy data to seed each pull-request branch with main’s rows in addition to its schema. To pair frontend preview deployments with each pull request, enable the branch endpoint, allow the preview origin and generate the preview client without --deployed.
# Enable the pull-request branch API inside your preview build workflownapalm endpoint notes --branch "pr-$PR_NUMBER" --enable --allow-origin "https://pr-$PR_NUMBER.preview.example.com"echo "NAPALM_URL=https://<project-address>/branches/pr-$PR_NUMBER" >> .env.productionIf you run CI outside GitHub or prefer explicit workflow steps, three CLI commands reproduce the same flow. See Branches for the complete workflow.
Deploy the schema with the app#
Connected repositories migrate main automatically on merge. Otherwise, push from your deployment pipeline using a scoped org token.
# Issue a dedicated CI org token and store the printed value as NAPALM_TOKENnapalm tokens create --label deploy --scope manage --days 30on: push: branches: [main]jobs: schema: runs-on: ubuntu-latest env: NAPALM_TOKEN: ${{ secrets.NAPALM_TOKEN }} steps: - uses: actions/checkout@v4 - run: curl -fsSL https://downloads.napalmdata.com/cli/install.sh | sh && echo "$HOME/.napalm/bin" >> "$GITHUB_PATH" # Migrate the schema and compile every query in dbschema/queries in one push - run: napalm schema push notes --yesBecause schema migrations and application builds deploy moments apart while open browser tabs continue running prior client code, two rollout habits prevent downtime.
- Expand first, contract later
- Push additive schema changes (new properties, types or queries) before deploying client code that uses those additions. Drop retired fields or queries in a follow-up release once old clients drain. Napalm blocks any push that breaks an active deployed query.
- Version reshaped queries
- Clients invoke deployed queries by name. Changing a query’s input variables or output shape breaks open tabs running the previous build, so publish the new shape under a new file name and delete the old query after traffic shifts.
Live schema changes walks through adding required fields, renaming properties and indexing large tables safely, and Release rehearsals tests migrations against a full clone of main before rollout.
Lock down production before launch#
New projects start permissive so local development works immediately. Harden your main endpoint, authentication settings and spend controls before opening to production users.
# Restrict CORS to your production origin and remove localhostnapalm endpoint notes --allow-origin https://app.example.com --remove-origin http://localhost:5173 # Restrict user sessions to deployed queries and disable schema introspectionnapalm endpoint notes --passthrough keys --hide-schema # Lock sign-in redirects to production and require email verification via SMTPnapalm sign-in set notes --redirect https://app.example.com/signed-in --require-verificationnapalm sign-in email notes --host smtp.example.com --sender "Notes <sign-in@example.com>" \ --username sign-in@example.com # Set a monthly compute spend ceiling and an early warning thresholdnapalm orgs limits --cap 500 --alert 300 napalm status notes| Setting | Production target | Why |
|---|---|---|
| Browser origins | Production domains only | WhyRestricts browser CORS access to listed origins and removes localhost dev URLs from main. |
| Passthrough | keys | WhyConfines end-user sessions to deployed queries and rejects ad-hoc statements with 403 deployed_query_required. |
| Schema introspection | Hidden unless needed | WhyDisables GET /schema, /ask and MCP schema inspection when your app does not expose those features. |
| Redirect URLs | Production callback URLs | WhyRestricts post-login redirects to listed URLs (passing --redirect replaces the active list). |
| Email verification | Required via custom SMTP | WhyPrevents unverified sign-ups under unowned email addresses. |
| Session lifetime | 14 days or shorter | WhyControls how long users stay signed in before re-authenticating. Access tokens refresh hourly, and sign-out revokes the session immediately. |
| Service keys | One expiring key per service | WhyIssue labeled keys (--label) with --read-only where possible and a lifetime up to 365 days. Never ship service keys in browser or mobile bundles. |
| Spend limits | Monthly cap and alert | WhyCaps monthly cluster compute charges and emails org managers when usage crosses your alert threshold. |
Key and secret renewal covers zero-downtime credential renewal, and Launch preparation covers load testing, cluster scaling and launch-week maintenance holds.
Monitor the project after launch#
Four CLI commands audit configuration health, query performance, row-level access decisions and organization changes in production.
napalm status- Audits every project subsystem, flags missing configuration gaps and prints the exact command to resolve each gap.
napalm insights- Reports the slowest statements, access-policy execution share and recommended indexes.
napalm explain-access- Traces which access policies matched or blocked a specific user on a specific record.
napalm activity- Lists organization audit events alongside each actor: issued keys, schema migrations and configuration changes.
Production monitoring organizes these checks into a post-deploy and daily operating routine, and Troubleshooting & auditing walks through diagnosing empty query results, rejected writes and stale replica reads.
Check the production setup#
Verify query compatibility checks on a pull request
Remove a property referenced by a deployed query and open a pull request. Confirm the status check fails, the PR comment names the broken query and
mainstays untouched.Verify branch isolation and passthrough lockdown
Confirm
mainrejects a service key created for a dev branch, and confirm an ad-hoc EdgeQL query sent with a user session fails under--passthrough keys.Audit production status and allowed origins
Run
napalm status notesto confirm zero configuration gaps, and checknapalm endpoint notesto verify only your production origin appears.