JAO
A type-safe, model-first ORM for Dart backend development. Built for PostgreSQL, SQLite, and MySQL. Works seamlessly with Dart Frog, Shelf, or any Dart server framework.
JAO (Just Another ORM) — Because writing raw SQL shouldn't be your only option.
Info
JAO brings Django's elegant query API to Dart, giving you type-safe queries, lazy QuerySets, and a powerful migrations CLI.
Why JAO?
The problem: Dart's backend ecosystem lacks a Django-style ORM. You're stuck with raw SQL strings, manual result mapping, and runtime errors waiting to happen.
The solution: JAO brings Django's elegant query API to Dart.
// Before: Raw SQL, manual mapping, runtime errors
final result = await db.query(
'SELECT * FROM authors WHERE age >= ? AND is_active = ? ORDER BY name LIMIT ?',
[18, true, 10]
);
final authors = result.map((row) => Author.fromMap(row)).toList();
// After: Type-safe, chainable, IDE autocomplete
final authors = await Authors.objects
.filter(Authors.$.age.gte(18) & Authors.$.isActive.eq(true))
.orderBy(Authors.$.name.asc())
.limit(10)
.toList();
Features
- Type-safe queries — Catch errors at compile time, not runtime
- Lazy QuerySets — Chain filters without hitting the DB until needed
- Django-style API — Familiar patterns:
filter(),exclude(),orderBy() - Cross-database — PostgreSQL, SQLite, MySQL with zero code changes
- Django-style CLI —
jao makemigrations,jao migrate,jao rollback - Code generation — Define models once, get queries and serialization for free
- Framework agnostic — Works with Dart Frog, Shelf, or any Dart backend
Quick Install
# Add dependencies
dart pub add jao
dart pub add --dev build_runner jao_generator
# Install CLI globally
dart pub global activate jao_cli
# Initialize project
jao init
Packages
| Package | Description | pub.dev |
|---|---|---|
| jao | Core ORM library | |
| jao_cli | CLI for migrations | |
| jao_generator | Code generator |
Database Support
| Database | Adapter | Status |
|---|---|---|
| PostgreSQL | PostgresAdapter() |
Stable |
| SQLite | SqliteAdapter() |
Stable |
| MySQL | MySqlAdapter() |
Stable |
Next Steps
Getting Started
Set up JAO in your project step by step
Models
Learn how to define models with field annotations
Queries
Master the Django-style query API
Migrations
Manage database schema with CLI commands
Community
- GitHub Issues — Bug reports and feature requests
- GitHub Discussions — Questions and ideas
License
MIT License — see LICENSE for details.