dpdp-kit is an open-source toolkit for India's Digital Personal Data Protection Act. You declare why you hold each piece of personal data in one typed config. It then keeps consent records you can prove, carries out erasure on time, logs who reads what, and fails CI when your schema drifts.

Until now it stopped at the backend. Every app still had to hand-build the screens the law is really about: the consent notice and the place where people change their mind. 0.6 ships those screens, for React, Next.js and React Native, on Postgres, MySQL, SQLite or MongoDB.

This post covers two releases, 0.5 and 0.6, because together they go from the database to the screen.

Not legal advice. dpdp-kit helps you put compliance into practice; it doesn't make an app compliant on its own.

The consent screen, in five lines

"use client"; import { ConsentNotice, DpdpProvider } from "dpdp-kit/react"; <DpdpProvider options={{ base: "/privacy" }}> <ConsentNotice onDone={() => router.push("/privacy")} /> </DpdpProvider> 

What it shows is decided by the law, not by a designer:

  • The notice's own text (Section 5, Rule 3): each purpose in plain words, the data it uses ("Mobile number", not phone), how to withdraw, how to make a request, and how to complain to the Board. It's built from your config, in each language you translate it into, and the exact version shown is saved as proof (Section 6(10)).
  • Every switch starts off. Consent has to be a clear affirmative action, so nothing is pre-ticked.
  • "Accept selected" and "Reject all" look the same. Neither is the big coloured button.
  • The grant is recorded against the notice version and language the person actually saw.

The privacy centre

<DpdpProvider options={{ base: "/privacy" }}> <PrivacyCentre /> </DpdpProvider> 
  • Your choices: switch each consent off as easily as it was given (Section 6(4)), and object to a legitimate use under Section 7(a). Objecting asks for confirmation first.
  • Your data: what's held and who it's shared with, in which country (Section 11), with a JSON download.
  • Your requests: correction, erasure, access, grievance, with the reference and due date.
  • Your nominee (Section 14), and how to reach us (Rule 14(1)).

Each part works on its own (<ConsentSettings>, <MyData>, <Requests>, <Nominees>, <HowToReachUs>). The components are unstyled semantic HTML with dpdp-* classes, role="switch" and live regions, and checked with axe-core. If you want a default look, there's an optional stylesheet with dark mode, written with :where() so your own CSS always wins. Every string is in a labels prop.

If you'd rather build your own UI, the hooks are there: useConsents (changes show at once and are undone if the server refuses), useNotice, useMyData, useRequests, useNominees.

The same screens on mobile

import { ConsentNotice, DpdpProvider } from "dpdp-kit/react-native"; <DpdpProvider options={{ base: `${API}/privacy`, headers: () => ({ authorization: `Bearer ${token}` }) }}> <ConsentNotice theme="auto" onDone={next} /> </DpdpProvider> 

Built from View, Text, Switch and Pressable, with VoiceOver and TalkBack labels and a share sheet for the data copy. The server can record whether consent came from ios, android or web.

What's behind them (0.5)

The screens talk to an HTTP API that 0.5 added to your own server. One line in Next.js:

// app/privacy/[...path]/route.ts export const { GET, POST, DELETE } = createHandlers(dpdp, { base: "/privacy", subject: userId }); 

Express (dpdpRouter) and Hono (dpdpRoutes) work the same way. The person comes only from your authentication, and paths it doesn't serve go on to your own handlers.

0.5 also brought the parts of the law the screens show:

  • Privacy notices built from the config, versioned by content and saved the first time they're shown.
  • Objections to legitimate uses (Section 7(a)), in the same hash chain as consent.
  • Complete rights requests: corrections written to your tables, identity checks, acknowledgements with due dates, nominees.
  • Cross-border transfers (Section 16): the audit errors on a processor in a restricted country.
  • An evidence report: the data map, processors and countries, notices shown, consent counts, requests, erasure and breaches, ending with what needs attention.

MySQL and SQLite (0.6)

dpdp-kit/mysql (MySQL 8, mysql2 or Prisma) and dpdp-kit/sqlite (node:sqlite, better-sqlite3, libsql/Turso) each provide a store for dpdp-kit's records and data access for your own tables, so erasure and corrections run there too:

import { sqliteData, sqliteStore } from "dpdp-kit/sqlite"; const dpdp = createDpdp({ config, store: sqliteStore(query), data: sqliteData(query) }); 

MySQL timestamps are stored in UTC and read back as text, so no driver or server time zone shifts them. 0.4 taught me that one: Prisma shifted every timestamp by 5½ hours on a server in IST. CI runs MySQL in IST for that reason.

Every built-in store now passes the same contract suite: memory, Postgres three ways, MongoDB, SQLite and MySQL. If you write a store for another database, you can run it too.

Try it

Two new example apps, in examples/:

  • next-app: Chai & Co, a small tea shop, on the Next.js App Router and SQLite, with the consent screen and the privacy centre. A script drives it through a year of customers in CI.
  • expo-app: the same shop on iOS and Android, talking to the Next.js example with a Bearer token.
npm i dpdp-kit 

Upgrading from 0.5: the audit warnings added in 0.5 now fail --strict, as 0.5 announced. Everything else is opt-in.

Next up is 0.7: children's data (Section 9, Rule 10) and erasure after a period of inactivity (Rule 8). If you're building on DPDP, I'd love to hear what you need.