BlazeKit is a code generation tool designed to speed up your development workflow. With BlazeKit, you can automatically generate TypeScript types, database controllers, and Next.js API routes from a single schema file.
Install BlazeKit globally by running:
npm install blazekitGenerate the configuration file by running:
npx blazekit --create-configThis will create a .blazerc file in your project:
{
"database": "prisma",
"databaseName": "database_name",
"typesOutputDir": "src/types",
"controllersOutputDir": "src/controllers",
"apiRoutesOutputDir": "src/app/api"
}Create your models in a schema.blaze file. For example:
model User {
name: string
email: string
age: number
}Typically, you would create the schema.blaze file in src/blaze/schema.blaze for a Next.js app.
Run the following command to compile the schema:
npx blazekit schema.blazeAnd bam! That's it!
After compiling, BlazeKit generates:
-
src/controllers/User.controller.tsProgrammer.controller.ts
-
src/types/User.tsProgrammer.ts
Your code is now ready to be used!
Hit the ground running with BlazeKit and check out the docs for more details.