kodkodkodkod

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-api

You'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 drizzle

Available Flags

FlagDescriptionValues
--frameworkSelect the HTTP frameworkexpress, hono, fastify
--databaseSelect the databasepostgresql, mongodb, mysql
--ormSelect the ORMprisma, drizzle
-v, --versionDisplay the CLI version-
-h, --helpDisplay help information-

Examples

Scaffold with Express + Prisma + PostgreSQL

npx kodkod-stack@latest express-app --framework express --database postgresql --orm prisma

Scaffold with Hono + Drizzle + PostgreSQL

npx kodkod-stack@latest hono-app --framework hono --database postgresql --orm drizzle

Display Version

npx kodkod-stack --version

kodkod add <module>

Add modules to an existing kodkod project.

Available Modules

ModuleDescription
authJWT-based authentication with register, login, and protected routes
swaggerSwagger/OpenAPI documentation for your API endpoints
testTesting infrastructure with Vitest

Example

cd my-api
npx kodkod-stack add auth

This will:

  • Add auth controller, service, and middleware files
  • Update package.json with bcrypt and jsonwebtoken
  • Add JWT_SECRET to .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 product

Generated Files

FileDescription
src/controllers/<name>.controller.tsHTTP request handlers
src/services/<name>.service.tsBusiness logic layer
src/repositories/<name>.repository.tsData access layer
src/routes/<name>.routes.tsRoute definitions with DI

Example

npx kodkod-stack g route order

This creates:

  • src/controllers/order.controller.ts
  • src/services/order.service.ts
  • src/repositories/order.repository.ts
  • src/routes/order.routes.ts

Next Steps After Generation

  1. Add the model to your Prisma/Drizzle schema
  2. Run migrations
  3. Implement repository methods
  4. 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 product

This 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.

On this page