Skip to the page

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#

Project endpoint
Verifies user sessions and service keys and enforces endpoint rules.
Engines
Compile EdgeQL and access policies into one SQL statement.
Dedicated shards
Commit each write on a primary and confirm the write on a replica.
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 that have a replica, 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 across the cluster’s internal routing path, so scaling compilation capacity or promoting a replica never changes your project endpoint.

Query Engine

Verifies caller credentials, compiles EdgeQL and touched policies into one SQL statement and streams live patches.

Shard Primary

Executes every transaction write, migration and volatile call on dedicated PostgreSQL storage.

Read Replica

Confirms synchronous in-region commits, serves caught-up reads and stands ready in another zone for failover.

Core guarantees#

One typed graph
Rows, files (ext::files::File), vector indexes (ext::ai::index), background jobs (ext::napalm::Job) and agent grants share one typed graph in PostgreSQL under the same access policies and transaction snapshots.
Single-statement execution
The compiler turns every 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 policy cannot be read or changed over the Project API. Explicit allow rules 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, notify webhooks, file upload windows and live-query patches advance only when a transaction commits. Rolled-back writes and is_dry_run previews send nothing.
Synchronous durability
On standard and scale clusters, a write succeeds only after both the primary and a replica in the same region save it to disk. If no replica answers for 5 seconds, the primary commits alone until a replica returns. Losing the primary before a replica returns loses only writes committed without a replica.

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 & volatile calls on primary

Every insert, update, delete, migration and volatile function executes on the shard primary and confirms synchronously on an in-region replica.

Causal reads via Napalm-Bookmark

Read statements carrying Napalm-Bookmark route to an in-region replica caught up to that commit position, falling back to the primary rather than serving stale state.

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. Each cluster has dedicated TLS certificates, encryption keys and object storage buckets. No compute, memory, disk or network path is shared across organizations.

Cluster shapeDefault machine topology
soloOne machine running PostgreSQL and one engine.
standardA primary, a replica in another zone and two engines behind one endpoint.
scaleThe 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 your cluster’s dedicated database machines. Napalm continuously archives every commit to encrypted object storage. Nightly full backups read from a replica whenever 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 commit archiving & replica backups

Commits stream continuously to encrypted object storage while nightly full backups read from a replica, keeping ext::files attachments aligned across your restore window.

Continuous archiving lets you restore a whole branch or a single customer 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.

AreaUpstream language reference
Object types, links and propertiesSchema data model
Declarative access rulesAccess policies
Query syntax and operatorsEdgeQL reference
Built-in functions and typesStandard library
Authentication extensionAuth 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.

Type a word or two to search every docs page.