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.
alab initAfter running alab init, you’ll have:
project/├── alab.yaml # Configuration file├── schemas/ # Your schema definitions├── migrations/ # Generated SQL migrations└── types/ # TypeScript definitions for IDE supportQuick Demo
Section titled “Quick Demo”alab init --demoPostgreSQL Configuration
Section titled “PostgreSQL Configuration”database: dialect: postgres url: postgres://user:password@localhost:5432/mydb
schemas: ./schemasmigrations: ./migrationsSQLite Configuration (for development)
Section titled “SQLite Configuration (for development)”database: dialect: sqlite url: ./dev.db ...Configuration Options
Section titled “Configuration Options”| Setting | Description | Example |
|---|---|---|
database.dialect | Database type | postgres or sqlite |
database.url | Connection string | See examples above |
schemas | Path to schema definitions | ./schemas |
migrations | Path to migration output | ./migrations |
Create Your First Table
Section titled “Create Your First Table”Use the alab table command to scaffold a new schema file:
alab table auth userThis command generates a basic template at:
schemas/auth/user.jsTwo important concepts are introduced here:
authis the namespace that groups related schemas.useris the table definition within that namespace.
This structure stays consistent across teams and services
auth.user → auth_userGenerate and Apply Migration
Section titled “Generate and Apply Migration”Generate a migration from your schema:
alab new create_usersPreview the SQL before applying:
alab migrate --dryApply the migration to your database:
alab migrateApply migrations and auto-commit to git:
alab migrate --commit