Schema

One file defines your data, sign-in and access rules.

Every type starts closed. Links replace join tables and access rules compile into SQL on PostgreSQL 18.

Read the schema docs

Access rules

Access rules sit on your types.

Every type starts closed until a rule grants access. Rules follow links across your graph and compile into SQL on PostgreSQL 18. Queries, live streams, search and agent tools enforce the same 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);}

Built-in sign-in

Sign-in is built in.

Every project includes passkeys, OAuth, magic links and passwords. Napalm sets global caller from the verified token inside each transaction, so no client can spoof identity.

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

Hidden rows

One command explains a hidden row.

napalm explain-access checks every policy on a record as a chosen user or service key without reading field values. The report shows which rules admitted or hid the row.

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

Nested queries

One query loads a whole screen.

EdgeQL follows forward and reverse links, filters nested sets and counts related rows in a single statement. Napalm compiles that shape into SQL and returns the whole screen in one round trip.

Queries and EdgeQL
dbschema/queries/listNotes.edgeql
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]),}order by .updated_at desc

Typed clients

Generate typed clients in 8 languages.

Save each query in dbschema/queries/. Napalm compiles the file against your schema, serves a named HTTPS endpoint and generates typed bindings in 8 languages.

app/notes.ts
const { data } = await db.POST('/query/listNotes', {  body: { variables: {} },})// data.data[0].comment_count is typed as number
Typed client SDKs

Safe schema pushes

Schema pushes catch breaking changes first.

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

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