One schema: many outputs.
Stop writing boilerplate. Define your data model once. Use custom generators to produce REST APIs in FastAPI, Go Chi, Rust Axum, or tRPC. Export types, SQL migrations, and OpenAPI specs directly from the core engine.
- Quick Start Guide — Get started in 5 minutes
- Tutorial — Build your first project
- Generator Guide — Write custom generators
- Migration Reference — Schema evolution
- Field Types — All available column types
- CLI Commands — Complete command reference
Or install via script:
curl -fsSL https://raw.githubusercontent.com/hlop3z/astroladb/main/install.sh | sh// schemas/blog/post.js
export default table({
id: col.id(),
title: col.title(),
body: col.text(),
author: col.belongs_to("auth.user"), // Foreign key
published: col.flag(),
})
.timestamps()
.many_to_many("blog.tags"); // Auto-creates join tablegraph TD
A[Schema Files<br/>model.js] --> B[AstrolaDB Engine]
B --> C[Type Exports<br/>Rust • Go • Python • TypeScript]
B --> D[SQL Migrations<br/>PostgreSQL • SQLite]
B --> E[API Specifications<br/>OpenAPI • GraphQL]
B --> F[Custom Generators<br/>APIs • Infrastructure • SDKs • Tooling]
AstrolaDB turns a single schema into multiple artifacts through two approaches:
Core Engine (built-in, versioned with AstrolaDB)
- Type Exports: Rust, Go, Python, TypeScript
- SQL Migrations: PostgreSQL, SQLite
- API Specs: OpenAPI, GraphQL
Generators (extensible, user-defined JavaScript functions)
- Complete APIs: FastAPI, Chi, Axum, tRPC, Express
- Infrastructure: Terraform, Docker, Kubernetes, Helm
- SDKs & Clients: Language SDKs, RPC clients
- Tooling: CLIs, test suites, documentation sites
- Any structured text expressible from your schema
// Example generator
export default gen((schema) =>
render({
"models.py": buildModels(schema),
"router.py": buildRouter(schema),
}),
);From schema to running API using an example generator:
# 1. Initialize project
alab init
# 2. Create your schema
alab table auth user
# 3. Download an example generator
alab gen add https://raw.githubusercontent.com/hlop3z/astroladb/main/examples/generators/generators/fastapi.js
# 4. Run the generator
alab gen run generators/fastapi -o ./backend
# 5. Run it
cd backend
uv add fastapi[standard]
uv run fastapi dev main.py
# → http://localhost:8000/docsWhat the generator produced:
backend/
├── auth/
│ ├── models.py # Pydantic models with validation
│ ├── router.py # CRUD endpoints (list, get, create, update, delete)
│ └── __init__.py
└── main.py # FastAPI app with Swagger docs
All from that one schema file. The generator handles the boilerplate.
Example generators demonstrating what's possible with the platform:
| Framework | Language | What It Generates | Example Output |
|---|---|---|---|
| FastAPI | Python | Pydantic models + CRUD routers + FastAPI app | View Code |
| Chi | Go | Structs + handlers + Chi router | View Code |
| Axum | Rust | Structs + handlers + Axum server | View Code |
| tRPC | TypeScript | Zod schemas + type-safe RPC routers | View Code |
These are reference implementations you can use or modify. Or write your own generator in JavaScript to produce any text output.
Sandboxed Runtime: Generators run isolated with no network, eval, or filesystem access. Full constraints →
Migrations: Reversible up/down migrations with interactive prompts. Migration guide →
The platform provides built-in schema orchestration and a generator runtime:
| Feature | Description |
|---|---|
| Single Binary | ~9 MB static executable. Zero dependencies. |
| Schema Engine | Type-safe JavaScript DSL for data modeling. |
| Auto Migrations | SQL migrations generated from schema changes. |
| Multi-Language Export | Built-in types for Rust, Go, Python, TypeScript. |
| Generator Runtime | Sandboxed JS execution for custom code generation. |
| No Runtime Lock-in | Works without Node.js, JVM, or Python runtime. |
| Live Development | Built-in HTTP server (alab live) with hot reload. |
| OpenAPI Ready | Exports openapi.json for integration with 25+ languages. |
| Namespace Support | Logical grouping (e.g., auth.user) prevents naming collisions. |
alab initCreates:
project/
├── alab.yaml # Configuration
├── schemas/ # Your schema definitions
├── migrations/ # Generated SQL migrations
└── types/ # TypeScript definitions for IDE support
alab table auth userEdit schemas/auth/user.js:
export default table({
id: col.id(),
email: col.email().unique(),
username: col.username().unique(),
password: col.password_hash(),
role: col.enum(["admin", "editor", "viewer"]).default("viewer"),
is_active: col.flag(true),
}).timestamps();# Generate migration
alab new create_users
# Preview SQL
alab migrate --dry
# Apply to database
alab migrate# Export to all languages
alab export -f all
# Or specific language
alab export -f typescript
alab export -f python
alab export -f go
alab export -f rust# Download example generator
alab gen add https://raw.githubusercontent.com/hlop3z/astroladb/main/examples/generators/generators/fastapi.js
# Run generator
alab gen run generators/fastapi -o ./backendInstant schema exploration with automatic hot reloading:
alab liveOpens an interactive HTTP server where you can explore your schema, test the normalized object, and see changes in real-time.
- Platform engineers building code generation pipelines
- Polyglot developers maintaining services in multiple languages
- Meta-programmers who want deterministic code generation
- Startups needing to move fast without sacrificing type safety
- Solo developers prototyping full-stack applications
- API-first teams who want to skip repetitive boilerplate
- Migration engine is actively evolving
- APIs may introduce breaking changes
- Recommendation: Always test thoroughly in staging before production
BSD-3-Clause
Built with ❤️ by hlop3z



