create-consentify CLI
Interactive scaffolder that wires @consentify/core into your project in ~30 seconds.
create-consentify is the recommended starting point for any project that uses a bundler. It asks a few questions, installs the right packages, and writes framework-specific glue code.
Usage
npx create-consentify@latest
# or
pnpm create consentify
# or
bunx create-consentifyWhat It Does
- Detects (or asks about) your framework
- Prompts for consent categories, mode (opt-in / opt-out), and optional Google Consent Mode v2 wiring
- Optionally connects to the Consentify dashboard for analytics (site ID + API key)
- Installs
@consentify/core(+@consentify/react/@consentify/cloudwhen relevant) - Writes a
lib/consent.tsand a provider component for your framework - Prints the exact snippet to paste into your root layout / entry file
The CLI never modifies your existing layout.tsx, _app.tsx, main.tsx, or root.tsx - those edits are shown as instructions for you to apply.
Supported Frameworks
- Next.js (App Router)
- Next.js (Pages Router)
- Vite + React
- Remix
- Astro
- Vanilla JS / HTML
Non-Interactive (CI)
npx create-consentify@latest \
--framework nextjs-app \
--categories analytics,marketing \
--mode opt-in \
--gcm \
--site-id site_xxx \
--api-key sk_xxx \
--pm pnpm \
--yesAll flags are optional; any missing flag triggers a prompt unless --yes is set and the combination is complete.
| Flag | Values |
|---|---|
--framework | nextjs-app, nextjs-pages, vite-react, remix, astro, vanilla |
--categories | Comma-separated (e.g. analytics,marketing). necessary is implicit. |
--mode | opt-in (GDPR, default) | opt-out (CCPA) |
--gcm | Enable Google Consent Mode v2 wiring |
--site-id | Consentify dashboard Site ID (implies SaaS mode) |
--api-key | Dashboard API key (optional) |
--pm | pnpm | npm | yarn | bun |
--cwd | Target project directory (default: process.cwd()) |
--yes | Skip confirmation prompts |
Output Structure
For a Next.js App Router project with analytics + marketing categories:
src/
├── lib/
│ └── consent.ts # createConsentify() + optional enableCloud()
├── components/
│ └── consent-provider.tsx # Client component with useConsentify()
└── .env.local # NEXT_PUBLIC_CONSENTIFY_SITE_ID (if SaaS connected)After scaffolding, import the provider into your root layout as instructed in the CLI output.