Self-Hosting Guide
Set up and maintain your own c15t instance for full control over your consent management backend
This guide shows you how to set up a self-hosted c15t instance, giving you complete control over your consent management system.
Looking for an easier way? consent.io offers a fully managed c15t backend with minimal setup. See the Server-Based Storage page for details.
Create a c15t instance
Separating your configuration from the API route handler makes it easier to manage and update your c15t instance.
First, create a separate file for your c15t instance configuration:
This example uses the Memory Adapter for simple in-memory storage that's perfect for development and testing. Data is stored in RAM and doesn't persist when the server restarts.
Then, create a catch-all API route that imports and uses this instance:
This approach separates your instance configuration from the route handler, making it easier for CLI tools and migration utilities to locate and work with your c15t instance.
Configure Your App to Use the API Route
Update your ConsentManagerOptions to point to your new API route:
Database Options
For production use, the Memory Adapter is not recommended as data is lost when the server restarts.
For production use, you should consider using a persistent database. c15t supports several database adapters:
Memory Adapter
- Simple in-memory storage (development only)
Kysely Adapter
- Type-safe SQL query builder
Prisma Adapter
- Feature-rich ORM with migrations
Drizzle Adapter
- Lightweight TypeScript ORM
These adapters can connect to various database backends:
PostgreSQL
- Recommended for production deployments
MySQL/MariaDB
- Popular open-source database
SQLite
- File-based database for simpler deployments
PostgreSQL is recommended for production deployments due to its robust feature set and reliability.
See the Database Adapters documentation for complete implementation details.