Skip to content

Introduction ​

This guide covers atlas, the SQL ORM:

  • Recommended path
  • Design principles

Atlas is Ream's Data Mapper ORM.

It combines:

  • explicit entities/repositories in TypeScript,
  • SQL compilation in Rust (N-API),
  • strict identifier validation and dialect-aware query generation.

Status: production-ready core. The API below matches the current codebase.

How an Atlas query reaches the database. Your code, in TypeScript, declares a model (@Column() declare email: string) and builds a query (await User.query().where('role', 'admin').exec()). The SQL compiler, in Rust, validates every table and column name (an unsafe name raises E_UNSAFE_IDENTIFIER), turns values into bound parameters and writes SQL for the connection's dialect. The driver, in Rust with sqlx, talks to PostgreSQL, MySQL or SQLite and never silently drops TLS. The rows come back as User instances, with their relations. Schema changes are applied with ream migration:run.

  1. Getting Started
  2. Relations
  3. Query Builder
  4. Advanced ModelQuery
  5. Lifecycle Hooks
  6. Repository Patterns
  7. Migrations
  8. Schema Builder
  9. Schema Dump & Verify
  10. Seeders
  11. Factories
  12. Connections
  13. SQL Security
  14. Performance
  15. Observability
  16. API Reference
  17. Error Handling
  18. Troubleshooting

Design principles ​

  • No hidden global model state: repositories own data access.
  • Strong defaults, explicit escape hatches (whereRaw, joinRaw) marked unsafe.
  • Multi-dialect support: sqlite, postgres, mysql.
  • Transactions and migration atomicity are first-class concerns.

Atlas is Ream's Data Mapper ORM. Entities are pure TypeScript classes decorated with metadata. Queries compile to SQL through Rust via NAPI. Domain events accumulate on entities and dispatch through the event bus after a successful save.

Next Steps ​