Quickstart

Create Your Configuration

First, let’s get your project set up by creating a configuration file with BlazeKit. Running the command below will generate a default config file that you can easily customize.

.blazerc

npx blazekit --create-config

Understanding the Configuration

Here’s an overview of the BlazeKit config file, which will look like this:

blazekit.config.json

{
  "database": "prisma",
  "databaseName": "database_name",
  "typesOutputDir": "src/types",
  "controllersOutputDir": "src/controllers",
  "apiRoutesOutputDir": "src/app/api"
}

Config Elements Breakdown

  • database Specifies the database you want to use (e.g., "prisma").
  • databaseName Your database name.
  • typesOutputDir Directory where your TypeScript types will be generated.
  • controllersOutputDir Directory where your database controller files will be placed.
  • apiRoutesOutputDir Directory for your API routes.

Create Your Schema

Next, you’ll want to create a schema.blaze file, which defines your data models and their structure. Here’s an example of a simple schema:

schema.blaze

model User {
  name: string;
  email: string;
  age: number;
}

Compile Your Schema

Once you’ve created your schema.blaze file, you can compile it using the following command:

bash

npx blazekit schema.blaze

This command will compile your schema.blaze file and generate the necessary TypeScript types and controller files based on your defined models. The output will be placed in the directories specified in yourblazekit.config.json file.

That’s It!

Once you’ve created the config and schema, you’re ready to generate your controllers and types, and BlazeKit will handle the rest. You’ll have a fully functional setup in no time.