Cursor-based pagination utility for Drizzle ORM supporting any number of cursors (primary + n secondary) with custom serialization, Base64 tokens, SQL expressions, and both query-builder and relational query APIs. Current stable version is 0.7.2, maintained actively with releases matching Drizzle ORM updates. Differentiators: multiple cursor support (beyond simple ID-based), flexible serialization, and compatibility with Drizzle 0.x and 1.0.0-beta (both query-builder and RQB v1/v2). Requires drizzle-orm >=0.33.0. Ships TypeScript types.
npm install drizzle-cursorNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows basic usage: cursor generation, first page query, subsequent page using last record, and token-based pagination for frontend.
Upgrade drizzle-orm to >=0.33.0
Avoid nullable columns in cursor config; use COALESCE or ensure NOT NULL constraints.
Call cursor.where() without argument for first page, pass last record for subsequent pages.
Always use `...cursor.orderBy` in the `.orderBy()` call.
Migrate to `db.query` (RQB v2) or use query-builder directly.
Run `npm install drizzle-cursor` and use dynamic import: `const { generateCursor } = await import('drizzle-cursor')` in CJS.Ensure you call `generateCursor(config)` first and that the returned object has `where` method.
Upgrade to latest drizzle-cursor (`npm install drizzle-cursor@latest`) and ensure types are resolved.
Call `cursor.where()` without argument for first page, or pass the last record object.