Registry / database / crudora

crudora

JSON →
library0.4.3jsnpmunverified

TypeScript framework for automatic CRUD API generation with Drizzle ORM and Express. Version 0.4.3 provides zero-configuration REST endpoints from decorated model classes, supporting PostgreSQL and MySQL. Key features: @Field() decorators with type validation (uuid, string, enum, json, etc.), advanced filtering (range, negation, LIKE, IN), offset and cursor pagination, soft delete, lifecycle hooks, transactional support, built-in Scalar API docs, health checks, graceful shutdown, and request timeout middleware. Compared to feathers.js or LoopBack, Crudora focuses specifically on Drizzle ORM and TypeScript with minimal boilerplate, shipping ESM/CJS dual builds and full type declarations. Maintenance status: active with regular releases.

npm install crudora
INSTALL
IMPORT
SIG · CRUDORA
C
crudora
databasejavascriptv0.4.3
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

CrudoraServer
✓ import { CrudoraServer } from 'crudora'
✗ const CrudoraServer = require('crudora').CrudoraServer
ESM default; also works with CommonJS via default export.
Model
✓ import { Model } from 'crudora'
✗ import Model from 'crudora'
Named export only. Never use default import for Model.
Field
✓ import { Field } from 'crudora'
✗ import { Field } from 'drizzle-orm'
Field is a decorator from crudora, not from Drizzle ORM.
Crudora
✓ import { Crudora } from 'crudora'
Alias for CrudoraServer; used interchangeably.

Creates a minimal CRUD API server with a User model and PostgreSQL database.

import { CrudoraServer, Model, Field } from 'crudora'; import { drizzle } from 'drizzle-orm/node-postgres'; import { Pool } from 'pg'; import 'dotenv/config'; const db = drizzle(new Pool({ connectionString: process.env.DATABASE_URL ?? '' })); class User extends Model { static schema = 'auth'; static tableName = 'users'; static hidden = ['password']; @Field({ type: 'uuid', primary: true }) id!: string; @Field({ type: 'string', required: true, unique: true, length: 255 }) email!: string; @Field({ type: 'string', required: true }) password!: string; } async function main() { const app = new CrudoraServer({ db, models: [User] }); const server = await app.listen(3000, () => console.log('Server running on http://localhost:3000')); process.on('SIGTERM', () => server.close(() => process.exit(0))); } main().catch(console.error);
Debug
Known issues
gotchaStatic properties (schema, tableName, hidden) must be defined as 'static' on Model subclass; forgetting 'static' will cause runtime errors because they are accessed on the class itself.
fix
Ensure schema, tableName, hidden are declared with 'static' keyword.
affects: >=0.0.0
gotchaDecorator @Field() is required on every property that should be a database column. Omitting @Field() will silently skip the property, causing missing columns in generated schema.
fix
Add @Field() decorator to all model properties that should be persisted.
affects: >=0.0.0
gotchaThe 'static schema' property must match an existing PostgreSQL schema name; if absent, defaults to 'public' for Postgres or 'dbo' for MySQL. Setting an invalid schema will cause query failures.
fix
Ensure the schema exists in your database, or omit static schema to use the default.
affects: >=0.0.0
deprecatedThe 'static tableName' property is recommended but not strictly required in v0.4.x; future versions may require it.
fix
Always define static tableName to avoid breaking changes.
affects: >=0.4.0 <0.5.0
gotchaBuilt-in API docs require installing @scalar/express-api-reference and setting docs: true in CrudoraServer options. Without both, the /docs endpoint will not be registered.
fix
Run 'npm install @scalar/express-api-reference' and pass { docs: true } to CrudoraServer constructor.
affects: >=0.4.0
Errors
Common errors & fixes
Error: Cannot find module 'crudora'
Package not installed or missing from node_modules.
fix
Run 'npm install crudora drizzle-orm'
Class extends value undefined is not a constructor or null
Import error: Model not imported correctly (default import instead of named).
fix
Use import { Model } from 'crudora'
TypeError: Cannot read properties of undefined (reading 'schema')
Static property 'schema' defined incorrectly (non-static or missing).
fix
Ensure 'static schema' is declared on the model class.
Upgrade
Version history
0.4.3latest on npm
Audit
Dependencies
drizzle-ormrequiredCore ORM dependency for all database operations
@scalar/express-api-referenceoptionalRequired for built-in API documentation (docs: true)
Agent activity
14 hits · last 30 days
node
10
OpenAI (training)
1
Resources
crudora — npm install crudora · libregistry