Getting Started (v1)
Quick start guide for setting up and using the c15t Backend package, including installation, basic configuration, and common issues.
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.
Welcome to c15t Backend! This guide will help you get started with the consent management system.
Installation
Install the package using your preferred package manager:
npm install @c15t/backend
Basic Usage
Create an instance of c15t:
import { c15tInstance } from "@c15t/backend";
import { memoryAdapter } from "@c15t/backend/db/adapters/memory";
const instance = c15tInstance({
baseURL: "http://localhost:3000",
database: memoryAdapter({})
});
For more details on instance configuration, see Core Concepts.
Configuration
Basic Options
const instance = c15tInstance({
baseURL: "http://localhost:3000",
database: memoryAdapter({}),
plugins: [],
context: {}
});
With Plugins
const instance = c15tInstance({
baseURL: "http://localhost:3000",
database: memoryAdapter({}),
plugins: [authPlugin, loggingPlugin]
});
Learn more about plugins in the Plugin System documentation.
Database Setup
Memory Adapter (Development)
import { memoryAdapter } from "@c15t/backend/db/adapters/memory";
const instance = c15tInstance({
database: memoryAdapter({})
});
Kysely Adapter (Production)
import { kyselyAdapter } from "@c15t/backend/db/adapters/kysely";
const instance = c15tInstance({
database: kyselyAdapter({
dialect: "postgres",
connection: {
host: "localhost",
port: 5432,
database: "c15t",
user: "postgres",
password: "password"
}
})
});
For more database options and configuration, see Database Adapters.
Handling Requests
const request = new Request("http://localhost:3000/api/c15t/status", {
method: "GET"
});
const response = await instance.handler(request);
Learn more about request handling in Core Concepts.
Next Steps
- Learn about Core Concepts to understand the system architecture
- Explore Database Adapters for different storage options
- Check out the Plugin System for extensibility
- Review the request handling examples above for available functionality
Common Issues
Database Connection Issues
If you're having trouble connecting to the database:
- Check your connection string
- Verify database credentials
- Ensure the database is running
- Review Database Adapters for more details
Authentication Problems
For authentication issues:
- Verify your JWT secret
- Check token expiration
- Review plugin configuration in the Plugin System documentation
Plugin Loading
If plugins aren't loading:
- Check plugin dependencies
- Verify plugin order
- Review Plugin System documentation