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.
Orgs, projects and branches#
Four resources organize your infrastructure and isolate development from production.
| Resource | Role |
|---|---|
| Org | RoleHolds your projects, clusters, org tokens, teammates and billing |
| Project | RoleServes your backend API, MCP server and auth at notes.napalmdata.com |
| Cluster | RoleRuns dedicated engines, PostgreSQL primaries and replicas from solo up to sharded scale |
| Branch | RoleProvides 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.
| Caller | Credential | Bound globals |
|---|---|---|
| End user | CredentialSession token from built-in sign-in | Bound globalsThe signed-in identity in global caller |
| Backend service | CredentialBranch-scoped service key (ndb_…) | Bound globalsEmpty global caller, plus configured service globals |
| AI agent | CredentialOAuth session or scoped grant token | Bound globalsThe approving user or agent identity in global caller |
| Developer or CI | CredentialOrg token (napalm_…) on the Control API | Bound 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.
dbschema/ default.gel # types, links and access policies queries/ addFile.edgeql addNote.edgeql myFiles.edgeql myNotes.edgeqlRunning 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.