Skip to the page

Guides · Start building

Building apps

An app on Napalm combines a schema, deployed queries and one generated client. These guides build common app architectures step by step.

API
—
In the schema
—

Parts of a Napalm app#

A Napalm app has three parts, and the first two live as files in your repository.

A schema
dbschema/default.gel defines your types and the access rules on each type. Because sign-in, files and search are built into the project, the schema also declares how the app uses them.
Queries
One file per query in dbschema/queries, deployed by name. Your app calls myNotes instead of a custom route backed by hand-written handlers, and napalm generate turns each query into a typed call in your language.
One client
The client carries the signed-in session, keeps live queries current, reads the app’s own writes from any replica and uploads files straight to storage. Use the TypeScript or Dart SDK, or call the project’s HTTPS API from any language.

None of these parts is an API server. Access rules run inside PostgreSQL for every caller, so a browser or phone calls the project directly and receives only the data the signed-in person may access. How Napalm works traces a request’s path.

Direct browser & phone callers

Web and mobile apps call the project endpoint directly with user sessions while compiled policies filter rows inside PostgreSQL.

Multiplexed live stream

Subscribed hooks share one POST /subscribe SSE stream and advance together at each commit without polling.

Local cache & reconnect sync

SQLite and IndexedDB stores serve cached rows without signal, queue idempotent writes and reconcile from Napalm-Bookmark on reconnect.

Starting points#

Choose the guide that matches your framework or product capability. Every guide builds on the same schema, deployed-query catalog and client session model.

What you are buildingStart withThen
Anything, for the first timeYour first appThenA working app in a few minutes. The other guides build on this app.
A browser-direct React SPAReact, Vite & single-page appsThenPKCE sign-in across tabs, generated live hooks, direct uploads and deployed-query lockdown.
A web app with a serverNext.js & ReactThenSign-in in a cookie, pages rendered as the person, lists kept live.
A phone app in TypeScriptReact NativeThenThe web app’s client on a phone with Keychain sessions, live lists and disk uploads.
A phone app in DartFlutterThenSign-in through the system browser, live queries across the app’s lifecycle and resumable uploads.
A server beside the appA backend serviceThenPython or Go calling the project as the requesting person or as the service.
Sign-up and sign-inSign-in for your appThenPasswords, magic links, providers, passkeys and session storage.
A product for teamsMulti-tenant B2B SaaSThenOrganizations, members and invites in one schema, spread across shards by organization.
Something people buyBilling & paymentsThenPaid plans with Stripe, seat limits and prepaid credits that cannot be overdrawn.
Documents, media and searchFiles, media & document searchThenVerified multipart uploads, background PDF passage extraction and cited hybrid search.
Something people use togetherRealtime & collaborationThenShared lists, instant edits, drag-and-drop ordering and active viewers.
Apps that work without signalOffline caches & reconnect syncThenLocal SQLite or IndexedDB mirrors, idempotent offline outboxes and version conflict recovery.
Automated policy and query testsTesting & verificationThenCaller-matrix policy suites, dry-run write previews and pull-request CI gates.
Something about to launchEnvironments & going liveThenA development branch, a branch per pull request and the settings to lock down before launch.
Payments, email and background workActions & background jobsThenYour code, gated by a query and run as the caller immediately or on a schedule.

Six additional shipping guides cover releases and day-two production operations across Release rehearsals, Live schema changes, Launch preparation, Production monitoring, Key and secret renewal and Rollbacks and restores.

Apps that need a server#

Because access policies run inside PostgreSQL on every request, an app never needs a custom server just to check permissions. Four cases call for a server or hosted handler alongside Napalm.

Secrets
Charging a card or sending an email requires a third-party secret that must not reach a browser. Use an action so a deployed query selects the permitted rows and your handler runs with the secret.
Server rendering
A server-rendering framework keeps the session in a cookie and calls the project as the signed-in person. Next.js & React shows the setup.
Cookie sessions
A session in a server’s HttpOnly cookie stays out of reach of injected browser scripts. Sign-in for your app weighs the tradeoff.
Background work
A nightly digest or delayed retry needs no separate server. Queue a job or schedule in the same commit as the triggering write.

Query-gated action handlers

A deployed gatekeeper query enforces caller access first, and matching rows wake your handler with a 60-second caller assertion and third-party secrets.

Transactional background jobs

Insert ext::napalm::Job in the same SQL transaction as your data write for durable retries and cron schedules.

Type a word or two to search every docs page.