Production Recipes

Use @tantainnovative/ndpr-recipes as a versioned npm source package for backend persistence, routes, adapters, and compliance workflow templates.

@tantainnovative/ndpr-toolkit gives you the runtime components, hooks, validators, scoring, and server utilities. @tantainnovative/ndpr-recipes gives you versioned backend source templates: database schema, route handlers, middleware, and storage adapters that you copy into your application and own.

Treat the recipes package like a maintained implementation workbook. Install it to pin the source version, copy the pieces you need, then adapt naming, authentication, tenancy, logging, and deployment details to your stack.

pnpm add @tantainnovative/ndpr-toolkit
pnpm add -D @tantainnovative/ndpr-recipes

# Prisma projects
cp node_modules/@tantainnovative/ndpr-recipes/prisma/schema.prisma prisma/schema.prisma

# Copy complete integration seams before adapting paths and auth
cp -r node_modules/@tantainnovative/ndpr-recipes/src/nextjs/app-router src/ndpr/nextjs
cp -r node_modules/@tantainnovative/ndpr-recipes/src/express src/ndpr/express
cp -r node_modules/@tantainnovative/ndpr-recipes/src/adapters src/ndpr/adapters

The recipes are intentionally not hidden behind a runtime abstraction. Compliance persistence needs to fit your authentication, data retention, audit logging, tenant isolation, and incident-response process.

Existing 0.1.x or 0.2.0 databases require the reviewed 0.3.0 migration artifacts and guide. Standalone psql or Prisma use the wrapped migrations/0.3.0/postgresql.sql; a Drizzle-managed migration uses the transaction-control-free migrations/0.3.0/drizzle.sqlinside Drizzle's outer transaction. Do not use a blind Prisma or Drizzle schema push: tenant ownership, DSR subject IDs, consent deduplication, and ROPA evidence require reviewed backfills.

Security Contract Before Deployment

Set the server-only NDPR_TENANT_ID and replace the fail-closed resolveVerifiedNDPRActor implementation with your verified session lookup. Map privacy operators to ndpr:staff or ndpr:admin.

  • Tenant identity comes only from server configuration.
  • Account subject, actor, role, reporter, and assessor identity comes only from verified server auth.
  • Anonymous consent and DSR use a scoped anon_<UUID> capability in X-NDPR-Subject-Id.
  • Every database lookup and write stays tenant-scoped, and mutation/audit writes remain atomic.

Which Package Should I Use?

NeedUseWhy
Drop-in UI@tantainnovative/ndpr-toolkit/presetsFastest way to ship consent, DSR, DPIA, breach, and policy screens.
Custom UI with toolkit logic@tantainnovative/ndpr-toolkit/hooksUse hooks and bring your own design system.
Server validation and scoring@tantainnovative/ndpr-toolkit/serverRSC-safe utilities with no React import graph.
Production persistence examples@tantainnovative/ndpr-recipesVersioned source templates for database schemas, adapters, and route handlers.

Recipe Inventory

AreaPathWhen to use it
Prisma schemaprisma/schema.prismaUse when your app already runs Prisma migrations.
Drizzle schemasrc/drizzle/schema.tsUse when your app owns schema changes through Drizzle Kit.
Next.js routessrc/nextjs/app-router/api/**Copy into App Router projects that need server-side persistence.
Express routessrc/express/**Mount in existing Node/Express APIs.
Storage adapterssrc/adapters/**Run tenant-scoped persistence behind your server API.
Consent middlewaresrc/nextjs/app-router/middleware.tsGate routes by consent state.

Module Coverage

ModuleBackend surfaceProduction purpose
ConsentConsent records, revocation, audit trailPersist active and historical consent snapshots.
DSRRequest intake, reference IDs, target datesTrack 30-day response workflows.
BreachIncident intake, lifecycle updates, NDPC readinessKeep 72-hour notification evidence visible.
DPIAAssessment metadata, risk score, approval statusStore Section 28 assessment evidence.
ROPAProcessing records and completeness checksMaintain records of processing activities.
ComplianceOperational indicators API routeExpose tenant-scoped record counts, evidence rates, and not-observed states to internal dashboards.
DCPMI / CAR utilitiesDesignation tier and audit return scheduleSupport GAID 2025 classification and filing planning.

Production Checklist

  • Pin both package versions in your lockfile before copying recipe source.
  • Configure a server-only tenant ID and test cross-tenant isolation.
  • Connect verified actor resolution; test anonymous subject, account subject, staff, and forbidden paths.
  • Keep actor, subject, tenant, reporter, assessor, and role authority out of request bodies and query strings.
  • Verify that business mutations and accountability events roll back together.
  • Review retention periods, audit-log fields, and breach escalation routing with counsel or your DPO.
  • Run migrations in staging and test consent revocation, DSR intake, breach and DPIA updates, and ROPA completeness.
  • Keep copied recipe files in your own source control so future changes are reviewed as normal app code.

Next Steps