If your app has Indian users and stores even a phone number, the Digital Personal Data Protection Act, 2023 applies to you. The DPDP Rules, 2025 were notified on 13 November 2025, and most of their obligations start 18 months later, in May 2027: notices, security safeguards, breach reporting, erasure, and rights requests. The maximum penalty is ₹250 crore.
Most teams will handle this with a privacy policy page and a spreadsheet. Nothing in the code enforces either. Six months later someone adds an aadhaar_number column, nobody updates the spreadsheet, and the data is kept forever.
So I built dpdp-kit: an open-source, Node.js-native toolkit that builds the DPDP Act into your backend. Version 0.2.0 is out today.
npm i dpdp-kit Not legal advice. dpdp-kit helps you put compliance into practice; it doesn't make an app compliant on its own. Every Section and Rule reference in it was checked against the official Gazette texts, but your lawyer still signs off.
What the law asks of your code
| The law says | Where | dpdp-kit |
|---|---|---|
| Process data only for a stated purpose, with consent or a legitimate use | Sections 4, 6, 7 | Typed data map: every field lists its purposes |
| Prove a notice was given and consent was given | Section 6(10) | Hash-chained consent records with notice version and language |
| Notice in English or any Eighth Schedule language | Sections 5(3), 6(3) | All 22 languages built in |
| Erase when consent is withdrawn or the purpose ends, unless another law says keep it | Section 8(7) | Erasure plans + a runner, with legal holds |
| Keep data, traffic data and logs of processing for at least a year | Rule 8(3) | minimumRetention, enforced by the audit |
| Answer access, correction, erasure, grievance and nomination requests | Sections 11–14 | Rights requests with due dates |
| Answer grievances within 90 days | Rule 14(3) | Default due date, enforced by the audit |
| Tell processors to stop and erase | Sections 6(6), 8(7)(b) | Processor hooks |
1. Declare your data, with types
Everything starts from one config file. Purposes are typed, so a typo in a field's purpose list is an error in your editor:
// dpdp.config.ts import { defineConfig } from "dpdp-kit"; export default defineConfig({ fiduciary: { name: "Acme Pvt Ltd", grievanceUrl: "https://acme.in/privacy/grievance" }, purposes: { account: { basis: "legitimate-use", retain: "while-active" }, order_updates: { basis: "consent", retain: "while-active" }, marketing_sms: { basis: "consent", retain: { afterWithdrawal: "0d" } }, }, data: { users: { table: "users", subject: "id", fields: { phone: { category: "contact", purposes: ["account", "order_updates", "marketing_sms"] }, name: { category: "identity", purposes: ["account"] }, }, }, orders: { table: "orders", subject: "user_id", fields: { address: { category: "contact", purposes: ["account"] } }, legalHold: { reason: "GST records", keep: "8y", then: "anonymise" }, }, }, processors: { msg91: { purposes: ["order_updates", "marketing_sms"] } }, minimumRetention: "1y", // Rule 8(3) }); 2. Catch schema drift in CI
This is the part I'm proudest of. A data map is only useful while it matches the database, so the audit reads your real Drizzle schema and checks both directions:
npx dpdp-kit audit --schema src/db/schema.ts ✖ error schema.users.aadhaar_number Looks like personal data (identity, matched "aadhaar") but isn't in the data map. ✖ error data.orders.fields.address Column "address" isn't in table "orders". Fix the name, or remove it if the column was dropped. ⚠ warning schema.users.gender Looks like personal data (identity, matched "gender") but isn't in the data map. It recognises phone and email columns, Aadhaar, PAN, passport and voter IDs, dates of birth, names, addresses and PIN codes, UPI, IFSC and bank details, IP addresses and device IDs, and health, biometric and location data. Clear cases are errors; maybe-personal ones like name or city are warnings. Columns that describe data rather than hold it, like email_verified_at or address_type, are left alone.
In GitHub Actions, each problem lands on the pull request as an annotation:
- run: npm ci - uses: yogesh2902/dpdp-kit@main with: schema: src/db/schema.ts 3. Consent records that show tampering
import { createDpdp } from "dpdp-kit"; import { drizzleData, drizzleStore } from "dpdp-kit/drizzle"; const dpdp = createDpdp({ config, store: drizzleStore(db), data: drizzleData(db, { schema }) }); await dpdp.consent.grant(userId, ["marketing_sms"], { noticeVersion: "2026-11", language: "hi", channel: "android", }); await dpdp.consent.has(userId, "marketing_sms"); // true await dpdp.consent.verify(userId); // { ok: true, events: 1 } Each person's grants and withdrawals form a SHA-256 hash chain. verify() catches an edited, deleted or reordered event, which matters because Section 6(10) puts the burden of proving consent on you.
4. Erasure that actually happens
Withdrawing consent schedules the erasure. A daily retention.run() carries it out:
await dpdp.consent.withdraw(userId, ["marketing_sms"]); await dpdp.retention.run(); // from a daily cron - Processors are told to stop immediately (Section 6(6)), through hooks you provide.
- Fields are erased only when none of their purposes remain.
phonestays whileaccountstill needs it. - Rule 8(3)'s one-year minimum is respected. The data is restricted now and deleted after a year, which is what the Rule's own example asks ("even if X deletes her account").
- Legal holds win. Invoices kept for GST wait 8 years, then get anonymised.
- It's safe with several servers. Tasks are claimed atomically, retried on failure, and a processor without a hook becomes a manual task.
5. Rights requests on a clock
const request = await dpdp.rights.open(userId, "grievance", { text: "Too many promo SMS" }); // due 90 days later (Rule 14(3)) await dpdp.rights.list({ overdue: true }); // your inbox of late answers await dpdp.rights.summary(userId); // Section 11: what you hold, why, and who you shared it with await dpdp.rights.erase(userId, { keepFor: ["account"], requestId: request.id }); // Section 12(3) Why Node-native
dpdp-kit is a library, not a service. It runs inside your Node process, writes to your own Postgres through the Drizzle setup you already have, and makes no network calls. There's no server to deploy, no API key, and personal data never leaves your infrastructure. It works with ESM, require() and TypeScript, with Express and Hono middleware included.
How it's tested
- 85 tests, including full flows against real Postgres (PGlite): withdraw → processor stopped → column nulled a year later, account deletion with an 8-year GST hold, and three runners racing for the same tasks
- CI on Node 20.19, 22 and 24, plus a job that runs the GitHub Action against a sample project
- Legal references checked against the Act (Gazette, 11 August 2023), the Rules (G.S.R. 846(E)) and their corrigendum (G.S.R. 892(E))
What's next
Recording objections to a Section 7(a) use, React components for notices and a privacy centre, MySQL and SQLite data access, children's data and guardian consent (Section 9, Rule 10), and breach records with the 72-hour Board report (Rule 7).
Try it
npm i dpdp-kit - GitHub: github.com/yogesh2902/dpdp-kit (MIT)
- npm: npmjs.com/package/dpdp-kit
If you build for Indian users, I'd really like to hear what's missing. Issues and PRs are welcome, and a star helps other developers find it.


