One Schema to Rule Them All
Keeping database schemas in sync across Rust, Go, Python, and TypeScript is painful: you update a table, then update structs, then interfaces… and pray you didn't make a typo.
I built AstrolaDB, a standalone CLI in Go, to solve this. Define your schema once in JavaScript, then generate SQL migrations and type-safe code for multiple languages. Without Node.js, Python or JVM.
GitHub: github.com/hlop3z/astroladb
Docs: hlop3z.github.io/astroladb
Why Multi-Language Schemas Hurt
Typical workflow across multiple services:
- Update a table in Postgres
- Update structs in Rust, Go, or Python
- Update interfaces in TypeScript
- Pray nothing breaks
Schemas inevitably drift apart. I wanted a single source of truth without locking into an ORM or heavy runtime.
One Schema, Many Languages
AstrolaDB (alab) is a schema-as-code orchestration tool:
- ⚡ Write your schema once in JavaScript
- 🚀 Generate SQL migrations, native types, and OpenAPI specs
- 🧩 Logical namespacing for tables like
auth.userorbilling.invoice - 🏋️ Runs as a single ~8MB binary, locally or in CI
Supports Rust, Go, Python, TypeScript, and more.
How It's Different
- Zero Dependencies: Single binary, no Node.js, Python, or JVM
- Embedded JS Engine: Uses Goja for fast, portable JS execution
- Developer-Friendly: Live preview, quick generation and type-safe code
Quick Start
# Initialize demo project
alab init --demo
# Preview schema in browser
alab live
# Generate code
alab export -f all
Example: Auth User Table
Write your schema once and generate outputs for multiple languages.
Schema
// schemas/auth/user.js
export default table({
id: col.id(),
username: col.string(50).unique(),
age: col.integer().optional(),
});
Generated Rust
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct AuthUser {
pub id: String,
pub username: String,
pub age: Option<i32>,
}
Generated Go
type AuthUser struct {
Id string `json:"id"`
Username string `json:"username"`
Age *int32 `json:"age,omitempty"`
}
Full examples for Python and TypeScript are in the Code Generation.
Built with DX in Mind
How It Works
Try It Today
Define your schema once, generate type-safe code in minutes, and stop worrying about typos across languages.
Share your thoughts in the comments or open an issue on GitHub. I built AstrolaDB to solve my own polyglot headaches, now I want to make it useful for you.
hlop3z
/
astroladb
Schema-first platform with multi-language type exports, auto-migrations and a generator runtime for building REST APIs, GraphQL, SDKs, and more.
AstrolaDB (alab)
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.
Documentation
- 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
Download Release
Or install via script:
curl -fsSL https://raw.githubusercontent.com/hlop3z/astroladb/main/install.sh | sh
One Schema
// 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(),
}…



Top comments (0)