Drizzle Adapter v1.4.0 is the official Drizzle ORM adapter for Node-Casbin, enabling policy storage and retrieval from databases supported by Drizzle ORM (PostgreSQL, MySQL, SQLite, Turso, Neon, PlanetScale, Vercel Postgres, Xata, and more). It uses the Drizzle ORM query builder to interact with databases, providing type-safe and efficient policy management. The package follows the Casbin adapter interface and supports all core Casbin features (RBAC, ABAC, ACL). It requires casbin ^5.0.0 and drizzle-orm >=0.29.0. Active development, weekly releases, and full TypeScript support.
npm install drizzle-adapterNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Initializes a SQLite database, creates the casbin_rule table, creates a DrizzleAdapter, and performs a policy enforcement check.
Use await DrizzleAdapter.newAdapter({ db, table }) instead of new DrizzleAdapter()Import from drizzle-adapter: { casbinRuleSqlite } instead of 'casbinRule'Use const db = drizzle(poolOrClient) before passing to newAdapter
Always pass the table schema exported by drizzle-adapter: { casbinRuleSqlite, casbinRulePostgres, casbinRuleMysql }Use import syntax or dynamic import() instead of require()
Use 'await DrizzleAdapter.newAdapter({ db, table })'Use 'import DrizzleAdapter from "drizzle-adapter"' or set type: module in package.json
Run 'npm install drizzle-orm' or install the appropriate database driver
Pass the drizzle() returned object: const db = drizzle(poolOrClient)