First principles
Chapter 3 of 11
Parts of a project
An org holds your clusters, projects and branches. Every project gives people, services and agents one HTTPS address governed by one schema.
Typical stacks scatter credentials across separate tools: user sessions live in an auth service, API keys sit in a gateway and database passwords live in environment secrets where admin keys can read private user notes.
Try it
Napalm separates infrastructure control from application data on your very first command. Sign the CLI in to your org.
Orgs, projects and branches#
Signing in connects the CLI to your org. Four resources organize your projects and databases.
| Part | Purpose |
|---|---|
| Org | PurposeHolds your projects, clusters, org tokens, teammates and billing |
| Project | PurposeServes one complete backend at notes.napalmdata.com |
| Cluster | PurposeProvides the machines underneath, from single-machine solo to sharded scale |
| Branch | PurposeRuns an isolated database beside main with separate records, keys and sessions |
Dedicated cluster
Isolated compute, disks, TLS keys and storage buckets behind one project address.
Isolated branches
Each branch runs beside main with separate records, keys and sessions.
Ada and Ben use main. Schema pushes and test writes on other branches never touch main, and every cluster runs on dedicated compute, disks, TLS keys and storage buckets.
Callers and credentials#
Pillar at work: Caller-bound
Once a project is running, four kinds of callers talk to Napalm. Each caller brings a distinct credential, and Napalm turns that credential into typed globals before any query runs.
| Caller | Credential | Bound globals |
|---|---|---|
| Ada and Ben | CredentialSession from built-in sign-in | Bound globalsThe signed-in person in global caller |
| Backend service | CredentialProject service key | Bound globalsEmpty global caller, plus scoped service globals |
| Ada’s agent | CredentialToken approved by Ada | Bound globalsAda in global caller |
| You or CI | CredentialOrg token for the control API | Bound globalsNothing, because org tokens cannot query project data |
User sessions
Built-in sign-in binds the signed-in person in global caller.
Service keys and org tokens
Service keys query one branch, while org tokens (napalm_…) manage clusters without reading row values.
Approved agent tokens
OAuth consent binds the approving person or a time-limited grant.
Every stored type starts closed to application callers. Org tokens (napalm_…) inspect schemas, counts and rule traces without reading field values.
Schema and query files#
Pillar at work: One typed graph
Those types, rules and queries live as plain files in your repository alongside your app code. The starter notes app begins with five files.
dbschema/ default.gel # types, links and access rules queries/ addFile.edgeql addNote.edgeql myFiles.edgeql myNotes.edgeqlPushing to main checks every query against the new schema, applies the migration in one transaction and deploys each query by name at POST /query/{name}. Pushing to another branch checks the queries and migrates only that branch.
When Ada adds a note, her session reaches main, Napalm runs addNote and the ownership rule in one SQL statement, and the saved note streams to her other open tabs.
Next, Ben tries to read Ada’s private notes.