Skip to content

Quick Start

Welcome back, rockstars! We’ll start the tour with a quick, hands-on demo.

New to alab? Grab the latest binary from GitHub Releases or explore the repo for setup details.

Terminal window
alab init

After running alab init, you’ll have:

project/
├── alab.yaml # Configuration file
├── schemas/ # Your schema definitions
├── migrations/ # Generated SQL migrations
└── types/ # TypeScript definitions for IDE support
Terminal window
alab init --demo
database:
dialect: postgres
url: postgres://user:password@localhost:5432/mydb
schemas: ./schemas
migrations: ./migrations
database:
dialect: sqlite
url: ./dev.db
...
SettingDescriptionExample
database.dialectDatabase typepostgres or sqlite
database.urlConnection stringSee examples above
schemasPath to schema definitions./schemas
migrationsPath to migration output./migrations

Use the alab table command to scaffold a new schema file:

Terminal window
alab table auth user

This command generates a basic template at:

schemas/auth/user.js

Two important concepts are introduced here:

  1. auth is the namespace that groups related schemas.
  2. user is the table definition within that namespace.

This structure stays consistent across teams and services

auth.user → auth_user

By enforcing namespaces at the schema level, teams can collaborate in large projects without naming collisions, while keeping database conventions predictable and explicit.

Generate a migration from your schema:

Terminal window
alab new create_users

Preview the SQL before applying:

Terminal window
alab migrate --dry

Apply the migration to your database:

Terminal window
alab migrate

Apply migrations and auto-commit to git:

Terminal window
alab migrate --commit