@drzl/generator-orpc
v2.9.1
Published
Readme
@drzl/generator-orpc
oRPC routers per table, with optional reuse of shared validation schemas.
💚 Sponsor DRZL
DRZL is crafted nights & weekends. Sponsorships keep the generators fast, tested, and free.
- Every dollar speeds up CI hardware and offsets long test runs on my aging laptop.
- Sponsors get roadmap input and priority responses in GitHub Issues.
- Prefer a quick overview? The current goals and thank-yous are at https://use-drzl.github.io/drzl/sponsor.
Use
Add to drzl.config.ts:
generators: [
{
kind: 'orpc',
template: '@drzl/template-orpc-service',
includeRelations: true,
validation: { library: 'valibot' },
databaseInjection: {
enabled: true,
databaseType: 'Database',
databaseTypeImport: { name: 'Database', from: 'src/db/db' },
},
servicesDir: 'src/services',
},
];Behavior
- Reuses pre-generated Insert/Update/Select schemas when
validation.useSharedis true. - Otherwise, inlines schemas using the chosen library (zod/valibot/arktype). TypeBox is not one of
them: this generator invents arguments such as a lookup by primary key and has no TypeBox
spelling for them. The Standard Schema half is no longer the obstacle, since
@drzl/generator-typebox'sstandardSchemaoption puts a real~standardon what it writes. - Works with templates for different wiring (service-backed, minimal, custom). With
@drzl/template-orpc-service, adbMiddlewareis emitted andcontext.dbis passed to services.
