Minimal Setup
@consenti/api is a single function — createConsenti() — that returns a router you drop into any Node.js HTTP framework. It starts with JSON file storage so you need zero database installation to get going. This guide walks you through from install to a running admin dashboard.
Step 1 — Install
npm install @consenti/apiThat's the only required install. No database client, no ORM, no extra dependencies. The default JSON file storage works out of the box on any Node.js version ≥ 20.
node:sqlite (built into Node 22+, no install needed), better-sqlite3, pg, mysql2, or mongodb. See the Storage Driver guide for a comparison.Step 2 — Pick your framework
Consenti ships adapters for the most common Node.js HTTP frameworks. Pick the one that matches your setup — or use the standalone option if you don't have a framework at all.
import express from 'express'
import { createConsenti } from '@consenti/api'
const app = express()
const consenti = createConsenti({
storage: { driver: 'json', path: './consenti-data' },
auth: {
mode: 'local',
adminEmail: '[email protected]',
adminPassword: process.env.CONSENTI_ADMIN_PASSWORD!,
},
dashboard: true,
})
app.use(consenti.router)
app.listen(3000, () => {
console.log('Admin → http://localhost:3000/consenti/')
console.log('API → http://localhost:3000/consenti/api/v1/')
})Step 3 — First boot
Run your server. On first start, Consenti:
- Creates the storage directory (
./consenti-data/db/,./consenti-data/profiles/). - Bootstraps the database (creates tables and indexes).
- Creates the admin user from
auth.adminEmail+auth.adminPassword. - Seeds a default profile (
profileId: '0').
Subsequent starts run only pending migrations — first-boot setup never runs twice.
Step 4 — Log in to the dashboard
Navigate to http://localhost:3000/consenti/and log in with the credentials you configured. You'll land on the Dashboard overview showing consent statistics. From here you can create profiles, manage cookie templates, view consent records, and configure RBAC.
http://localhost:3000/consenti/api/docs. The OpenAPI JSON is at /consenti/api/openapi.json.