Kysely Adapter

April 10, 2025

Deprecated Feature

@c15t/backend v1 did not deliver the flexibility we wanted and fell short of our standards. It is now deprecated as we work on a full rewrite, with v2 entering canary soon. This does not affect consent.io deployments, which remain stable.

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