Skip to content

Astroladb

Language-agnostic database migration tool with JavaScript DSL. Define your schema once, generate migrations and type exports for any language.

No ORM. No framework lock-in. Just clean migrations and type-safe exports.

Define your schema using semantic types and relationships:

schemas/auth/user.js
export default table({
id: col.id(),
email: col.email().unique(),
username: col.username().unique(),
password: col.password_hash(),
is_active: col.flag(true),
}).timestamps();

Generate migrations and export types with simple commands:

Terminal window
# Create migration from schema
alab new create_users
# Apply to database
alab migrate
# Export types for all languages
alab export -f all
ProblemAstroladb Solution
ORMs lock you into one languageDefine once, use everywhere
Manual SQL migrations are error-proneAuto-generate from schema definitions
Types drift from databaseAlways synchronized via single source
API docs get out of syncOpenAPI/GraphQL generated from schema
Schema changes across microservicesExport to Go, TypeScript, Python, Rust

Your JavaScript schema definitions are the single source of truth:

export default table({
title: col.title(),
price: col.money(),
category: col.belongs_to("catalog.category"),
}).timestamps();

Generate type-safe code for your entire stack:

  • TypeScript - Frontend and Node.js
  • Go - Backend services
  • Python - Data pipelines and APIs
  • Rust - High-performance services
  • OpenAPI - API documentation
  • GraphQL - GraphQL schemas

Change your schema once, types update everywhere:

Terminal window
alab export -f all
# ✓ TypeScript interfaces updated
# ✓ Go structs updated
# ✓ Python dataclasses updated
# ✓ OpenAPI spec updated

Pre-configured column types with built-in validation:

email: col.email().unique(), // Email pattern + unique
price: col.money(), // decimal(19,4), min(0)
slug: col.slug(), // URL-safe, unique, pattern
is_active: col.flag(true), // boolean, default true
author: col.belongs_to("auth.user"), // Foreign key + index

See all semantic types.

// Foreign keys
author: col.belongs_to("auth.user"),
// One-to-one
profile: col.one_to_one("auth.user_profile"),
// Many-to-many (auto-creates join table)
.many_to_many("blog.tag")
// Polymorphic
target: col.belongs_to_any(["blog.post", "blog.comment"]),
  • IDE Autocomplete - Full TypeScript definitions for DSL
  • Validation - Catch errors before migration
  • Dry Run - Preview SQL before applying
  • Documentation Server - Live docs at alab http
  • Version Control Friendly - Readable migration files
DatabaseStatusUse Case
PostgreSQLProduction deployments
SQLiteDevelopment, testing, embedded

Ready to try Astroladb? Start with the installation guide:

  1. Installation - Install the CLI
  2. Quick Start - Create your first project
  3. First Schema - Define and migrate a table
  4. Semantic Types - Explore available column types
  5. Examples - See real-world schemas

Astroladb follows these core principles:

  1. Schema is source of truth - Not the database, not the ORM
  2. Language-agnostic - Works with any language stack
  3. No magic - Generates readable SQL and types
  4. Developer-friendly - Great DX with autocomplete and validation
  5. Production-ready - Safe migrations with dry-run and verification