A TypeSpec emitter that generates Drizzle ORM schema definitions and types from TypeSpec specifications. Learn about TypeSpec emitters here.
Important
Project Status: 🚧 This project is brand new. Use at your own risk.
This emitter allows you to define your database schema using TypeSpec's type-safe language and automatically generate Drizzle ORM schema files, enabling a single source of truth for your database schema definitions alongside other artifacts.
- Generate Drizzle schema definitions from TypeSpec models
- Type-safe database schema generation
- Support for common database types and constraints
- Integration with TypeSpec's existing ecosystem
bun add -D @omnidotdev/typespec-drizzle- Add the emitter to your TypeSpec configuration (
tspconfig.yaml):
emit:
- "@omnidotdev/typespec-drizzle"- Define your models in TypeSpec:
import "@omnidotdev/typespec-drizzle";
model User {
id: string;
email: string;
name: string;
createdAt: utcDateTime;
}
model Post {
id: string;
title: string;
content: string;
authorId: string;
publishedAt?: utcDateTime;
}- Run the TypeSpec compiler:
tsp compile .The emitter will generate Drizzle schema files in the output directory.
Use Tilt for a unified development experience:
tilt upor manually install and build:
bun install
bun run build # or `bun run build:watch`Tests can be run with bun test.
See Omni's contributing docs.
The code in this repository is licensed under MIT, © Omni LLC. See LICENSE.md for more information.
