Open source · MIT · Node.js

India's DPDP Act, built into your Node.js backend.

Declare why you hold each piece of personal data in one typed file. dpdp-kit keeps consent records you can prove, carries out erasure on time, tracks rights requests, and fails CI the moment your schema drifts.

₹250 crore maximum penalty Most Rules start May 2027 No SaaS, no API key, your own Postgres or MongoDB
250+tests, on real Postgres, Prisma and MongoDB
22+1notice languages: the Eighth Schedule and English
0network calls; data stays on your servers
MITfree and open source, no paid tier
Why build it in now

The penalties are real money.

The Act's Schedule (Section 33) sets the maximum penalty for each kind of breach. Even the line for "any other provision", which covers consent, notices, erasure and rights requests, goes up to ₹50 crore.

₹250 croreNot taking reasonable security safeguards to prevent a personal data breachSection 8(5) · Schedule item 1
₹200 croreNot notifying the Board and affected people of a personal data breachSection 8(6) · Schedule item 2
₹200 croreNot meeting the additional obligations for children's dataSection 9 · Schedule item 3
₹50 croreBreaking any other provision of the Act or the Rules: consent, notices, erasure, rightsSchedule item 7

The burden of proof is on you.

If consent is questioned, Section 6(10) makes the Data Fiduciary prove that a notice was given and consent was given. "consented: true" in a column isn't proof.

May 2027 is closer than it looks.

Notices, erasure, breach handling and rights requests all start then. Retrofitting them into a grown codebase takes longer than building them in now.

Spreadsheets drift.

A data map that lives outside the code is out of date the day someone adds a column. Compliance has to live where the changes happen: in the code and in CI.

Compliance that can't quietly drift

Someone adds a column. CI notices.

Most teams keep their data map in a spreadsheet, and six months later it's wrong. dpdp-kit reads your real Drizzle, Prisma or Mongoose schema and fails the build when a personal-looking column has no declared purpose, or when the map points at columns that are gone.

src/db/schema.tsdpdp.config.ts

      
CI · pull request #142

      
What the law asks of your code

Every duty, mapped to code.

Each Section and Rule below was checked against the official Gazette texts of the Act, the Rules and their corrigendum.

The law saysWheredpdp-kit
Process data only for a stated purpose, with consent or a legitimate useSections 4, 6, 7A typed data map: every field lists its purposes
Prove that a notice was given and consent was givenSection 6(10)Hash-chained consent records with the notice version and language
A notice in English or any Eighth Schedule languageSections 5(3), 6(3)All 22 languages built in
Erase on withdrawal or when the purpose ends, unless another law says keep itSection 8(7)Erasure plans and a retention runner, with legal holds
Keep data, traffic data and logs of processing for at least a yearRule 8(3)minimumRetention, enforced by the audit
Log, monitor and review who accesses personal data, and keep the logs for a yearRule 6(1)(c), (e)An access log with review, flags reads outside a field's purpose
Encryption, masking or virtual tokensRule 6(1)(a)dpdp-kit/protect: AES-256-GCM, keyed tokens, masking
Tell people and the Board about a breach, with a detailed report within 72 hoursSection 8(6), Rule 7Breach records with deadlines, notices and the Board report
Answer access, correction, erasure, grievance and nomination requestsSections 11–14Rights requests with due dates
Answer grievances within 90 daysRule 14(3)A default due date, enforced by the audit
Tell processors to stop, and to eraseSections 6(6), 8(7)(b)Processor hooks, or a manual task when there's no hook
How it works

One config. Five things it does for you.

i.

Say why you hold each field.

Purposes, their legal basis and how long you keep the data live in one file. Purposes are typed, so a misspelt one is an error in your editor, and the audit catches the rest.

The config, field by field →
ts
// dpdp.config.ts
import { defineConfig } from "dpdp-kit";

export default defineConfig({
  fiduciary: { name: "Acme Pvt Ltd", grievanceUrl: "https://acme.in/grievance" },
  purposes: {
    account:       { basis: "legitimate-use", retain: "while-active" },
    marketing_sms: { basis: "consent", retain: { afterWithdrawal: "0d" } },
  },
  data: {
    users: {
      table: "users",
      subject: "id",
      fields: { phone: { category: "contact", purposes: ["account", "marketing_sms"] } },
    },
  },
  minimumRetention: "1y", // Rule 8(3)
});
ii.

Consent you can prove.

Section 6(10) puts the burden of proof on you. Every grant and withdrawal is stored with the notice version, language and channel, in a per-person SHA-256 hash chain.

verify() catches an edited, deleted or reordered event.

How the record works →
ts
await dpdp.consent.grant(userId, ["marketing_sms"], {
  noticeVersion: "2026-11",
  language: "hi",      // English or any of the 22 Eighth Schedule languages
  channel: "android",
});

await dpdp.consent.has(userId, "marketing_sms"); // true
await dpdp.consent.verify(userId);               // { ok: true, events: 1 }
iii.

Erasure that actually happens.

  • Processors are told to stop straight away.
  • A field is erased only when none of its purposes remain.
  • Rule 8(3)'s one-year minimum is respected.
  • Legal holds win: GST invoices wait 8 years, then get anonymised.
  • Safe with several servers: tasks are claimed atomically.
Erasure and retention →
ts
// a withdrawal schedules the erasure as dated tasks
await dpdp.consent.withdraw(userId, ["marketing_sms"]);

// an account deletion, with legal holds applied
await dpdp.erasure.deleteAccount(userId);

// then, from a daily cron:
const report = await dpdp.retention.run(); // { done, failed, manual }
iv.

Rights requests, on a clock.

Access, correction, erasure, grievance and nomination requests (Sections 11–14) are recorded with a due date. Grievances default to the 90 days of Rule 14(3).

Rights requests →
ts
const request = await dpdp.rights.open(userId, "grievance", {
  text: "I keep getting promo SMS",
}); // due in 90 days

await dpdp.rights.list({ overdue: true }); // your inbox of late answers
await dpdp.rights.summary(userId);         // Section 11: what you hold and why
v.

A GitHub Action that comments where it hurts.

Each problem lands on the pull request as an annotation, with a summary on the run page and errors / warnings outputs.

Set it up → On the GitHub Marketplace →
yaml
# .github/workflows/dpdp.yml
on: [pull_request]
jobs:
  audit:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with: { node-version: 22 }
      - run: npm ci
      - uses: yogesh2902/dpdp-kit@v0
        with:
          schema: src/db/schema.ts
Why dpdp-kit

Compliance that lives in your code.

There are three common ways to handle the DPDP Act. Only one of them is checked every time your code changes.

Spreadsheet and a policy pageHosted consent platformdpdp-kit
Checked on every pull requestNoUsually notYes, in CI
Catches a new personal column before it shipsNoUsually notYes, from your schema
Personal data stays on your serversYesUsually sent to the vendorYes, no network calls
Consent records that show tamperingNoVariesYes, hash-chained
Erasure carried out on time, with legal holdsBy handVariesYes, retention runner
Mistakes caught in your editorNoNoYes, typed config
CostFree, but manualSubscriptionFree, MIT
{}

Compliance as code

One typed config is the single source of truth. The audit, the guards, erasure and rights requests all read it.

⌁

Drift-proof

The audit reads your real Drizzle, Prisma or Mongoose schema in both directions, so the data map can't quietly fall out of date.

◎

Node-native, no SaaS

A library inside your process. No server to run, no account, no API key, and your own Postgres or MongoDB.

§

Checked against the law

Every Section and Rule reference was checked against the official Gazette texts. A wrong reference is treated as a bug.

✓

Tested like infrastructure

250+ tests, on real Postgres in IST, Prisma and MongoDB, with runners racing for the same tasks. Example apps go through a year of customers on every change.

↗

Open, no lock-in

MIT licensed. Your records live in your own tables, and every store and data-access layer is an interface you can replace.

Who it's for

Any team holding Indian users' data.

If your app stores a phone number, an email or an address of someone in India, the Act applies. Here's where dpdp-kit helps most.

Fintech and lending

KYC records under legal holds, erasure that respects them, and rights requests with due dates.

E-commerce and D2C

Consent for marketing SMS and email, GST invoices kept for 8 years then anonymised, and SMS vendors told to stop.

Ed-tech

Consent records today. Children's data and verifiable guardian consent (Section 9, Rule 10) are on the roadmap.

Health and wellness

Health and biometric columns are flagged by the drift check, so nothing is stored without a stated purpose.

SaaS and B2B

Processor hooks tell analytics and messaging vendors to stop and erase, and the Action reviews every pull request.

Agencies and freelancers

One config and one CI check per client project, so every app you ship starts with the basics in place.

When the Rules apply

The clock is already running.

The DPDP Rules, 2025 were published on 13 November 2025 and start in phases (Rule 1). Building this in now leaves time to test.

11 Aug 2023
The Act is passed
Digital Personal Data Protection Act, No. 22 of 2023
13 Nov 2025
The Rules are notified
G.S.R. 846(E)
Nov 2026
Consent Managers
Rule 4, one year after publication
May 2027
Most duties begin
Notices, safeguards, breaches, erasure, children, rights: Rules 3, 5–16, 22, 23

Not legal advice. dpdp-kit helps you put compliance into practice; it doesn't make an app compliant on its own. Section and Rule references point you to the text so you can check them. Have your own lawyer review your purposes, notices and retention periods.

Roadmap

What's shipped, and what's next.

dpdp-kit is growing from a backend toolkit into a full-stack one: the same config will drive the screens people see, on the web and on mobile.

Shipped0.1 – 0.4
  • Typed config and audit CLIpurposes, data map, checks
  • Schema drift checkDrizzle, Prisma and Mongoose
  • Your databaseDrizzle, Prisma, MongoDB and Mongoose, or any Postgres client
  • Breach recordsSection 8(6), Rule 7: who to tell, and the Board's 72-hour report
  • Consent recordshash-chained, 22 languages + English
  • Erasure and retention runnerlegal holds, Rule 8(3), NOT NULL replacements
  • Rights requestsSections 11–14, Rule 14 due dates
  • Security safeguardsRule 6: access log, encryption, tokens, masking
  • Guards for every frameworkExpress, Hono, Fastify, NestJS
  • Events and daily upkeepdpdp.on, dpdp.daily()
  • GitHub Actionannotations on pull requests
  • Example appsPrisma and Mongoose, a year of customers in CI
Building now0.5
  • Rule 3 notices from the configin every offered language, with an automatic version
  • Objections to a legitimate useSection 7(a)
  • HTTP APIExpress, Hono and Next.js adapters
  • Rights requests and transferscorrections applied, cross-border records (Section 16)
Next0.6
  • MySQL and SQLitedata access
  • React and React Nativea consent notice and a privacy centre
Later0.7 +
  • Children's dataage gate and verifiable guardian consent, Section 9, Rule 10
  • Inactivity erasure48 hours' warning, Rule 8(1)–(2)
  • Erasure beyond SQLfiles, caches, search indexes
  • Consent Manager interopSections 6(7)–6(9), Rule 4

Plans can change as the law and the community shape them. Want something sooner? Open an issue or star the repo to follow along.

Questions

Things people ask.

Does dpdp-kit make my app compliant?

No tool can do that on its own. dpdp-kit puts the obligations into practice in your code: declared purposes, consent records, erasure and rights requests. Your company still writes its notices, signs its vendor contracts, runs access control and backups, and has its own lawyer review its purposes and retention periods. Who does what lists every duty in the Act and Rules, and which side does it.

Is it free?

Yes. It's MIT licensed, with no paid tier and no account. You can use it in commercial products.

Do I need to run a server or sign up for anything?

No. It's a library that runs inside your Node.js process and writes to your own database. There's no API key, and it makes no network calls.

Which databases and frameworks does it support?

Storage and data access work with Postgres through Drizzle, Prisma or any Postgres client (node-postgres, postgres.js, Kysely, Knex), and with MongoDB and Mongoose. The schema drift check reads Drizzle schemas (Postgres, MySQL, SQLite), Prisma schemas and Mongoose models. Guards are included for Express, Hono, Fastify and NestJS. Every store is an interface, so you can add another database. MySQL and SQLite data access come in 0.6.

Which Node.js versions?

Node.js 20.19 or later. The package is ESM-only, and require("dpdp-kit") also works on those versions.

When do I need to have this in place?

The DPDP Rules were notified on 13 November 2025. Most obligations, including notices, erasure, breaches, children and rights requests, start in May 2027 (Rule 1). Starting now leaves time to test.

What if a legal reference is wrong?

Every reference was checked against the official texts of the Act, the Rules and their corrigendum, but laws change. Report it as a GitHub issue; it's treated as a bug.

How can I help?

Star the repo, try it in a project, and open issues for what's missing. Pull requests are welcome, especially for new database adapters.

Get started

Start before May 2027.

$ npm i dpdp-kit Quick start