Quickstart
Add consent management to your Next.js app in under 5 minutes.
Via CLI
Manual Installation
Install package
Optional: Configure Next.js rewrites
Proxy API requests through your Next.js server. This can prevent ad blockers from blocking requests to your c15t backend.
Info
Set NEXT_PUBLIC_C15T_URL in your .env file to point to your c15t backend (e.g., https://your-instance.c15t.dev).
Create a client provider component
Create a 'use client' component that accepts an ssrData prop. This initializes the consent store and makes consent state available to all child components.
Info
Don't have a backend yet? Use mode: 'offline' to get started with local-only consent storage. See Client Modes for details.
Optional: SSR Initial Data (App Directory)
In a server component wrapping the provider, call fetchInitialData to pre-fetch consent data. Do not await the call — pass the Promise directly to the client component so Next.js can stream the response while data loads.
By prefetching the data on the server the banner can appear visually sooner, however this can increase TTFB if your app is fully client-side rendered.
Then use it in your layout:
Info
Do not await fetchInitialData() in the Server Component. Passing the unresolved Promise lets Next.js stream the page while the consent data loads in parallel.
Verify it works
Start your development server and confirm:
- A consent banner appears at the bottom of the page
- Clicking "Customize" opens a dialog with toggles for each consent category
- After accepting or rejecting, the banner dismisses and your choice persists across page reloads
Optional: Add DevTools
Install DevTools only if you want a runtime inspector while building and debugging:
Then add it inside your existing provider:
Info
Want to understand what's happening under the hood? See Initialization Flow for the lifecycle and Cookie Management for script/cookie behavior and revocation handling.
Optional: Install Agent Skills
Install c15t agent skills to let AI agents help with styling, i18n, scripts & other configuration.
See AI Tools for details.
Next steps
Last modified on February 11, 2026