Overview
Drizzle CRUD logo

Drizzle CRUD

Type-safe CRUD operations, generated from your Drizzle schema.

Documentation

Most SaaS tables need the same work: create, read, update, delete, then list with search, filters, and pagination. That usually means a new query helper per feature — and soft deletes, validation, and access control get copied into every route.

Drizzle CRUD generates those operations from the tables you already have. Pass a Drizzle schema and you get typed create, findById, list, update, and delete, plus filter operators, full-text search, pagination, soft delete, and restore on one API.

Validation stays on Standard Schema (Zod and others) so inputs match the table. Actor-based access control and scope filters keep multi-tenant queries honest. Lifecycle hooks and bulk operations put the business rules next to the table instead of in every caller.

const users = createCrud(usersTable, {
  searchFields: ['name', 'email'],
  allowedFilters: ['isActive'],
  softDelete: { field: 'deletedAt' },
})

const page = await users.list({
  search: 'ada',
  filters: { isActive: true },
  page: 1,
  limit: 20,
})

Useful guides

  • Basic Usage
  • Core Operations
  • Advanced Filtering
  • Access Control
  • Lifecycle Hooks
  • Validation
  • Transactions

Version

0.1.4

Category

Data

Downloads

266 weekly

Last updated

a year ago

View sourceView on NPM