Learn · Get started
Napalm and Gel
Napalm runs Gel's schema language and EdgeQL on a redesigned engine and compiler.
- API
- —
- In the schema
ext::napalm::root,ext::ai::index,ext::auth::Identity,ext::files::File
Security and execution defaults#
Stored object types start closed over the Project API, caller globals come from verified credentials and schema changes run only on the Control API.
Closed by default
Object types refuse API reads and writes without an allow policy.
Static query checks
Napalm rejects multi-statement scripts, DDL, session commands and catalog queries before compilation.
Eight runtime rules distinguish Napalm’s Project API from an open upstream Gel server.
- Default-deny object types
- In Napalm, any stored type without a declared or inherited
access policyis closed over the Project API until you add explicitallowrules. Upstream Gel lets every caller read and write types that declare no policies. See Access and sign-in. - Credential-bound globals
- Clients cannot set globals, config parameters or roles in request payloads. Napalm binds
ext::auth::ClientTokenIdentityfrom the verified session JWT and injects your endpoint’suserGlobalsorserviceGlobalsautomatically. - Private schema functions
- Functions marked
set is_private := truecan be called from schema expressions (computed fields, policies, triggers, rewrites) inside the same module. Direct client calls are rejected. - Disallowed outbound net calls
- Schema expressions cannot invoke
std::netdirectly. Outbound HTTP side effects run through auditednotifywebhooks and deployed query actions. - Path- and key-scoped branches
- Callers cannot switch branches via connection headers. The URL prefix (
/formain,/branches/{name}/for branches) and the branch bound to the credential determine which database runs the query. - HTTPS only
- A project’s hostname serves only the HTTPS routes below and refuses Gel’s binary protocol and raw SQL, so Gel’s client libraries and the
gelCLI do not connect. Coming from Gel covers moving an app over. - Control-plane DDL
- The Project API executes data statements only. Schema migrations run through
napalm schema pushor the Control API. - Napalm’s extension
- Every schema declares
using extension napalm;to load Project API settings, service keys, deployed queries, jobs and sessions. Schema pushes reject schemas that omit this declaration.
Rejected statements#
Napalm checks every statement on the Project API against static boundary rules before execution.
| Rejected construct | Reason |
|---|---|
Multi-statement scripts or start transaction | Every request executes one EdgeQL statement as one atomic SQL query |
DDL (create, alter, drop, migrate) and configure | Schema and configuration changes require an org token on the Control API |
Session commands (set global, set module, reset) | Globals and module context come strictly from the verified credential |
System modules (sys, cfg, schema, __) | Untrusted callers cannot introspect the catalog or runtime |
Direct ext::* calls | Only ext::pgcrypto, ext::napalm::Job and ext::ai search functions are callable from Project API statements |
Introspecting .__type__ beyond .__type__.name | .__type__.name is allowed for polymorphic union discrimination |
Reserved words inside comments and string literals never trigger a rejection. Disallowed constructs return 400 query_rejected.
Project routes#
Every project’s dedicated hostname serves seven built-in data-plane and agent routes.
| Route | Serves |
|---|---|
POST / | Ad-hoc and deployed EdgeQL statements, action handlers, dry-run previews and causal bookmarks. |
POST /subscribe | Multiplexed SSE live queries that stream patches as commits change results. |
GET /changes | Policy-filtered change log ordered by commit bookmark (after, since, until, types). |
POST /search | Policy-filtered vector and hybrid full-text search across indexed object types. |
POST /ask | Compiler-checked natural-language EdgeQL generation and read-only execution as the caller. |
POST /mcp | Streamable HTTP MCP server exposing deployed queries, actions, dry runs, schema and reach tools. |
POST /a2a | A2A 1.0 JSON-RPC server with discovery at /. |
Authentication and OAuth agent grants#
Napalm pairs ext::auth PKCE user sign-in with OAuth 2.1 agent consent grants in ext::napalm.
User sessions and grants
Sign-in sessions identify people, and OAuth consent grants scope external agents.
Access policies read these identity and grant records through built-in globals on every request.
| Type or global | Purpose |
|---|---|
ext::auth::Identity | Authenticated user identity record. |
global ext::auth::ClientTokenIdentity | Verified Identity of the calling user session ({} for service keys). |
ext::auth::EmailFactor | Verified email factor linked to an Identity. |
ext::napalm::AgentGrant | Stored OAuth 2.1 user consent grant (global ext::napalm::ClientTokenAgentGrant). |
ext::napalm::AgentClient | Dynamically registered OAuth 2.1 agent client metadata. |
Transactional files#
Declaring using extension files; lets any object type extend ext::files::File. Managed buckets store the bytes while your schema’s access policies govern uploads, presigned URLs, magic-byte checks and backup retention.
| Extension type | Provided fields and variants |
|---|---|
ext::files::File | file_name, file_size, file_status, file_format, file_error, file_is_public, file_upload, file_url and file_download_url. |
ext::files::Status | Empty, Uploading, Ready. |
ext::files::UploadError | SizeMismatch, TypeMismatch, NotAccepted, NotUploaded, Expired. |
ext::files::Format | Around 120 binary formats detected from magic bytes, including Pdf, Png, Jpeg, Webp, Mp4, Parquet, Glb, Text and Other. |
See Files and object storage, Vector and hybrid search and File uploads.
Vector and hybrid search#
using extension napalm; enables the AI extension for vector indexes (ext::ai::index), similarity search (ext::ai::search) and hybrid search (ext::ai::hybrid_search) blending fts::index keyword ranks with vector distance. Indexes scale from a few rows to tens of millions of vectors with no schema change.
Commit webhooks, actions and sharding#
Napalm extends Gel’s schema model with transactional outbound webhooks, HTTP actions and declarative shard placement.
notify- Declare
notify <name> after insert, update, deleteon any object type to emit HMAC-SHA256 signed commit webhooks (pingsummaries or policy-filteredrows) with causal bookmarks. See Notifications & webhooks. - Actions
- Attach an HTTPS handler to any deployed query so policy-checked rows trigger external side effects (like Stripe or email APIs) with ES256 caller assertions and RFC 8693 token exchange. See Actions.
ext::napalm::root- Ownership roots group related records onto PostgreSQL shards by top-level owner (
Account,Project,SiteorOrganization) without composite keys or app-side shard routing. See Placement roots and Schema & extensions.