Skip to the page

First principles

Chapter 3 of 11

Parts of a project

An org holds your clusters, projects and database branches. Each project serves one HTTPS endpoint for users, backend services and AI agents while keeping control credentials separate from row data.

Before deploying a schema, you need a clean boundary between managing infrastructure and reading application rows. Developers and CI pipelines should be able to create branches and scale clusters without holding a password that reads private records.

Try it

Sign in from your terminal to save an org token that controls clusters and projects without access to row data.

Your terminal
napalm login
Opening your browser to sign in…
If the browser doesn’t open, visit:
https://console.napalmdata.com/authorize-cli?port=53817&state=…&challenge=…&name=napalm+CLI+on+studio
Signed in to Northwind
Can make changes until 2026-11-16 01:12 PST
Browser sign-in saves an org token that manages infrastructure and never reads customer rows.

Orgs, projects and branches#

Four resources organize your infrastructure and isolate development from production.

ResourceRole
OrgRoleHolds your projects, clusters, org tokens, teammates and billing
ProjectRoleServes your backend API, MCP server and auth at notes.napalmdata.com
ClusterRoleRuns dedicated engines, PostgreSQL primaries and replicas from solo up to sharded scale
BranchRoleProvides an isolated database beside main with separate rows, service keys and sessions

Production traffic hits main, while feature work and pull requests target separate branches. Every cluster runs on dedicated compute, storage volumes, TLS keys and object buckets rather than sharing database processes with other customers.

Dedicated cluster

Dedicated compute, disks, TLS keys and storage buckets per cluster.

Isolated branches

Separate rows, service keys and sessions alongside main.

Callers and credentials#

Pillar at work: Caller-bound

Four kinds of callers interact with a project. Each brings a distinct credential, and Napalm binds project credentials into typed EdgeQL globals before any query executes.

CallerCredentialBound globals
End userCredentialSession token from built-in sign-inBound globalsThe signed-in identity in global caller
Backend serviceCredentialBranch-scoped service key (ndb_…)Bound globalsEmpty global caller, plus configured service globals
AI agentCredentialOAuth session or scoped grant tokenBound globalsThe approving user or agent identity in global caller
Developer or CICredentialOrg token (napalm_…) on the Control APIBound globalsNone (manages infrastructure only and cannot query row data)

Every stored type starts closed to application callers. In our running example, Ada and Ben authenticate with user sessions, background workers use branch-scoped service keys, and your CLI or CI pipeline uses an org token (napalm_…) that inspects schemas, row counts and access traces without reading field values.

Schema and query files#

Pillar at work: One typed graph

Your schema and queries live as plain files in git beside your application code. The starter notes project begins with one schema file and four EdgeQL query files.

Your repository
dbschema/  default.gel          # types, links and access policies  queries/    addFile.edgeql    addNote.edgeql    myFiles.edgeql    myNotes.edgeql
One schema file and four EdgeQL files define types, access policies and endpoints.

Running napalm schema push against main checks all four query files against the schema, applies any migration in one transaction and deploys each query by name at POST /query/{name}. Pushing with --branch runs the same validation and migrates only that branch.

When Ada saves a note on main, Napalm verifies her session, compiles addNote together with the insert policy into one SQL statement, and streams the committed note to her open tabs.

With credentials separated and queries deployed, every stored type still starts closed until a policy opens access.

Type a word or two to search every docs page.