Installation
Install the Ormed runtime and one database driver first. This page deliberately stops before project scaffolding and code generation so you can choose the smallest path that fits your project.
Before you start: Dart SDK >= 3.12.0; A Dart package or application where you can run dart pub; A choice of database driver.
Add Ormed and a Driver
Choose the driver for the database you will connect to:
- SQLite (recommended)
- PostgreSQL
- MySQL / MariaDB
- Cloudflare D1
dependencies:
ormed: ^0.4.0
ormed_sqlite: ^0.4.1
dependencies:
ormed: ^0.4.0
ormed_postgres: ^0.3.1
dependencies:
ormed: ^0.4.0
ormed_mysql: ^0.3.1
dependencies:
ormed: ^0.4.0
ormed_d1: ^0.3.0
Then resolve the packages:
dart pub get
Do not add build_runner, ormed_cli, or a generated registry just to use
the direct database facade. Those belong to later paths.
If your application already uses Drift, add ormed_drift alongside Drift and
follow Drift integration to share its executor with Ormed.
Choose Your Path
Start without code generation
If you need raw SQL, schema operations, transactions, or ad-hoc table queries, continue with Direct Database Access. It requires only the runtime package and a driver.
Use generated models
If your domain is ready for annotated models and generated types, continue with Code Generation for the generator tooling and generated artifacts, then follow Quick Start for the complete model, migration, seeder, and CRUD path.
The generator itself uses build_runner. The Quick Start CLI commands use
ormed_cli; its local/global installation and command behavior are documented
in CLI Overview.
Integrate an existing app
If the application already has a schema, runtime, or migration owner, use Adopt Ormed In An Existing Project instead of starting with the generated-model walkthrough.
Verify the Installation
Confirm that the runtime package and selected driver resolve cleanly:
dart pub get
dart analyze
The remaining checks depend on the path you chose:
- Direct path: connect with the driver helper in Direct Database Access.
- Generated path: run the generator checks in Code Generation.
- CLI path: verify the command runner in CLI Overview.
Next Steps
- Direct Database Access — connect without code generation
- Code Generation — generate model and registry artifacts
- Quick Start — build the complete generated-model example
- Configuration — choose code-first or YAML connection setup
- Drivers — configure SQLite, PostgreSQL, MySQL, D1, or Drift integration