Schema
A complete database design containing tables, relationships, and constraints.
Documentation
Everything you need to design, build, and export database schemas with rexona.
Install the rexona CLI and authenticate with your account to get started.
# Install the rexona CLI globally
npm install -g @rexona/cli
# Authenticate with your account
rexona auth login
# Initialize a new project
rexona init my-databaseYou can also use rexona directly in the browser at studio without installing the CLI.
Initialize a schema with a name, target database, and description.
// Create a new schema programmatically
import { Rexona } from "@rexona/sdk";
const rexona = new Rexona({ apiKey: process.env.rexona_API_KEY });
const schema = await rexona.schemas.create({
name: "my-app-db",
database: "postgresql",
description: "Main application database",
});Define tables with typed attributes, constraints, and default values.
// Add a users table
await rexona.tables.create(schema.id, {
name: "users",
attributes: [
{ name: "id", type: "uuid", primaryKey: true, default: "gen_random_uuid()" },
{ name: "email", type: "varchar(255)", unique: true, notNull: true },
{ name: "name", type: "varchar(255)", notNull: true },
{ name: "created_at", type: "timestamp", default: "now()" },
],
});Connect tables with foreign key relationships and cascade rules.
// Define a one-to-many relationship
await rexona.relationships.create(schema.id, {
from: { table: "users", attribute: "id" },
to: { table: "posts", attribute: "author_id" },
type: "one-to-many",
onDelete: "CASCADE",
});Export your schema to production-ready code in your preferred language and ORM.
# Export to TypeScript (Drizzle ORM)
rexona export --schema my-app-db --lang typescript --orm drizzle
# Export to Python (SQLAlchemy)
rexona export --schema my-app-db --lang python --orm sqlalchemy
# Export raw SQL migrations
rexona export --schema my-app-db --format sql --output ./migrationsA complete database design containing tables, relationships, and constraints.
A data entity with named attributes, types, and constraints like PK/FK.
A column in a table with a data type, default value, and optional constraints.
A connection between tables — one-to-one, one-to-many, or many-to-many.
A versioned set of SQL statements that evolves your database schema.
An isolated environment containing schemas, settings, and team members.
/api/v1/schemas
List all schemas in your workspace
/api/v1/schemas
Create a new schema
/api/v1/schemas/:id
Get schema by ID with all tables
/api/v1/schemas/:id
Update an existing schema
/api/v1/schemas/:id/export
Export schema to code