Operate & reference

CLI reference

Find exact commands for backend workflows: create, migrate, dev loops, install, build, and inspect.

damat — dev & modules (docs)

CommandDescription
damat create <name>Scaffold a durable app, collect PostgreSQL credentials, install, create DB, and migrate. Accepts --database-url or individual --database-* fields; setup/install/git can be deferred explicitly
damat clone <src> [dir]git clone with extras: github shorthand + #ref, subdirectory extraction, --fresh (new history), --name (package rename), --install, --depth. Overlays the system git — clear error if git is missing
damat devStart the dev server with hot reload
damat buildType-check with the installed local compiler (bun run tsc --noEmit), then bundle for production. Fails on any type error; --no-typecheck skips the check
damat startStart the production server
damat codegen <module> | --allUse the @damatjs/cli-codegen adapter to generate types + zod + registry and scaffold CRUD once. Name a module, or pass --all for every module in the config
damat barrel [dir]Recursively (re)write index.ts barrels so one bare import (@workflows) re-exports a whole tree (default src/workflows)
damat module add <src>Install from registry, local path, Git/GitHub, npm, or tarball through the transactional installer. Source mode is stable; package mode requires --experimental-package
damat module plan <src>Preview capability mapping, operations, warnings, and integration instructions without mutation
damat module remove <id>Remove installer-owned files/packages, back up confirmed modified owned files, and report remaining usage. Shared integration files stay user-owned
damat module update <id>Re-resolve the recorded origin and transactionally update installer-owned content
damat module listList installed modules
damat module init <name>Scaffold/install a standalone module, collect PostgreSQL credentials, create its development DB, and run module-scoped migration setup
damat module database:setupCreate the development database and apply only this module's migrations
damat module devProbe the port, create a required DB, migrate once, then supervise watched HTTP/local workers with graceful reload and unconditional readiness
damat module migration:createDiff models → migration (in a module)
damat module migration:runApply this module's migrations to DATABASE_URL (scoped to the module)
damat module migration:statusShow this module's applied vs pending migrations
damat module codegenGenerate types + zod + registry and scaffold CRUD once in a module package through @damatjs/module-generator
damat module validateContract + registry-readiness check
damat module buildRelease gate: local bun run tsc --noEmit + contract validation. --no-typecheck / --no-validate skip a step
damat kit add <src>Install any damat.json kit through the same source/package engine as modules
damat kit plan <src>Preview kit capability mapping and operations
damat kit listList kit records in damat.lock.json
damat kit update <id>Update a kit from its recorded origin
damat kit remove <id>Remove installer-owned kit content with modified-file safeguards
damat kit init [name]Describe the current codebase as a shareable kit by writing damat.json
damat kit validateValidate the universal kit profile

The global --verbose flag works before or after a command path. For example, both damat --verbose module dev and damat module dev --verbose expose the underlying stack for handled module failures.

damat-orm — migrations (docs)

CommandDescription
damat-orm database:setupCreate DB and apply migrations
damat-orm migrate:upApply pending migrations
damat-orm migrate:statusShow applied vs pending
damat-orm migrate:create <name>Create a migration
damat-orm migrate:listList modules with migrations

damat-orm is migrations-only. Use damat codegen <module> in an app or damat module codegen in a module package for type generation.

Both codegen commands are CLI adapters over @damatjs/module-generator. The generator uses @damatjs/schema-codegen for the pure ModuleSchema-to-TypeScript/Zod transformation. Application codegen externalizes pg-cloudflare while bundling damat.config.ts; consumers do not install that optional pg transport unless their own runtime selects it.

Scaffolding (docs)

Scaffolding lives in the damat CLI — damat create for apps and damat module init for standalone modules:

bunx @damatjs/damat-cli@latest create my-app        # app + .env + install + DB + all migrations
bunx @damatjs/damat-cli@latest module init my-mod   # module + .env + install + module DB