Learn · Get started
How Napalm works
Each project serves one HTTPS endpoint, and the compiler folds your access rules into every SQL statement.
Request lifecycle#
Every data-plane request enters through your project’s HTTPS hostname, compiles on a stateless query engine and executes on dedicated PostgreSQL shard storage.
- Project endpoint
- Each endpoint verifies bearer tokens and binds caller globals.
- Query engines
- Each engine compiles EdgeQL and access policies into one SQL statement.
- Dedicated shards
- Each shard commits writes on a primary and confirms on a replica.
Four components handle each request from TLS termination through durable commit.
- Endpoint
- Every project has a dedicated HTTPS hostname, and requests spread across the cluster’s engines. Napalm verifies each request’s bearer token and binds the caller’s identity and forced globals before the query runs. When a replica takes over from a failed primary, requests follow automatically and the project URL stays the same.
- Engines
- Napalm engines compile each EdgeQL request and its matching access policies into one SQL query. Adding engines or rolling out an engine upgrade moves no data.
- Primary
- The primary takes every write for a shard. On clusters with replicas, a commit succeeds only after a replica in the same region confirms the write.
- Replicas
- Replicas are live PostgreSQL copies of the primary in separate availability zones. A replica serves reads that have caught up to the caller’s bookmark and takes over if the primary fails.
Cluster roles#
Stateless query engines and dedicated PostgreSQL shard members stay decoupled, so scaling compilation capacity or promoting a replica never changes your project endpoint.
Query engine
Engines verify credentials, compile queries with policies and stream live patches.
Shard primary
Each primary runs writes, schema migrations and volatile functions on dedicated storage.
Read replica
Replicas confirm in-region commits, serve caught-up reads and take over on failover.
Core guarantees#
Six architectural guarantees hold across every query, file, subscription and webhook on a project.
- One typed graph
- Rows, files (
ext::files::File), full-text and vector indexes (fts::index,ext::ai::index), background jobs (ext::napalm::Job) and agent grants share one typed graph in PostgreSQL under the same access policies. Full-text indexes and queued jobs commit inside the write transaction, whiledeferredvector embeddings refresh in the background. - Single-statement execution
- Whether you call a saved
.edgeqlquery atPOST /query/{name}(withoptionalparameters for dynamic filters and cursors) or send a parameterized ad-hoc statement toPOST /query, the compiler lowers the query and touched access policies into one SQL statement across links, backlinks and computed properties. Every statement reads one snapshot without N+1 round trips or torn reads. - Closed by default
- An object type without an
access policycannot be read or changed over the Project API. Explicitallowrules walk the graph from verified caller identity, and org tokens (napalm_…) never read customer field values. See Access and sign-in. - Side effects at commit
- Delayed jobs,
notifywebhooks, file upload windows and live-query patches advance only when a transaction commits. Rolled-back writes andis_dry_runpreviews send nothing. - Link-inferred sharding
- The compiler walks
required singlelinks upward to infer placement roots across any hierarchy (Account,Project,SiteorOrganization) while keeping standarduuidprimary keys. Links toext::auth::Identity,multilinks and links markedext::napalm::root := 'none'never claim shard ownership, so multi-org memberships and cross-root references span shards freely. See Schema. - Synchronous durability
- On
standardandscaleclusters, a write succeeds only after both the primary and a replica in the same region confirm the write on disk. If no replica answers for 5 seconds, the primary commits alone until a replica returns. If the primary fails during that window, only writes committed without a replica can be lost.
Replica read routing#
Napalm tracks each caller’s commit position through the Napalm-Bookmark header. Single select, for and group reads route to a replica caught up to that bookmark. Mutations (insert, update and delete), schema migrations and queries calling volatile functions run on the primary.
Writes on the primary
Mutations, migrations and volatile calls execute on the shard primary.
Causal replica reads
Bookmarked reads route to a caught-up replica or use the primary.
If no replica has caught up to the caller’s bookmark yet, the read waits briefly or falls back to the primary so a replica never serves state older than your session’s own writes. Pass the Napalm-Bookmark response header back on subsequent requests. napalm-client and Dart’s napalm_client send bookmarks automatically. See Causal bookmarks.
Dedicated cluster isolation#
Every cluster runs on dedicated machines with its own TLS certificates, encryption keys and object storage buckets. Compute, memory, disk and network paths are never shared across organizations.
| Cluster shape | Default machine topology |
|---|---|
solo | One machine running PostgreSQL and one engine. |
standard | A primary, a replica in another zone and two engines behind one endpoint. |
scale | The standard shape with as many engines and replicas as the traffic needs. |
You can scale machine sizes, add engines or replicas and split horizontal shards online behind the same project URL. See Scale and recovery and Security and data lifecycle.
Storage and durability#
Your rows live on dedicated cluster machines, and Napalm continuously archives every commit to encrypted object storage. Nightly full backups read from a replica whenever one is available so the primary takes no extra load. File attachments (ext::files) live in dedicated cluster buckets under your schema’s access policies and stay retained across your backup window.
Continuous backup archiving
Archived commits and retained file objects stay aligned across your entire restore window.
Continuous archiving lets you restore a whole branch or a single placement root to any second within your retention window without dangling file records. See Point-in-time restore.
In-memory caching and freshness#
Each Napalm engine caches recent read results in memory. A read without a newer bookmark can return from that cache up to one second behind the latest commit, and Napalm-Freshness reports the lag. A read carrying a bookmark observes every write covered by that bookmark.
Versions and upgrades#
Every cluster runs PostgreSQL 18, and Napalm rolls out engine and database upgrades automatically. Place a maintenance hold ahead of a launch to defer automated upgrades. See Maintenance holds.
The EdgeQL foundation#
Napalm’s schema language and EdgeQL come from Gel (formerly EdgeDB), © EdgeDB Inc., used under the Apache License 2.0. Standard SDL schema declarations, EdgeQL queries and built-in library functions run on Napalm’s redesigned engine and compiler.
| Area | Upstream language reference |
|---|---|
| Object types, links and properties | Schema data model |
| Declarative access rules | Access policies |
| Query syntax and operators | EdgeQL reference |
| Built-in functions and types | Standard library |
| Authentication extension | Auth extension |
Napalm and Gel covers Napalm’s security hardening and runtime extensions, and Schema and extensions documents every declaration, global, annotation and extension type. Querying Graph-Relational Data (2025) defines the formal semantics of EdgeQL.