CliCommands

generate

Scaffold features, controllers, procedures, client schema, OpenAPI docs, and typed callers. Schema-aware generation with Prisma support.

igniter generate

The generate command scaffolds code from templates and schemas. It has six subcommands — each focused on a specific code generation task.

igniter generate <subcommand> [options]

Subcommands

SubcommandDescription
featureScaffold a complete feature module (controller + procedure + interfaces)
controllerScaffold a controller within an existing feature
procedureScaffold a procedure within an existing feature
docsGenerate an OpenAPI specification from your router
schemaGenerate a TypeScript client schema from your router
callerGenerate a typed Igniter Caller from an OpenAPI spec

generate feature

Creates a complete feature module — controllers, procedures, and interfaces. Can generate from a Prisma schema model for schema-aware, type-safe scaffolding.

igniter generate feature [name] [options]

Options

OptionTypeDescription
[name]stringFeature name (kebab-case). If omitted, prompts interactively
--schemastringGenerate from a schema provider (e.g., prisma:User)
--schema-pathstringCustom path to the schema file

Schema-Aware Generation

When you pass --schema prisma:User, the CLI:

  1. Finds the PrismaSchemaProvider in the schema provider registry
  2. Parses the prisma:User option → extracts modelName = "User"
  3. Validates that the User model exists in your Prisma schema
  4. Reads column names, types, and relations from the model
  5. Generates a controller with Zod-validated CRUD routes
  6. Generates procedures with Prisma queries matching your schema
  7. Generates interfaces with types derived from the model
# Schema-aware generation from a Prisma model
igniter generate feature users --schema prisma:User

# With a custom schema file path
igniter generate feature users --schema prisma:User --schema-path ./prisma/custom/schema.prisma

Empty Feature

Without --schema, the CLI generates an empty feature skeleton:

igniter generate feature products

This creates:

src/features/products/
├── controllers/
│   └── products.controller.ts    ← Empty controller with base scaffold
├── procedures/
│   └── .gitkeep
└── products.interfaces.ts        ← Empty interfaces file

Interactive Mode

When no name is provided, the CLI prompts interactively. If a Prisma schema is detected, it offers to generate from an available model:

igniter generate feature
# ? Generate from an available schema provider?
#   ○ No, create an empty feature
#   ● Prisma
# ? Which model would you like to scaffold?
#   ● User
#   ○ Post
#   ○ Comment

generate controller

Scaffolds a controller within an existing feature.

igniter generate controller [name] [options]

Options

OptionTypeDescription
[name]stringController name in kebab-case (e.g., profile)
-f, --featurestringTarget feature name
# Scaffold a profile controller inside the users feature
igniter generate controller profile --feature users

The generated controller uses the empty.controller.hbs template and exports a class with ControllerDisplayName and controllerRoute derived from the name.


generate procedure

Scaffolds a procedure within an existing feature. Removes the .gitkeep placeholder from the procedures directory.

igniter generate procedure [name] [options]

Options

OptionTypeDescription
[name]stringProcedure name in kebab-case (e.g., send-welcome-email)
-f, --featurestringTarget feature name
# Scaffold a send-welcome-email procedure inside the users feature
igniter generate procedure send-welcome-email --feature users

generate docs

Generates an OpenAPI 3.x specification from your Igniter router.

igniter generate docs [options]

Options

OptionTypeDefaultDescription
--routerstringsrc/igniter.router.tsPath to the router file
--outputstring./src/docsOutput directory for the OpenAPI spec
# Default paths
igniter generate docs

# Custom paths
igniter generate docs --router ./custom/igniter.router.ts --output ./public/api-docs

generate schema

Generates a TypeScript client schema from your Igniter router. This schema provides full type inference for client-side API calls.

igniter generate schema [options]

Options

OptionTypeDefaultDescription
--routerstringsrc/igniter.router.tsPath to the router file
--outputstringsrc/igniter.schema.tsOutput path for the schema file
# Default paths
igniter generate schema

# Custom output
igniter generate schema --output ./src/generated/api.schema.ts

generate caller

Generates a fully typed, Zod-validated Igniter Caller from any OpenAPI 3.x specification. The caller includes typed request methods, Zod schema validation, and automatic response parsing.

igniter generate caller [options]

Options

OptionTypeDescription
--namestringName prefix for generated schemas and caller export
--urlstringURL to a remote OpenAPI document
--pathstringLocal path to an OpenAPI document
--outputstringOutput directory (defaults to src/callers/<hostname>)

From a Remote URL

igniter generate caller --name stripe --url https://api.stripe.com/openapi.json

From a Local File

igniter generate caller --name internal --path ./openapi.json

Interactive Mode

Without --url or --path, the CLI prompts:

igniter generate caller
# ? Caller name (e.g., facebook, billing) stripe
# ? Where is your OpenAPI spec? Remote URL
# ? OpenAPI URL https://api.stripe.com/openapi.json

Generated Output

The command produces two files:

src/callers/api.stripe.com/
├── schema.ts    ← Zod schemas for all request/response types
└── index.ts     ← Preconfigured IgniterCaller instance

The schema file contains Zod schemas for every component in the OpenAPI spec. The caller file exports a preconfigured IgniterCaller with:

  • Base URL inferred from the OpenAPI servers[0].url or the source URL
  • All schemas registered in strict mode
  • Type-safe method calls for every path
// Generated index.ts
import { IgniterCaller } from "@igniter-js/caller";
import { stripeCallerSchemas } from "./schema";

export const stripeCaller = IgniterCaller.create()
  .withBaseUrl("https://api.stripe.com")
  .withSchemas(stripeCallerSchemas, { mode: "strict" })
  .build();

Only OpenAPI 3.x documents are supported. Swagger 2.0 documents must be converted first.


Template Engine

All generate subcommands use the Handlebars template engine. Templates are resolved from multiple candidate locations:

  1. packages/cli/templates/ (bundled with the CLI)
  2. node_modules/@igniter-js/new-cli/templates/ (installed dependency)
  3. ./templates/ (project-local overrides)

Custom Handlebars Helpers

The CLI registers custom helpers available in all templates:

HelperExampleOutput
includes{{#if (includes enabledAddOns "store")}}Boolean check
isEmpty{{#if (isEmpty enabledAddOns)}}Empty check
isDefined{{#if (isDefined addOnOptions.database)}}Defined check
join{{join addOnOptions.auth.plugins ", "}}"email, passkey, jwt"
capitalizeSlug{{capitalizeSlug projectName}}"My App"
get{{#if (get addOnOptions "database.orm")}}Nested access
eq{{#if (eq starter "nextjs")}}Equality check
camelCase{{camelCase "two-factor"}}"twoFactor"
filterPlugins{{#each (filterPlugins plugins)}}Iterate plugins
generatePluginImports{{{generatePluginImports plugins}}}Import statements

Next Steps