Database

PostgreSQL, one typed line away.

A real PostgreSQL 16 database for every project, reachable from your app with a fluent SDK, protected by row-level security and typed from your own schema.

16
PostgreSQL version
2
engines: PostgreSQL, MongoDB
db.tsTS
import { createClient } from '@aurabase/aurabase-js'
const aura = createClient(
'https://my-project.aurabase.cloud',
'aura_anon_xxx',
)
const { data, error } = await aura.db
.from('posts')
.select('id,title,author:authors(*)')
.eq('published', true)
.order('created_at', 'desc')
.limit(10)

What’s included

A database your app can talk to. Without writing an API.

Engine

Real PostgreSQL 16

Your data lives in PostgreSQL, with its types, constraints, triggers and functions.

Query builder

Fluent, typed queries

Equality, range, pattern, array, range-type and full-text filters, ordering, counting and pagination.

Relations

Embeds

Fetch related rows in one request with an embed like author:authors(*).

Functions

Call functions with rpc()

Expose PostgreSQL functions to your app. Set-returning functions filter like tables.

Security

Row-level security

Write policies in SQL with auth.uid() so each user only reaches their own rows. The database enforces them, not the client.

Types

Generated TypeScript types

Generate a Database type from your schema and get typed columns, inserts and function arguments.

AI

Vectors with pgvector

The pgvector extension ships with the database image, for similarity search.

Opt-in

GraphQL per project

Turn on pg_graphql for a project when you want a GraphQL API over its schema.

Alternative engine

MongoDB, if you prefer documents

Choose MongoDB as the engine for a project. Isolation then uses document owners instead of row-level security.

How it works

From a table to a typed query.

  1. 1

    Create a table

    Use the Studio table editor or plain SQL.

  2. 2

    Add a policy

    Turn on row-level security and describe who can see which rows.

  3. 3

    Generate types

    Run aurabase-gen to get a Database type for your client.

  4. 4

    Query

    Call aura.db.from(…) from your app, with the user’s session.

REST API

Prefer plain HTTP? It’s all here.

The SDK is a thin layer over these routes. Send your project’s API key with each request.

MethodEndpointDescription
GET/v1/db/{table}Read rows, with filters, ordering and embeds.
POST/v1/db/{table}Insert one or several rows, or upsert.
PATCH/v1/db/{table}Update rows.
DELETE/v1/db/{table}Delete rows.
POST/v1/db/rpc/{function}Call a PostgreSQL function.
GET/v1/db/schemaList the project’s tables and functions.
GET/v1/db/functionsList the functions defined in the project.
POST/v1/db/rawRun a SQL statement. Reserved to the service role.

Questions

Good to know.

Is this real PostgreSQL?+
Yes. Projects run PostgreSQL 16 with the pgvector extension, so your SQL, constraints, triggers and functions work as written.
How do I keep users out of each other’s data?+
Enable row-level security on a table and write a policy that compares a column with auth.uid(). The database applies it to every request made with a user’s token.
Can I run raw SQL?+
Yes, with the service role, through aura.db.sql() or the SQL editor in Studio. It is not available to anonymous or signed-in users, so keep it on the server.
Do I get TypeScript types for my tables?+
Yes. Run npx aurabase-gen to write a database.types.ts file, then pass its Database type to createClient.
How do I paginate results?+
Use limit() and offset(). Cursor pagination is only available on MongoDB projects and on the native engine path.
What changes with MongoDB?+
There is no row-level security. Reads by signed-in users are filtered to the documents they own, and documents created with the service role have no owner, so users can’t see them.

Ready to store data?

Your database is one project away.

A database is included in every project. No credit card required.