https://github.com/dorsium/gdpr-consent
Lightweight GDPR & Cookie Consent module for Next.js projects. Built by Dorsium.
https://github.com/dorsium/gdpr-consent
cookie-consent dorsium gdpr nextjs privacy react tailwind
Last synced: about 2 months ago
JSON representation
Lightweight GDPR & Cookie Consent module for Next.js projects. Built by Dorsium.
- Host: GitHub
- URL: https://github.com/dorsium/gdpr-consent
- Owner: dorsium
- License: mit
- Created: 2025-07-08T12:29:06.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2025-08-27T21:41:05.000Z (10 months ago)
- Last Synced: 2025-10-22T09:40:35.643Z (8 months ago)
- Topics: cookie-consent, dorsium, gdpr, nextjs, privacy, react, tailwind
- Language: TypeScript
- Homepage: https://dorsium.com
- Size: 77.1 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# @dorsium/gdpr
[](https://www.npmjs.com/package/@dorsium/gdpr)
[](https://github.com/dorsium/gdpr-consent)
> Lightweight GDPR & Cookie Consent module for Next.js projects. Built by the Dorsium Foundation.
## Features
- GDPR-compliant cookie consent banner
- Categorized: Necessary, Analytics, Marketing
- Remembers preferences via `localStorage`
- Fully reusable NPM module
- `useConsent()` hook for conditional logic
- Styled with Tailwind CSS
- Powered by Dorsium branding included
## Installation
```bash
npm install @dorsium/gdpr
```
## Usage
### 1. Add the CookieConsent component (e.g. to `_app.tsx` or layout)
```tsx
import { CookieConsent } from "@dorsium/gdpr";
export default function App({ Component, pageProps }) {
return (
<>
>
);
}
```
### 2. Use the `useConsent()` hook to check preferences
```tsx
import { useConsent } from "@dorsium/gdpr";
export default function AnalyticsLoader() {
const { hasConsent } = useConsent();
useEffect(() => {
if (hasConsent("analytics")) {
// Load Google Analytics or other trackers here
}
}, [hasConsent]);
return null;
}
```
### 3. Optional: Show the Dorsium badge
```tsx
import { PoweredByDorsiumBadge } from "@dorsium/gdpr";
export default function Footer() {
return (
);
}
```
## Configuration
No configuration needed. Automatically saves user choices under `localStorage['dorsium_consent']`.
Only two boolean values are stored:
- `analytics`
- `marketing`
These flags are kept indefinitely in `localStorage` until you clear them. No personal data is stored.
## Build
```bash
npm run build
```
## License
This project is licensed under the [MIT License](LICENSE).
---
© Dorsium — https://dorsium.com
---
[](https://dorsium.com)
🔗 [View on NPM](https://www.npmjs.com/package/@dorsium/gdpr)
🔗 [Source on GitHub](https://github.com/dorsium/gdpr-consent)