Key Features
- Multiple Database Support - SQLite, PostgreSQL, and MySQL
- Type-Safe Queries - Leverage Rust’s type system for compile-time query validation
- Active Record Pattern -
ModelandModelMuttraits for intuitive CRUD operations - DB Facade - Simple static access to database connections
- Automatic Entity Generation - Generate Rust entities from your database schema
- Migration System - Laravel-style migrations for schema management
Architecture
Kit’s database layer consists of several components:Quick Example
Here’s a complete example showing how to work with a database model:Getting Started
Configuration
Set up your database connection and configure connection pooling
Models
Learn about the Model and ModelMut traits for CRUD operations
Queries
Build complex queries with SeaORM’s query builder
Migrations
Manage your database schema with migrations
Supported Databases
| Database | Status | Connection String |
|---|---|---|
| SQLite | Supported | sqlite:./database.db |
| PostgreSQL | Supported | postgres://user:pass@host/db |
| MySQL | Supported | mysql://user:pass@host/db |
Prerequisites
Before working with databases in Kit, ensure you have:- A database server running (or use SQLite for local development)
- The
DATABASE_URLenvironment variable set in your.envfile - Migrations created and run (see Migrations)