Generating Code
blix writes one file per call, from a template matching this framework’s own conventions. It never edits anything else — wiring a generated file into your app is always a separate, explicit step. This walks through generating a real route end to end, the same way it happened in hello-api.
1. Add the dependency
Section titled “1. Add the dependency”{ "devDependencies": { "@blixis-io/cli": "workspace:*" }}2. Generate
Section titled “2. Generate”pnpm exec blix generate controller healthcreated src/health/health.controller.tsimport { Controller, Get } from "@blixis-io/http";
@Controller("health")export class HealthController { @Get() list() { return []; }}3. Edit it into something real
Section titled “3. Edit it into something real”The generated file is a valid starting point, not a finished route — edit it like any other file you wrote yourself:
import { Controller, Get } from "@blixis-io/http";
@Controller("health")export class HealthController { @Get() list() { return []; } check() { return { status: "ok" }; }}4. Wire it in by hand
Section titled “4. Wire it in by hand”A single provider-less route doesn’t need its own module — list it directly in AppModule’s controllers:
import { Module } from "@blixis-io/core";import { HealthController } from "./health/health.controller.js";// ...other imports
@Module({ imports: [/* ... */], controllers: [HealthController],})export class AppModule {}(For a route with real providers/guards behind it, generate a module too and import that instead — see Modules.)
5. Verify it
Section titled “5. Verify it”curl localhost:3000/health# {"status":"ok"}Trying it dry first
Section titled “Trying it dry first”Add --dry-run to any command to see the path and content without writing anything — useful for checking what a name normalizes to:
blix generate service PostTags --dry-runWould create src/post-tags/post-tags.service.ts:
import { Injectable } from "@blixis-io/di";
@Injectable()export class PostTagsService {}- Every flag and template: reference.
- Why nothing gets auto-wired: Code Generation.