The backend,
on its own.
REST, a typed SDK, realtime over WebSocket, auth, storage and an OpenAPI spec — with every access rule enforced by the database itself. Point it at your own Postgres, or run rebase dev and get one without installing anything. No admin panel required.
- Reads tables, enums, keys and foreign keys from the catalog.
- Writes one defineTable module per table, the source of the API, the SDK and the panel.
- Copies no rows. Changes nothing in the database.
REST, without writing it
01 / 07Every table you expose becomes an endpoint
No controllers, no serializers, no validation middleware. Filtering, sorting, pagination and relation loading are query parameters, in a PostgREST-compatible syntax your team probably already knows.
Nested relations are addressable as paths, so a customer's orders are a URL rather than a join you hand-wrote.
GET /api/data/orders?status=eq.paid&total=gt.100
GET /api/data/orders?or=(status.eq.paid,total.gt.500)
GET /api/data/orders/42?include=customer,items
GET /api/data/customers/7/orders
POST /api/data/orders
PUT /api/data/orders/42
DEL /api/data/orders/42{
"id": 1,
"name": "Alice Vance",
"role": "admin"
},
{
"id": 2,
"name": "Bob Chen",
"role": "editor"
}
]
The typed client
02 / 07Autocomplete that comes from your schema
rebase generate-sdk turns your tables into a Database type. Pass it to the client and table names, field names, filter operators and return shapes are all checked at compile time — including the fields you asked for in include.
Rename a column in the table and the call sites turn red before anything ships. The repository that consumes the API does not need to be the one that defines it: --from <url> generates the same client from a running backend, in a project with no schema of its own. Your web app, admin and mobile client each stay in their own repo, and CI catches a stale client before a user does.
// generated once by `rebase generate-sdk`
import { tablesDictionary, type Database } from "./generated/sdk/database.types";
const client = createRebaseClient<Database>({
baseUrl: "https://api.example.com",
tables: tablesDictionary,
});
// table names, column names and return types all autocomplete
const { data } = await client.data.orders
.find({
where: { status: ["==", "paid"] },
include: ["customer"],
limit: 50,
});Realtime
03 / 07Changes arrive, however they were made
listen() on any table and every insert, update and delete lands on the client over WebSocket. Subscriptions respect the same row-level security as a read, so a subscriber is never pushed a row they could not have fetched.
Writes made outside the API count too — a row changed from psql, a cron job or Studio's SQL editor emits the same event, because change capture happens in the database. Broadcast channels and presence are per-instance by default; set realtime.bus to { type: "postgres" } and they fan out across replicas over LISTEN/NOTIFY, or hand it a transport of your own.
- RESTPATCH /api/data/orders/42your app
- psqlUPDATE orders SET status = 'shipped' WHERE id = 42;a person at a terminal
- cronUPDATE orders SET status = 'closed' WHERE …a scheduled job
- StudioUPDATE orders … — run from the SQL editorthe admin panel
→ one change event: orders · UPDATE · id 42
→ each subscriber re-reads the row under its own access rules
Authorization
04 / 07The rules live in Postgres, not in this server
Requests execute as a restricted database role. Your rls rules compile to real row-level security policies, so a query that should return nothing returns nothing — whether it arrives through the SDK, a REST call, the admin panel, an agent's API key or a psql session. Every table must declare its rls, and one whose rules grant nothing serves no rows: the default is closed, not open.
export const orders = defineTable("orders", {
columns: { /* … customer_id, total, status */ },
rls: [
// customers see their own orders…
{ operation: "select", ownerField: "customer_id" },
// …support can read and update all of them
{ operations: ["select", "update"],
roles: ["support"] },
],
});-- rebase schema generate → db push
ALTER TABLE orders ENABLE ROW LEVEL SECURITY;
CREATE POLICY orders_select_1f4c9ab ON orders
FOR SELECT TO rebase_user
USING (customer_id = rebase.uid());
CREATE POLICY orders_update_8b02e13 ON orders
FOR UPDATE TO rebase_user
USING (string_to_array(rebase.roles(), ',')
&& ARRAY['support']);
-- no policy for INSERT or DELETE:
-- nobody can insert or delete. Closed by default.npx @rebasepro/rls-check reads DATABASE_URL and audits it without installing anything.One server
05 / 07Everything mounted, nothing assembled
This is the routing table of a default project — one process, one deployment, no service mesh to draw. Each of these exists because building it yourself is a week you would rather spend elsewhere.
One process is the default, not the ceiling. The same build also boots as an API, a functions tier and a worker — one variable per process decides which routes mount, which timers fire and which one owns the schema.
Topics and jobs. Publish an event, subscribe by name. One durable row per subscriber, each retrying on its own schedule — and a publish inside a transaction that rolls back never happened.
Webhooks. HMAC-signed outbound calls on insert, update and delete, with retries.
Row history. An audit trail per table: who changed what, when, and a revert.
Database branching. Isolated copies of the whole database for a feature or a test run — schema, rows and policies — with one command to switch your project onto one and back.
Email. SMTP for verification, password reset and your own transactional templates.
Backups. Role-complete dumps and restores, driven from the CLI or the admin API.
Multiple sources. Route different tables to different databases from one server.
/api/data/:tableCRUD, filters, sorting, pagination, relation includes, nested relation paths/api/schema/tablesthe tables, columns, relations and policies, redacted per caller — what the admin panel reads/api/auth/*sign-up, login, refresh, password reset, OAuth, MFA, roles/api/storage/*upload, download, signed access — local, S3-compatible or GCS/api/functions/:nameyour own Hono routes, auto-mounted from functions//api/cron/*scheduled jobs with run history and manual triggers/api/docs · /api/swaggerOpenAPI 3.0 spec of the tables each caller may see; an explorer when you publish it/api/metathe runtime contract: schema version, runtime, tables/healthreadiness for your orchestrator — asserts the auth schema, not just TCPWebSocketrow subscriptions, broadcast channels and presence on the same server
Underneath
06 / 07Boring technology, on purpose
A Hono app and a Drizzle schema. Two things your team can read, debug and extend without learning a framework — and without waiting for us to expose a hook.
import { initializeRebaseBackend } from "@rebasepro/server";
import { createPostgresAdapter } from "@rebasepro/server-postgres";
const backend = await initializeRebaseBackend({
server,
app,
schemaDir: path.resolve(__dirname, "../schema"),
database: createPostgresAdapter({
connection: db,
schema: { tables, enums, relations },
}),
auth: { jwtSecret: process.env.JWT_SECRET },
storage: { type: "local", basePath: "./uploads" },
});
// it's a Hono app — mount it, wrap it, add your own middleware- Mount it as a sub-app on a server you already run
- Your middleware, your routes, your error handling
- Node, Docker, Railway, Fly.io or bare metal
// one table, one relation
export const posts = defineTable("posts", {
columns: {
id: col.uuid().primaryKey().defaultRandom(),
title: col.text().notNull(),
},
relations: { author: rel.belongsTo(() => users) },
rls: "inherit",
});
// GET /api/data/posts?include=author
// → one query via db.query.findMany, not 1 + N- One-to-one, one-to-many and many-to-many
- Field selection — fetch the columns you asked for
- Cursor and offset pagination
The other half
07 / 07Headless by default
The admin panel is a client of this API, not a layer inside it. It reads through the same policies your app does. Toggle it on below: the project gains a frontend and one customization file, an admin panel appears — and the API response on the right does not move.
A headless project: no frontend, no panel — just the API.
Your project
Dependencies
- @rebasepro/server
- @rebasepro/server-postgres
- @rebasepro/client
A table has no presentation keys, so nothing about a panel can live in the backend.
backend/schema/users.ts
export const users = defineAuthTable("users", {
columns: {
id: col.uuid().primaryKey().defaultRandom(),
email: col.text().notNull().unique(),
displayName: col.text(),
},
// everyone reads their own row; admins list all
rls: [{ operation: "select", roles: ["admin"] }],
});// frontend/src/cms/users.tsx
customizeTable<typeof users>("users", {
icon: "Users",
group: "Settings",
listFields: ["displayName", "email"],
});The server loads the table either way — and never sees the customization.
Your API
identical[{ "id": "9f2…", "email": "ada@…",
"displayName": "Ada" }]Admin panel
Not installed.
Nothing is served, nothing is bundled.
The only thing that changed is what a human can see.
Get started
Point it at your database.
Scaffold a project and read the REST routes, the OpenAPI document and the policies it generated.
No account · No Docker · Built-in local Postgres · MIT