Skip to main content
The Database primitive is managed Postgres, backed by a fullstack app’s managed backend. Naive owns the credentials and injects them — you run SQL, read/write rows through a REST interface, and apply migrations without ever holding a database key.
Database (and Storage, Edge Functions, Auth) operate on a fullstack app’s managed backend. Create one first: naive.apps.create({ name, type: "fullstack" }). These are curated surfaces over the same scoped backend proxy that powers the apps primitive.

Two ways to use it

Database works for your own project and for each of your end-users’ projects, using Naive’s multi-tenancy:
When a user owns exactly one fullstack app, the call auto-resolves it. With multiple apps, pass { appId }.

SQL

REST CRUD

Filters use the REST query syntax. Runs with the service-role key (RLS bypassed) — treat it as admin access.

Schema changes

migrate runs DDL against the database (works on any plan). The tracked database/migrations endpoint is gated to approved orgs — reach it directly through the backend proxy (.../supabase/proxy/v1/projects/{ref}/database/migrations) where your org has access.

REST

Your own project is reached at /v1/apps/<app-id>/…; an end-user’s project is /v1/users/<user-id>/apps/<app-id>/…. The SDK picks the right path automatically (naive.database vs naive.forUser(id).database). See the Database API reference.

Billing

Queries and other per-operation calls are free — there is no per-request credit cost. The underlying managed Postgres project, however, costs us a recurring vendor fee for as long as it exists, so a provisioned database is duration-metered (database_usage) while it is ready — the same way compute and hosted runtime are billed by time. That meter is not currently charging: it ships at a rate of 0, and the expected ~0.3 credits/hour per managed Postgres project will be announced before it starts. naive down tears it down and stops the meter; your data persists until then. Account Kits can gate the database primitive per user.