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.

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 your app uses those features.
Queries
Each file in dbschema/queries deploys as a named query. Your app calls myNotes instead of a custom route handler, and napalm generate compiles each query into a typed call in your language.
Client
The client carries the signed-in session, keeps live queries current, reads recent 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 a custom API server. Access rules run inside PostgreSQL for every caller, so a browser or phone calls the project directly and receives only permitted rows. How Napalm works traces the full request path.

Direct client calls

Browsers and phones call your project directly while PostgreSQL filters every row.

Shared live stream

Active hooks share one SSE connection and update together at each commit.

Offline local sync

Local stores serve cached rows offline and reconcile changes when signal returns.

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.

GoalStart withCoverage
Your first Napalm projectYour first appCoverageBuild a working notes app with sign-in, live queries, file uploads and hybrid search.
A browser-direct React SPAReact, Vite & single-page appsCoveragePKCE sign-in across tabs, generated live hooks, direct uploads and deployed-query lockdown.
A server-rendered React appNext.js & ReactCoverageHttpOnly cookie sessions, Server Components rendered as the user and live browser updates.
A mobile app in TypeScriptReact NativeCoverageExpo and React Native with Keychain sessions, foreground live hooks and chunked disk uploads.
A mobile app in DartFlutterCoverageKeychain sessions, lifecycle-aware live streams, SQLite caching and resumable file uploads.
A Python or Go backendA backend serviceCoverageForward caller bearer tokens, chain causal bookmarks, verify webhooks and run actions.
User authenticationSign-in for your appCoveragePasswords, magic links, OAuth providers, passkeys and session storage.
A multi-tenant SaaS productMulti-tenant B2B SaaSCoverageOrganizations, members, invites and SSO in one schema that scales across shards by organization.
Subscriptions and usage creditsBilling & paymentsCoveragePaid plans with Stripe, schema-enforced seat limits and atomic credit wallets.
Documents, media and searchFiles, media & document searchCoverageVerified multipart uploads, background PDF passage extraction and cited hybrid search.
Live collaborationRealtime & collaborationCoverageShared lists, optimistic moves, fractional drag-and-drop ordering and active viewers.
Offline-capable appsOffline caches & reconnect syncCoverageLocal SQLite or IndexedDB mirrors, idempotent mutation outboxes and conflict recovery.
Automated policy and query testsTesting & verificationCoverageCaller-matrix policy suites, dry-run write previews and pull-request CI gates.
Environments and production launchEnvironments & going liveCoverageDevelopment branches, pull-request preview branches and production endpoint lockdown.
External APIs and background jobsActions & background jobsCoverageQuery-gated action handlers, transactional background jobs and cron schedules.

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 write.

Actions & background jobs and A backend service show how server code and background work run under the caller’s schema permissions instead of a broad admin credential.

Query-gated actions

Gatekeeper queries check caller access before sending permitted rows to your handler.

Transactional background jobs

Jobs commit in the same transaction as your write and retry automatically.

Type a word or two to search every docs page.