1- # @tbk/cli
1+ # @themuneebh-oss/tbk
22
33CLI tool for TypeScript Backend Toolkit projects. Generate modules, plugins, middleware, seeders, and factories with a single command.
44
@@ -7,13 +7,13 @@ CLI tool for TypeScript Backend Toolkit projects. Generate modules, plugins, mid
77This package is typically installed as a dev dependency in TypeScript Backend Toolkit projects:
88
99``` bash
10- pnpm add -D @tbk/cli
10+ pnpm add -D @themuneebh-oss/tbk
1111```
1212
1313Or via npm:
1414
1515``` bash
16- npm install -D @tbk/cli
16+ npm install -D @themuneebh-oss/tbk
1717```
1818
1919## Usage
@@ -52,9 +52,11 @@ pnpm tbk generate:module product --path /api/v1
5252```
5353
5454** Options:**
55+
5556- ` -p, --path <path> ` - API path prefix (default: ` /api ` )
5657
5758** Creates:**
59+
5860- ` src/modules/<name>/<name>.dto.ts ` - Zod schemas and TypeScript types
5961- ` src/modules/<name>/<name>.model.ts ` - Mongoose model
6062- ` src/modules/<name>/<name>.schema.ts ` - Request/response validation schemas
@@ -71,6 +73,7 @@ pnpm tbk generate:plugin cache
7173```
7274
7375** Creates:**
76+
7477- ` src/plugins/<name>/index.ts ` - Plugin factory and registration
7578
7679### generate: middleware
@@ -82,6 +85,7 @@ pnpm tbk generate:middleware rateLimiter
8285```
8386
8487** Creates:**
88+
8589- ` src/middlewares/<name>.ts ` - Middleware function
8690
8791### seed
@@ -106,6 +110,7 @@ pnpm tbk seed --force
106110```
107111
108112** Options:**
113+
109114- ` -g, --group <group> ` - Group to run (base|dev|test|demo) (default: ` dev ` )
110115- ` --only <names> ` - Comma-separated seeder names
111116- ` --fresh ` - Drop involved collections before seeding
@@ -124,12 +129,14 @@ pnpm tbk make:seeder product/Product --count 10 --unique slug
124129```
125130
126131** Options:**
132+
127133- ` -c, --count <number> ` - Default count for dev/test (default: ` 5 ` )
128134- ` -u, --unique <field> ` - Unique field to upsert by
129135- ` -d, --depends-on <names> ` - Comma-separated additional dependencies
130136- ` --model <export> ` - Model export name when not default
131137
132138** Creates:**
139+
133140- ` src/modules/<module>/seeders/<Name>Seeder.ts `
134141
135142** Note:** The seeder must be manually registered in ` src/seeders/registry.ts ` .
@@ -144,11 +151,13 @@ pnpm tbk make:factory product/Product --model ProductModel --use service
144151```
145152
146153** Options:**
154+
147155- ` --model <export> ` - Model export name when not default
148156- ` --use <service|model> ` - Prefer using service create function when present (default: ` service ` )
149- - ` --id-type <string|objectId> ` - Hint for _ id type when ambiguous
157+ - ` --id-type <string|objectId> ` - Hint for \ _ id type when ambiguous
150158
151159** Creates:**
160+
152161- ` src/modules/<module>/factories/<name>.factory.ts `
153162
154163## Requirements
@@ -160,6 +169,7 @@ pnpm tbk make:factory product/Product --model ProductModel --use service
160169## How It Works
161170
162171The CLI tool uses dynamic imports and model introspection to:
172+
163173- Analyze Mongoose schemas to detect fields, types, and relationships
164174- Generate type-safe code following project patterns
165175- Ensure consistency with existing codebase structure
185195
186196- [ Main Toolkit Repository] ( https://github.com/muneebhashone/typescript-backend-toolkit )
187197- [ Report Issues] ( https://github.com/muneebhashone/typescript-backend-toolkit/issues )
188-
0 commit comments