Schema

Define your types, sign-in and access policies in one file.

Typed links replace join tables and foreign keys on PostgreSQL 18. Every type starts closed until an access policy opens it, and policies compile straight into SQL.

Read the schema docs

Access policies

Permissions live beside the data they protect.

Every type denies reads and writes until a policy grants access. Policies walk links across your graph and compile into SQL on PostgreSQL 18. Queries, live streams, search and agent tools all enforce those rules.

Access policies
dbschema/default.gel
type Note {  required title: str;  required body: str;  required author: ext::auth::Identity {    default := global caller;  };  multi shared_with: ext::auth::Identity;   access policy author_full_access    allow all using (.author ?= global caller);   access policy shared_read    allow select using ((global caller in .shared_with) ?? false);}

Authentication

Bind every transaction to a verified caller.

Projects include passkeys, OAuth, magic links and passwords out of the box. Napalm sets global caller from the verified token inside PostgreSQL, so client code can never spoof an identity.

dbschema/default.gel
using extension auth; global caller := global ext::auth::ClientTokenIdentity;
Sign-in guide

Access debugging

See why a record was hidden without exposing its fields.

napalm explain-access evaluates every policy on a record as any user or service key without reading field values. The trace reports which rules admitted or blocked the caller.

Terminal
napalm explain-access notes 8f2c1e64-0b7a-4f4e-9d2b-3a6c5e1f7d90 \  --as sam@acme.co
Troubleshooting

Graph queries

Load an entire view in one round trip.

EdgeQL traverses forward and reverse links, composes optional filters and counts related records in a single statement. Napalm compiles that shape into SQL and returns the nested result at one snapshot.

Queries and EdgeQL
dbschema/queries/listNotes.edgeql
with  q := <optional str>$search,  before := <optional datetime>$before,select Note {  id,  title,  author: { id },  comments := (    select .<note[is Comment] { body, created_at }    order by .created_at desc limit 5  ),  comment_count := count(.<note[is Comment]),}filter (not exists q or .title ilike '%' ++ q ++ '%')  and .updated_at < (before ?? datetime_of_statement())order by .updated_at desc limit 20

Client codegen

Turn query files into typed HTTPS endpoints.

Drop .edgeql files into dbschema/queries/ to publish compiled endpoints and generate typed clients in eight languages. Typed optional parameters compose dynamic filters and cursors, while authorized callers can also send parameterized EdgeQL to POST /query under the same access policies.

app/notes.ts
const { data } = await db.POST('/query/listNotes', {  body: { variables: { search: 'launch' } },})// search and before are optional, comment_count is number
Typed client SDKs

Migration safety

Catch breaking schema changes before they touch data.

napalm schema push recompiles every deployed query inside the migration transaction and rolls back when a field change breaks an endpoint. Each pull request can test migrations on an isolated branch.

Terminal
napalm branches create notes pr-42napalm queries push notesnapalm schema push notes
Schema reference