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
Define once in JavaScript, export strongly typed models to Rust, Go, Python, TypeScript and more.
AstrolaDB (alab)
One schema: many languages.
Documentation | Comparison | Generated-Code | Commands | Fields
Welcome to AstrolaDB aka alab. A schema-as-code orchestration tool with a one-to-many multi-language code generation.
No Node.js dependency. No runtime lock-in.
Define your schema once in JavaScript, then generate SQL migrations, Rust structs, Go models, Python classes, TypeScript types, GraphQL schemas, and OpenAPI specs.
Schemas are written in constrained JavaScript not for logic, but for type safety, autocomplete, IDE support and explicit configuration. Think of it as a fancy JSON.
Key Highlights
- Lightweight & Portable
- Zero-dependency, single binary (~8 MB)
- Fast, portable and CI/CD-friendly
- No heavy runtimes: JVM | Node.js | Python
Download Release
Install
curl -fsSL https://raw.githubusercontent.com/hlop3z/astroladb/main/install.sh | sh
Quick Start
Initialize project
alab init
Create a table schema
alab table auth user
Edit your schema
// schemas/auth/user.js
export default table({
id…




Top comments (0)