Drizzle Castor is a type-safe CRUD library and Data Access Object (DAO) abstraction built on top of Drizzle ORM. It lets you query your database using intuitive JSON payloads, enforce access control through a built-in RBAC engine, intercept every operation via a Koa-style middleware pipeline, and run across PostgreSQL, MySQL, and SQLite without changing your application code.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/fajarnugraha37/drizzle-castor/llms.txt
Use this file to discover all available pages before exploring further.
Quickstart
Install Drizzle Castor and run your first type-safe query in under five minutes.
Installation
Install from npm or JSR across all major package managers and runtimes.
Schema Builder
Learn how to configure tables, relations, middleware, and policies with the builder API.
API Reference
Explore every public method, parameter type, and return value.
What Drizzle Castor provides
JSON-Based Querying
Filter, sort, and project relational data with expressive JSON payloads. The AST translator compiles them to dialect-correct Drizzle SQL automatically.
Unified RBAC
Enforce action-level and field-level access control at the repository layer — no scattered auth checks across your service code.
Middleware Pipeline
Intercept every database operation with Koa-style
(ctx, next) middleware. Add logging, tracing, caching, or multi-tenancy as composable layers.Multi-Dialect Support
Works across PostgreSQL, MySQL, and SQLite. Handles dialect-specific details like
RETURNING clauses and temporary table fallbacks transparently.Soft Deletes
Declare soft-delete behavior once on your table config. Safety filters are injected automatically into every query and join.
Safe Pagination
Paginate one-to-many relationships accurately using CTE Split Queries — no Cartesian fan-out, no off-by-one row counts.
Get started
Initialize the schema builder
Pass your Drizzle database instance and table definitions to
createSchemaBuilder.Drizzle Castor requires Drizzle ORM
^0.45.2 and TypeScript ^5. It runs on Bun 1.0+ and Node.js.