Core Concepts

April 15, 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.

This document covers the fundamental concepts and architecture of the c15t Backend package.

Instance Management

Creating an Instance

The c15t instance is the core of the system, managing all components and their interactions:

For a quick start guide, see Getting Started.

Instance Configuration

The instance configuration includes:

Learn more about database adapters in Database Adapters.

Context System

Context Structure

The context is a shared state that persists throughout the request lifecycle:

Context Extensions

Plugins can extend the context with additional data:

Learn more about plugins in Plugin System.

Request Handling

Request Flow

  1. Request Reception

  2. Request Processing

  3. Response Generation

For API endpoint details, see the instance handler documentation above.

Request Lifecycle

  1. Pre-processing

  2. Authentication

  3. Authorization

  4. Handler Execution

  5. Post-processing

Response Processing

Response Types

For API response formats, see the request handling examples above.

Response Formatting

Error Handling

Error Types

For error handling in plugins, see Plugin System.

Error Handling

Middleware System

Middleware Types

  1. Request Middleware

  2. Response Middleware

  3. Error Middleware

Learn more about middleware in Plugin System.

Middleware Chain

Event System

Event Types

Event Handling

Event Emission

Testing

Test Utilities

Mock Context

Performance Optimization

Caching

For database performance, see Database Adapters.

Connection Pooling

Request Batching