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#
Napalm runs standard SDL schemas and EdgeQL on a hardened multi-tenant runtime: stored object types default to closed, caller globals bind strictly from verified credentials and DDL stays isolated on the Control API.
Closed-by-default types
Any stored object type without a declared or inherited access policy refuses all Project API reads and writes until explicit allow rules exist.
Static statement gate
Multi-statement scripts, DDL, set global, catalog introspection and outbound std::net calls are rejected with 400 query_rejected before compilation.
- Default-deny object types
- In Napalm, any stored type without an
access policy(declared or inherited) is completely closed over the Project API until you add explicitallowrules. Upstream Gel lets every caller read and write a type without access 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 must declare
using extension napalm;, which provides the Project API’s settings, 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, the branch’s jobs (ext::napalm::Job) and the searches of ext::ai are open to a caller’s statement |
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 data-plane and agent routes out of the box.
| Route | Serves |
|---|---|
POST / | Ad-hoc and deployed EdgeQL statements, action handlers, rollback is_dry_run diffs and Napalm-Bookmark causal reads. |
POST /subscribe | Multiplexed SSE live queries, each patched as commits change the result. |
GET /changes | Access-policy-filtered CDC stream 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-verified natural-language EdgeQL generation and read-only execution as the caller. |
POST /mcp | Stateless 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.
PKCE user sessions & OAuth 2.1 AgentGrant
ext::auth binds ClientTokenIdentity for signed-in people while ext::napalm::AgentGrant scopes dynamic OAuth 2.1 agent tokens to explicit user consent.
| 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 with managed private and public buckets, presigned URLs governed by the record’s access policies, magic-byte sniffing and retention-aware cleanup across your point-in-time restore window.
| 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, adding vector indexes (ext::ai::index), similarity search (ext::ai::search) and single-pass hybrid search (ext::ai::hybrid_search) that blends fts::index keyword ranks with vector distance. An index grows from a few rows to tens of millions of vectors across memory and object storage with no schema change.
Commit webhooks, actions and sharding#
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 spread a multi-tenant schema across PostgreSQL shards by tenant without composite keys or app-side shard routing. See Placement roots and Schema & extensions.