npm.io
0.1.13 • Published 2d ago

@active-drizzle/core

Licence
MIT
Version
0.1.13
Deps
3
Size
2.1 MB
Vulns
0
Weekly
0

@active-drizzle/core

Rails-style ActiveRecord for Drizzle ORM. Associations, lifecycle hooks, dirty tracking, enum transforms, scopes, STI, and full TypeScript codegen via a Vite plugin.

@model('campaigns')
export class Campaign extends ApplicationRecord {
  static team   = belongsTo()
  static status = Attr.enum({ draft: 0, active: 1, paused: 2 } as const)

  @scope static active() { return this.where({ status: 1 }) }
  @pure isEditable() { return ['draft', 'paused'].includes(this.status) }
}

Full documentation →

Install

npm install @active-drizzle/core drizzle-orm

Part of ActiveDrizzle

Package What it is
@active-drizzle/core Models, associations, hooks, Attr, codegen, Vite plugin
@active-drizzle/controller CRUD controllers, oRPC, REST, multi-tenant
@active-drizzle/react React Query hooks, form integration, error parsing

MIT — Daniel Ackerman

Keywords