Getting started

How CubiBase works

Two HTTP surfaces, one database per project. The Console manages the project through the control API; your application calls the project host.

The two surfaces

Developer

Console

tables · rows · SQL · keys

Control plane

Control API

projects · schema · auth settings

Application

Your app

apikey + user JWT

example-project.api.cubibase.com

Project host

/rest/v1 · /auth/v1 · /storage/v1 · /functions

One project

example_project_db

public · auth · storage · logs

Illustration. The Console manages the project; your app calls the project host.
SurfaceWho calls itWhat it does
Control APIThe Console (your developer session)Accounts, projects, tables, rows, SQL, API keys, auth settings, usage
Data API · /rest/v1Your applicationReads and writes on the tables you expose
Auth API · /auth/v1Your applicationSign-up, sign-in, sessions, Google, MFA

The project host

Every project gets a host of the form https://{slug}.api.cubibase.com. The engine resolves the project from the trusted Host header — it never consults X-Forwarded-Host — and validates the publishable key against that project.

Example project
PieceValue
Slugexample-project
API hosthttps://example-project.api.cubibase.com
Databaseexample_project_db
Data API base/rest/v1
Auth API base/auth/v1

What provisioning creates

Provisioning creates one PostgreSQL database and four login roles, all NOSUPERUSER and NOBYPASSRLS:

RoleUsed byPurpose
ddlSchema APICreates and alters tables
apiData APIServes exposed tables, limited by grants and row policies
sqlConsoleRow browser and the read-only SQL editor
authAuth APISign-up, sign-in, and sessions against the auth schema

Alongside public, where your tables live, the database has managed schemas: auth (users, sessions, factors, identities), logs (request and auth events), vault (project secrets no request role can read), and storage (the bucket and object catalog, upload sessions, and object events for S3-backed file storage). Developer accounts live separately, in the platform metadata database.

How a request is authorized

  1. The Host header selects the project; the apikey header must be an active publishable key for it.
  2. The bearer JWT is verified (HS256 for CubiBase Auth, or RS256 against your IdP’s JWKS). Its sub claim is the user id.
  3. For session-bearing tokens, the engine checks the session is still live and the user is not banned.
  4. The query runs as the API role with cubibase.user_id set to that subject, so row policies apply to every statement.

Additional resources