CLI Commands
Complete reference for all kodkod CLI commands and options.
CLI Commands
kodkod provides a simple but powerful CLI for scaffolding and managing your backend projects.
kodkod [project-name]
The main command to scaffold a new backend project.
Interactive Mode
Running the command without flags will launch an interactive wizard:
npx kodkod-stack@latest my-apiYou'll be guided through selecting:
- Framework: Express, Hono, or Fastify
- Database: PostgreSQL, MongoDB, or MySQL
- ORM: Prisma or Drizzle
Non-Interactive Mode (Flags)
For CI/CD pipelines or automation, you can pass all options via flags:
npx kodkod-stack@latest my-api \
--framework hono \
--database postgresql \
--orm drizzleAvailable Flags
| Flag | Description | Values |
|---|---|---|
--framework | Select the HTTP framework | express, hono, fastify |
--database | Select the database | postgresql, mongodb, mysql |
--orm | Select the ORM | prisma, drizzle |
-v, --version | Display the CLI version | - |
-h, --help | Display help information | - |
Examples
Scaffold with Express + Prisma + PostgreSQL
npx kodkod-stack@latest express-app --framework express --database postgresql --orm prismaScaffold with Hono + Drizzle + PostgreSQL
npx kodkod-stack@latest hono-app --framework hono --database postgresql --orm drizzleDisplay Version
npx kodkod-stack --versionkodkod add <module>
Add modules to an existing kodkod project.
Available Modules
| Module | Description |
|---|---|
auth | JWT-based authentication with register, login, and protected routes |
swagger | Swagger/OpenAPI documentation for your API endpoints |
test | Testing infrastructure with Vitest |
Example
cd my-api
npx kodkod-stack add authThis will:
- Add auth controller, service, and middleware files
- Update
package.jsonwithbcryptandjsonwebtoken - Add
JWT_SECRETto.env.example - Update Prisma schema with password field (if applicable)
See the Authentication Module guide for detailed setup instructions.
kodkod generate route <name>
Generate a complete CRUD route with controller, service, repository, and routes.
Alias: kodkod g route <name>
Usage
cd my-api
npx kodkod-stack generate route productGenerated Files
| File | Description |
|---|---|
src/controllers/<name>.controller.ts | HTTP request handlers |
src/services/<name>.service.ts | Business logic layer |
src/repositories/<name>.repository.ts | Data access layer |
src/routes/<name>.routes.ts | Route definitions with DI |
Example
npx kodkod-stack g route orderThis creates:
src/controllers/order.controller.tssrc/services/order.service.tssrc/repositories/order.repository.tssrc/routes/order.routes.ts
Next Steps After Generation
- Add the model to your Prisma/Drizzle schema
- Run migrations
- Implement repository methods
- Register routes in your main application
kodkod generate test <name>
Generate integration tests for an existing route.
Alias: kodkod g test <name>
Usage
cd my-api
npx kodkod-stack generate test productThis creates tests/integration/product.test.ts with tests for all CRUD endpoints.
You must run kodkod add test first to set up the testing infrastructure.
See the Testing Guide for more details.
