Skip to the page

First principles

Chapter 1 of 11

Napalm’s origin

Napalm compiles one schema into your entire backend on PostgreSQL 18. Data types, access policies, background jobs, search and live queries stay in sync without glue code.

Building an application usually means stitching together separate services for sign-in, database queries, file storage, background jobs, search and live updates. Each service keeps its own permission checks, so one missed filter exposes private records and one failed queue call leaves state out of sync.

Try it

Napalm replaces those separate services with one schema file and saved EdgeQL queries. Run one command to scaffold a working starter app and configure a project.

Terminal
napalm new notes-app notes
The starter app includes sign-in, live note lists, file uploads and search.

Four jobs in one system#

Every backend has to identify the caller, enforce permissions, record changes and trigger downstream work. Conventional stacks assign each job to a separate tool, while Napalm handles all four from one schema.

A typical stackNapalm
Who is calling?A typical stackExternal auth serviceNapalmSign-in built into every project
What is allowed?A typical stackChecks repeated in route codeNapalmAccess policies declared on each type
What changed?A typical stackSeparate queue or polling workerNapalmOrdered change log of every commit
What updates next?A typical stackCustom workers and socket serversNapalmLive queries, webhooks and jobs at commit

Web tabs, mobile apps, background workers, warehouse syncs, training pipelines and AI agents all read and write the same records. Keeping authorization inside HTTP route handlers leaves non-HTTP callers unprotected or forces your team to copy checks across every service.

Compiling a backend from one schema#

Napalm moves those rules into one schema file and compiles your backend the way a language compiler builds a program. You declare types, links, indexes and access policies in dbschema/default.gel alongside saved .edgeql queries, and Napalm checks the whole set before anything deploys.

A language compilerNapalm
A language compilerReads source filesNapalmReads your schema and saved EdgeQL queries
A language compilerRejects type errors before runtimeNapalmValidates every query against the schema on push
A language compilerEmits machine codeNapalmCompiles each query and its policies into one SQL statement
A language compilerRuns on target hardwareNapalmExecutes across engines, replicas, shards and object storage

PostgreSQL 18 stores and executes everything underneath. Every EdgeQL expression carries a static type and cardinality without SQL NULLs, so queries compose cleanly and return predictable shapes.

From schema to cluster

Engines verify the caller, compile policies into SQL and run statements across your shards.

How this primer works#

Each chapter ahead introduces a core part of Napalm first and then applies that capability to the starter notes schema. Along the way, one schema grows from private records and file uploads to collaborative live queries, actions, jobs and warehouse sync, multi-tenant workspaces and credit ledgers, hybrid search and model pipelines and sharded clusters.

Two example users, Ada and Ben, test how permissions hold across sharing, team workspaces and AI agents. When Ada connects an assistant to read and organize her notes, a database password would expose Ben’s records and an unscoped API key would bypass user boundaries.

Users

Sign-in binds global caller on every request.

Services

Scoped keys authenticate workers, schedules and sync jobs.

AI agents

Consent and expiring grants limit tools to permitted rows.

Every chapter returns to the same architectural test: people, backend services, data pipelines and AI agents all share one database under access policies you write once.

Six architectural rules hold that guarantee together across every feature and machine.

Type a word or two to search every docs page.