Getting Started

Quick start guide for setting up and using the C15T Backend package, including installation, basic configuration, and common issues.

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
# or
yarn add @c15t/backend
# or
pnpm add @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

  1. Learn about Core Concepts to understand the system architecture
  2. Explore Database Adapters for different storage options
  3. Check out the Plugin System for extensibility
  4. Review API Endpoints for available functionality

Common Issues

Database Connection Issues

If you're having trouble connecting to the database:

  1. Check your connection string
  2. Verify database credentials
  3. Ensure the database is running
  4. Review Database Adapters for more details

Authentication Problems

For authentication issues:

  1. Verify your JWT secret
  2. Check token expiration
  3. Review Authentication documentation

Plugin Loading

If plugins aren't loading:

  1. Check plugin dependencies
  2. Verify plugin order
  3. Review Plugin System documentation

On this page

c15t.com