Quick start
From zero to a queryable API: dedicated Postgres database, row-level security, realtime and TypeScript type generation included — no credit card required.
Quickstart
From terminal to your first request in 3 simple steps.
pnpm add @aurabase/aurabase-jsimport { createClient } from '@aurabase/aurabase-js'
const aura = createClient(
process.env.NEXT_PUBLIC_AURABASE_URL!,
process.env.NEXT_PUBLIC_AURABASE_ANON_KEY!,
)// `todos` is created in "Create a table" below
const { data, error } = await aura
.from('todos')
.select('id, title, done')
.limit(10)
console.log(data, error)Prerequisites
We assume that Node.js ≥ 20 is installed and a POSIX terminal is within range. No local database is required: Aurabase provisions a dedicated Postgres database for each project.
Are you coming from Supabase or Firebase? Most concepts are transposable. See the migration guide.
Installing the SDK
The official SDK exposes a typed client for CRUD, auth, realtime and storage. It works the same way in Next.js, React, Node, Bun or Deno.
The package name includes the @aurabase/ scope. The package aurabase-js without a scope is not maintained by Aurabase: do not install it.
The SDK directly includes @aurabase/aurabase-js/ssr (createServerClient) export for Next.js (App Router, Server Actions, Middleware), Remix, Nuxt and SvelteKit with automatic session cookie management and anti-truncation chunking.
Create a project
Create a project from the Studio. When it becomes active, the Studio shows a Copy your keys now panel with a ready-to-use .env.local (copy it or download it): the service_role key appears there once, only its hash is kept afterwards. Settings › Connection later shows the project URL and the public anon key; if you lost the service_role key, regenerate it there (the previous one is revoked). NEXT_PUBLIC_AURABASE_URL and NEXT_PUBLIC_AURABASE_ANON_KEY can be published on the client side; AURABASE_SERVICE_ROLE_KEY stays strictly on the server side.
SchemaAccessContains
project_{uuid}userYour business tables
project_{uuid}_authsystemusers, sessions, oauth_accounts, mfa
project_{uuid}_storagesystembuckets, objects, rls_policies
project_{uuid}_platformsystemfunctions, jobs, cron_jobs, api_keys
The whole path also works from the CLI (see CLI for the installation): aura projects create waits until the project is ready and prints the URL and the keys once.
Never include AURABASE_SERVICE_ROLE_KEY in a client bundle. It bypasses all RLS policies, and the API refuses it from a browser (401 SECRET_KEY_IN_BROWSER). Reserve it for server calls (route handlers, server actions, jobs).
Create a table
Open Database › SQL Editor and run this script. Row-level security is enabled on every table: the two policies let each signed-in user read and create their own rows. Policies target the aura_authenticated role (aura_anon for visitors).
Then generate the TypeScript types of your schema (the command reads .env.local):
First call
Create a reusable Aurabase client by reading keys from environment variables, then query your first table. The paths below are relative to the root of your app: if your project uses a src/ directory, put lib/, components/ and app/ inside it, so that the @/ import alias resolves.
Then, in a route handler or a server component:
Without a signed-in user this returns []: the policies above only open rows to aura_authenticated. Sign a user in first with aura.auth.signInWithPassword({ email, password }). Regenerate the Database types with npx @aurabase/gen after each schema change.
To insert a first row, sign a user up and in, then insert. The user_id column defaults to auth.uid():
The service_role key has no signed-in user, so auth.uid() is NULL and an insert that relies on the default fails with NOT_NULL_VIOLATION. From a server, pass user_id explicitly.
Connect realtime
Three auto-negotiated transports: WebSocket, SSE, NATS. Customer chooses the best one based on the network — no configuration necessary.
Enable realtime on the table once, with the CLI:
or with the HTTP API, from a server (values from .env.local):
Then subscribe to changes. A signed-in user receives the rows that its RLS policies let it read, including when the channel was opened before sign-in (it is re-authenticated automatically); a refused subscription reports CHANNEL_ERROR with the reason.
Subscriptions are multiplexed over a single TCP connection. Open as many as you need — zero additional network costs.
To go further
CONCEPT
Architecture
The 8 services and their partitioning by project.
SERVICE
Database
Schemas, migrations, TypeScript codegen, RLS.
SERVICE
Authentication
OAuth 15+, MFA, granular RBAC.
SERVICE
Edge Functions
WASM multi-runtime, cron, DLQ, AI Gateway.