Kysely Adapter
The Kysely adapter provides type-safe SQL query building with support for multiple databases including PostgreSQL, MySQL, and SQLite.
Installation
First, install the Kysely package and the appropriate database driver:
Configuration
Configure the Kysely adapter with your database connection:
MySQL Configuration
SQLite Configuration
Usage Examples
Basic CRUD Operations
Transactions
Schema Management
Best Practices
- Use prepared statements - Kysely automatically uses prepared statements to prevent SQL injection
- Configure connection pooling - Set appropriate pool sizes based on your application needs
- Implement retry logic - Add retries for transient database errors
- Monitor query performance - Use the debug option to log slow queries during development
Limitations
- Schema must be created separately or with raw SQL
- Complex joins require custom SQL or advanced Kysely usage
Related Resources
Memory Adapter
The Memory adapter stores all data in-memory, making it perfect for development, testing, and prototyping. Data is lost when the application restarts.
Prisma Adapter
The Prisma adapter integrates c15t Backend with Prisma ORM, providing type-safe database access with migration support and automatic schema generation.