@c15t/astro

Astro cookie consent banner and GDPR consent management platform (CMP). Server-rendered banner, preference center islands, geo-aware middleware, Google Consent Mode v2 and IAB TCF.
15,689 1,999
Install
npm install @c15t/astro
Latest Version:3.1.0
Vue:3
License:Apache-2.0
Last Updated:Oct 22, 2026
Links: GitHub  ·  npm
Maintainer: kayleew

@c15t/astro: Astro cookie banner and cookie consent management

Cookie banner, preference dialog, and consent-gated scripts for Astro 5, 6, and 7. Middleware resolves each request's consent policy, such as GDPR opt-in in the EU. The banner is plain .astro markup with no framework JavaScript. The preference dialog loads as a Svelte, React, or Vue island only when a visitor opens it.

c15t is used by 2,100+ sites, including expo.dev, zed.dev, unkey.dev, mintlify.com, and sazabi.com.

Key Features

  • Visitors download no UI framework for the banner. The dialog's framework loads only when a visitor opens it
  • Write the dialog island in Svelte, React, or Vue, so it uses the framework your site already ships
  • Static output works on any static host with hosted(). Server output resolves each visitor's policy, so the banner is in the first HTML
  • Geo-aware middleware reads location and language headers from your host
  • Analytics, ads, and pixels follow each visitor's choice through @c15t/integrations: Google Tag Manager, Google Consent Mode v2, GA4, Meta Pixel, PostHog, and more
  • IAB TCF 2.4 banner and dialog components

Prerequisites

  • Astro 5, 6, or 7
  • One of @astrojs/svelte, @astrojs/react, or @astrojs/vue for the preference dialog
  • A server adapter for server output, or none for static output
  • An Inth project (free sign-up), a self-hosted backend, or offline mode for local development

Installation

pnpm add c15t @astrojs/svelte svelte @astrojs/node

The c15t package re-exports this package at c15t/astro, and the docs use that path. For React or Vue dialogs, install @astrojs/react react react-dom or @astrojs/vue vue instead of Svelte. @astrojs/node is the server adapter in the example below. Use your host's adapter instead, or leave it out for static output.

Usage

  1. Set PUBLIC_C15T_BACKEND_URL to your Inth backend URL in .env
  2. Register your UI framework, then c15t(), in astro.config.mjs
// astro.config.mjs
import node from '@astrojs/node'
import svelte from '@astrojs/svelte'
import { defineConfig } from 'astro/config'
import c15t from 'c15t/astro'

export default defineConfig({
  adapter: node({ mode: 'standalone' }),
  integrations: [svelte(), c15t()],
  output: 'server',
})
  1. Add ConsentScript to <head>, and ConsentBanner, ConsentDialog, and ConsentDialogLink to your layout, from c15t/astro/components
  2. For static output, the full layout, and island options, see the Astro quickstart

Hosting

c15t needs somewhere to keep policies and consent records. Pick one:

  • Hosted on Inth: Inth runs the backend for you. You get policy storage, consent records, audit history, and a dashboard, with no database or server to run. Sign-up is free.
  • Self-hosted: Run @c15t/backend on your own server with PostgreSQL, MySQL, or SQLite. You own migrations, backups, and uptime. See the self-hosting guide.
  • Offline: Choices stay in the browser, with no consent records. Use it for local development, previews, and demos, not production.

The frontend code is the same for Inth and a self-hosted backend. Only the backend URL changes.

Documentation

See the documentation for guides, API reference, and examples.

Docs for AI Agents

This package ships its documentation as Markdown, matched to the installed version. After you install it, point your coding agent at node_modules/@c15t/astro/AGENTS.md. It indexes every guide in node_modules/@c15t/astro/docs/.

On the web, every page of the c15t docs has a Markdown version, and llms.txt lists them all. Install the c15t agent skills with npx skills add c15t/skills.

Support

Contributing

Security

Do not open a public issue for a security vulnerability. Report it privately through GitHub's vulnerability reporting. We examine every valid report.

  • Do not share the vulnerability in public forums, issues, or pull requests
  • Give the steps to reproduce it and the versions it affects
  • Give us time to release a fix before you disclose it

License

Apache License 2.0


Built by Inth

Related Packages

c15t

The open standard for cookie banners. Open-source cookie consent management plat...

3,309,204 1,991
@c15t/vue

Vue and Nuxt cookie consent banner, consent dialog and preference center. A GDPR...

15,712 1,997
@revenexx/consent-manager-nuxt

Server-rendered cookie consent for Nuxt without a third-party script: an SSR con...

520 0
@c15t/ui

Framework-agnostic cookie banner UI primitives, CSS and theme tokens behind the...

2,447,802 1,991
@polyus-studio/vera-cmp

Centralized cookie consent management (CMP) for 30+ sites — a typed wrapper arou...

802 0

Version History

Version Released License
3.1.0 Apache-2.0
3.0.0 Apache-2.0
Pre-releases (15)
Version Released License
3.1.0-canary.0 Apache-2.0
3.0.1-canary-198c836e9e869389f889eb3195a9e7b3e3902275.0 Apache-2.0
3.0.0-alpha.12 Apache-2.0
3.0.0-alpha.11 Apache-2.0
3.0.0-alpha.10 Apache-2.0