@diagramers/cli 4.0.16 β†’ 4.0.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,653 +1,837 @@
1
1
  # Diagramers CLI
2
2
 
3
- ## Version Command
3
+ A powerful command-line interface for managing Diagramers projects, generating modules, and extending functionality with a comprehensive template system.
4
4
 
5
- You can check the CLI version with:
6
-
7
- ```
8
- diagramers version
9
- diagramers -V
10
- diagramers api version
11
- diagramers admin version
12
- ```
5
+ ## πŸš€ Features
13
6
 
14
- ## Update Command
7
+ ### Core Capabilities
8
+ - **Project Initialization** - Create new projects from templates
9
+ - **Module Generation** - Generate complete modules with CRUD operations
10
+ - **Table Generation** - Add database tables to existing modules
11
+ - **Endpoint Generation** - Add custom endpoints to existing modules
12
+ - **Relation Management** - Generate database relations within modules
13
+ - **Feature Extension** - Add features to existing projects
14
+ - **Template Management** - Download and update project templates
15
+
16
+ ### Supported Templates
17
+ - **API Projects** - Full-featured Node.js API with TypeScript
18
+ - **Admin Projects** - Modern admin dashboard with React/Vue/Angular support
19
+ - **Custom Templates** - Extensible template system
20
+
21
+ ### Database Support
22
+ - **MongoDB** - Primary database with Mongoose schemas
23
+ - **SQL Databases** - MySQL, PostgreSQL, SQLite support
24
+ - **Schema Generation** - Automatic schema and relation creation
15
25
 
16
- You can update your project with:
26
+ ## πŸ“¦ Installation
17
27
 
28
+ ### Global Installation
29
+ ```bash
30
+ npm install -g @diagramers/cli
18
31
  ```
19
- diagramers update # (if supported at root)
20
- diagramers admin update # For admin projects (legacy and new)
21
- diagramers api update # For API projects (legacy and new)
32
+
33
+ ### Local Installation
34
+ ```bash
35
+ npm install @diagramers/cli
36
+ npx diagramers --help
22
37
  ```
23
38
 
24
- - For legacy projects, dependencies are updated as before.
25
- - For new projects, only modules are updated/added.
39
+ ## πŸš€ Quick Start
26
40
 
27
- ## Backward Compatibility
41
+ ```bash
42
+ # Install the CLI globally
43
+ npm install -g @diagramers/cli
44
+
45
+ # Create a new API project
46
+ diagramers init api my-new-api
47
+
48
+ # Navigate to the project
49
+ cd my-new-api
28
50
 
29
- All previous commands are supported. New features (API commands, module addition) are available without breaking old workflows.
51
+ # Set up environment variables
52
+ cp .env.example .env
30
53
 
31
- ## Usage Examples
54
+ # Install dependencies
55
+ npm install
32
56
 
57
+ # Start development
58
+ npm start
33
59
  ```
34
- # Show CLI version
35
- $ diagramers version
36
- $ diagramers api version
37
- $ diagramers admin version
38
60
 
39
- # Update admin project
40
- $ diagramers admin update
61
+ ## πŸ“‹ Commands
41
62
 
42
- # Update API project
43
- $ diagramers api update --modules odoo,notification
63
+ ### Project Management
64
+
65
+ #### Initialize New Project
66
+ ```bash
67
+ diagramers init <template-type> <project-name> [options]
44
68
  ```
45
69
 
46
- # @diagramers/cli
70
+ **Options:**
71
+ - `-v, --version <version>` - Specific version of the template to use (e.g., 1.1.17, latest)
72
+ - `-t, --template <template>` - Template version to use (deprecated, use --version)
73
+ - `-y, --yes` - Skip prompts and use defaults
47
74
 
48
- A powerful command-line interface for scaffolding and managing Diagramers projects. The CLI provides comprehensive tools for creating, managing, and extending API and admin dashboard projects with advanced features and automation.
75
+ **Examples:**
76
+ ```bash
77
+ # Create API project with latest version
78
+ diagramers init api my-api-project
49
79
 
50
- ## πŸš€ Features
80
+ # Create API project with specific version
81
+ diagramers init api my-api-project -v 1.1.17
51
82
 
52
- ### Project Management
53
- - **Project Scaffolding** - Create new API and admin projects from templates
54
- - **Template Management** - Manage and update project templates
55
- - **Project Initialization** - Automated project setup and configuration
56
- - **Environment Setup** - Automatic environment variable configuration
57
- - **Git Integration** - Automatic Git repository initialization
58
-
59
- ### Module & Feature Generation
60
- - **Module Generation** - Create complete modules with CRUD operations
61
- - **Table Generation** - Generate database tables with relationships
62
- - **Endpoint Generation** - Create custom API endpoints
63
- - **Relation Generation** - Set up database relationships (one-to-one, one-to-many, many-to-many)
64
- - **Feature Extension** - Extend existing modules with new functionality
65
-
66
- ### Database Management
67
- - **Database Seeding** - Generate and run database seeders
68
- - **Migration Support** - Create and manage database migrations
69
- - **Schema Generation** - Auto-generate database schemas
70
- - **Relationship Management** - Handle complex database relationships
71
- - **Data Validation** - Generate validation rules and schemas
72
-
73
- ### Development Tools
74
- - **Code Generation** - Generate TypeScript interfaces, services, and controllers
75
- - **API Documentation** - Auto-generate Swagger/OpenAPI documentation
76
- - **Testing Setup** - Generate test files and testing configurations
77
- - **Linting & Formatting** - Set up code quality tools
78
- - **Build Configuration** - Generate build and deployment configurations
79
-
80
- ### Authentication & Security
81
- - **Auth Module Generation** - Generate authentication modules
82
- - **Provider Integration** - Set up OAuth, SMS, and email providers
83
- - **Security Configuration** - Configure JWT, CORS, and security headers
84
- - **Role & Permission System** - Generate role-based access control
85
- - **Multi-factor Authentication** - Set up MFA providers
86
-
87
- ### Communication Services
88
- - **Email System Setup** - Configure email providers and templates
89
- - **SMS Integration** - Set up SMS providers for notifications
90
- - **Push Notifications** - Configure push notification services
91
- - **Webhook Management** - Set up webhook endpoints and handlers
92
-
93
- ### Deployment & DevOps
94
- - **Docker Configuration** - Generate Docker and Docker Compose files
95
- - **CI/CD Setup** - Create GitHub Actions and other CI/CD configurations
96
- - **Environment Management** - Manage multiple environment configurations
97
- - **Monitoring Setup** - Configure logging and monitoring tools
98
- - **Backup Configuration** - Set up automated backup systems
83
+ # Create admin project with specific version
84
+ diagramers admin init react-typescript my-admin-dashboard -v 1.0.0
85
+ ```
99
86
 
100
- ## πŸ“¦ Installation
87
+ #### Update Project
88
+
89
+ Update an existing project with the latest template features:
101
90
 
102
- ### Global Installation (Recommended)
103
91
  ```bash
104
- npm install -g @diagramers/cli
92
+ diagramers update [options]
105
93
  ```
106
94
 
107
- ### Local Installation
95
+ **Options:**
96
+ - `-v, --version <version>` - Specific version to update to (e.g., 1.1.27, latest)
97
+ - `-f, --force` - Force update even if conflicts detected
98
+ - `-b, --backup` - Create backup before updating
99
+
100
+ **Examples:**
108
101
  ```bash
109
- npm install @diagramers/cli
110
- npx diagramers-cli --help
102
+ # Update to latest version
103
+ diagramers update
104
+
105
+ # Update to specific version
106
+ diagramers update -v 1.1.27
107
+
108
+ # Force update (overwrite conflicts)
109
+ diagramers update --force
110
+
111
+ # Create backup before updating
112
+ diagramers update --backup
113
+
114
+ # Combine options
115
+ diagramers update -v 1.1.27 --backup --force
111
116
  ```
112
117
 
113
- ### Development Installation
118
+ #### What Gets Updated
119
+
120
+ The update command intelligently updates the following:
121
+
122
+ - **Core Files**: `src/core/`, `src/shared/`, `src/plugins/`
123
+ - **Configuration**: `config/` folder, `webpack.config.js`, `tsconfig.json`
124
+ - **Scripts**: `scripts/` folder with utility scripts
125
+ - **Documentation**: `README.md`, `DEVELOPER_GUIDE.md`
126
+ - **Environment**: `.env.example` template
127
+ - **Package.json**: Updates dependencies and scripts while preserving project-specific fields
128
+
129
+ #### Version Management
130
+
131
+ - **Automatic Version Sync**: Project version is updated to match template version
132
+ - **Project Preservation**: Project-specific fields (name, description, repository, etc.) are preserved
133
+ - **Conflict Detection**: Detects conflicts and allows force overwrite
134
+ - **Backup Support**: Creates timestamped backups before updating
135
+
136
+ #### Update Process
137
+
138
+ 1. **Validation**: Checks if current directory is a valid project
139
+ 2. **Version Check**: Shows current project version vs target version
140
+ 3. **Backup**: Creates backup if requested
141
+ 4. **Download**: Downloads latest template from npm
142
+ 5. **Conflict Check**: Identifies files with conflicts
143
+ 6. **Update**: Updates files while preserving project-specific settings
144
+ 7. **Cleanup**: Removes temporary files
145
+
146
+ #### Example Output
147
+
114
148
  ```bash
115
- git clone https://github.com/diagramers/diagramers-cli.git
116
- cd diagramers-cli
117
- npm install
118
- npm link
149
+ πŸ”„ Checking for template updates...
150
+ πŸ“¦ Current project version: 1.1.26
151
+ πŸ“Œ Updating to latest version
152
+ πŸ“¦ Downloading latest template: @diagramers/api
153
+ βœ… Template downloaded from npm: @diagramers/api
154
+ πŸ“ Updating project files...
155
+ βœ… Updated: src/core/config/index.ts
156
+ βœ… Updated: scripts/env-debug.js
157
+ βœ… Updated: package.json (version: 1.1.27)
158
+ βœ… Project updated successfully!
159
+ πŸ“¦ Template version: 1.1.27
160
+ πŸ“ Review the changes and test your application
161
+ πŸ’‘ Run "npm install" to update dependencies if needed
162
+ ```
163
+
164
+ #### List Available Versions
165
+ ```bash
166
+ diagramers versions [options]
119
167
  ```
120
168
 
121
- ## πŸ› οΈ Quick Start
169
+ **Options:**
170
+ - `-a, --all` - Show all versions (default: show last 10)
122
171
 
123
- ### 1. Create a New API Project
172
+ **Examples:**
124
173
  ```bash
125
- # Create a new API project
126
- diagramers init api my-api-project
174
+ # Show last 10 versions
175
+ diagramers versions
127
176
 
128
- # Navigate to the project
129
- cd my-api-project
177
+ # Show all available versions
178
+ diagramers versions --all
179
+ ```
130
180
 
131
- # Install dependencies
132
- npm install --legacy-peer-deps
181
+ ### Module Management
133
182
 
134
- # Start development server
135
- npm run dev
183
+ #### Generate Module
184
+ ```bash
185
+ diagramers extend --module <module-name> [options]
136
186
  ```
137
187
 
138
- ### 2. Create a New Admin Dashboard
188
+ **Examples:**
139
189
  ```bash
140
- # Create a new admin dashboard
141
- diagramers init admin my-admin-dashboard
142
-
143
- # Navigate to the project
144
- cd my-admin-dashboard
190
+ # Generate basic module
191
+ diagramers extend --module products
145
192
 
146
- # Install dependencies
147
- npm install --legacy-peer-deps
193
+ # Generate module with CRUD operations
194
+ diagramers extend --module products --crud
148
195
 
149
- # Start development server
150
- npm start
196
+ # Generate module with custom fields
197
+ diagramers extend --module products --fields name,price,description --crud
151
198
  ```
152
199
 
153
- ### 3. Generate Your First Module
200
+ ### Table Management
201
+
202
+ #### Add Table to Module
154
203
  ```bash
155
- # Generate a products module with CRUD operations
156
- diagramers extend --module products --crud
204
+ diagramers extend --table <module:table> --fields <field1,field2,...>
205
+ ```
157
206
 
207
+ **Examples:**
208
+ ```bash
158
209
  # Add categories table to products module
159
210
  diagramers extend --table products:categories --fields name,description,slug
160
211
 
161
212
  # Add products table to products module
162
- diagramers extend --table products:products --fields name,price,description,category_id
213
+ diagramers extend --table products:products --fields name,price,category_id
163
214
 
164
- # Create relationship between categories and products
165
- diagramers extend --relation products:category-product:one-to-many
215
+ # Add user profiles table to users module
216
+ diagramers extend --table users:profiles --fields bio,avatar,social_links
166
217
  ```
167
218
 
168
- ### 4. Add Custom Endpoints
169
- ```bash
170
- # Add search endpoint
171
- diagramers extend --endpoint products:search --method GET --description "Search products"
219
+ **Field Types (Auto-detected):**
220
+ - `name`, `title`, `description` β†’ String
221
+ - `email`, `phone` β†’ String
222
+ - `price`, `count`, `age` β†’ Number
223
+ - `created_at`, `updated_at` β†’ Date
224
+ - `is_active`, `verified` β†’ Boolean
225
+ - `*_id` β†’ ObjectId
226
+ - `status` β†’ Number
227
+
228
+ ### Endpoint Management
172
229
 
173
- # Add featured products endpoint
174
- diagramers extend --endpoint products:featured --method GET --description "Get featured products"
230
+ #### Add Endpoint to Module
231
+ ```bash
232
+ diagramers extend --endpoint <module:endpoint> [options]
175
233
  ```
176
234
 
177
- ## πŸ“š CLI Commands
235
+ **Examples:**
236
+ ```bash
237
+ # Add GET endpoint
238
+ diagramers extend --endpoint products:search --method GET
178
239
 
179
- ### Project Management Commands
240
+ # Add POST endpoint
241
+ diagramers extend --endpoint users:reset-password --method POST
180
242
 
181
- #### Initialize Projects
182
- ```bash
183
- # Initialize API project
184
- diagramers init api <project-name> [options]
243
+ # Add endpoint with custom path
244
+ diagramers extend --endpoint products:featured --method GET --path /featured --description "Get featured products"
245
+ ```
185
246
 
186
- # Initialize admin dashboard
187
- diagramers init admin <project-name> [options]
247
+ **Supported Methods:**
248
+ - `GET` - Retrieve data
249
+ - `POST` - Create data
250
+ - `PUT` - Update data
251
+ - `DELETE` - Delete data
188
252
 
189
- # Initialize both API and admin projects
190
- diagramers init <project-name> --api --admin
253
+ ### Relation Management
191
254
 
192
- # Initialize with specific template version
193
- diagramers init api <project-name> --version 4.0.1
255
+ #### Create Relations Within Module
256
+ ```bash
257
+ diagramers extend --relation <module:table1-table2[:type]>
194
258
  ```
195
259
 
196
- #### Project Options
260
+ **Examples:**
197
261
  ```bash
198
- # Initialize with custom configuration
199
- diagramers init api <project-name> \
200
- --database mongodb \
201
- --auth internal,oauth,sms \
202
- --email sendgrid \
203
- --deploy firebase
262
+ # One-to-many relation (default)
263
+ diagramers extend --relation products:category-product
264
+
265
+ # One-to-one relation
266
+ diagramers extend --relation users:user-profile:one-to-one
204
267
 
205
- # Initialize with specific features
206
- diagramers init api <project-name> \
207
- --features auth,email,sms,notifications,file-upload \
208
- --providers google,github,twilio,sendgrid
268
+ # Many-to-many relation
269
+ diagramers extend --relation products:product-tag:many-to-many
209
270
  ```
210
271
 
211
- ### Module Management Commands
272
+ **Relation Types:**
273
+ - `one-to-one` - Single record relations
274
+ - `one-to-many` - Parent-child relations (default)
275
+ - `many-to-many` - Junction table relations
212
276
 
213
- #### Generate Modules
277
+ ### Feature Management
278
+
279
+ #### List Available Features
214
280
  ```bash
215
- # Generate basic module
216
- diagramers extend --module <module-name>
281
+ diagramers extend --list
282
+ ```
217
283
 
218
- # Generate module with CRUD operations
219
- diagramers extend --module <module-name> --crud
284
+ #### Add Feature
285
+ ```bash
286
+ diagramers extend --feature <feature-name>
287
+ ```
220
288
 
221
- # Generate module with specific fields
222
- diagramers extend --module users --fields email,username,role,is_active --crud
289
+ ## 🎨 Admin Dashboard Management
223
290
 
224
- # Generate module with authentication
225
- diagramers extend --module auth --auth --providers internal,oauth,sms
291
+ The CLI provides comprehensive support for managing admin dashboard projects with modern frameworks and features.
226
292
 
227
- # Generate module with custom configuration
228
- diagramers extend --module products \
229
- --fields name,price,description,category_id \
230
- --crud \
231
- --validation \
232
- --tests \
233
- --docs
293
+ ### Admin Project Initialization
294
+
295
+ #### Initialize New Admin Project
296
+ ```bash
297
+ diagramers admin init <template-type> <project-name> [options]
234
298
  ```
235
299
 
236
- #### Module Options
300
+ **Template Types:**
301
+ - `react-typescript` - React 18 + TypeScript + Tailwind CSS
302
+ - `vue-typescript` - Vue 3 + TypeScript + Tailwind CSS
303
+ - `angular` - Angular 17 + TypeScript + Tailwind CSS
304
+
305
+ **Options:**
306
+ - `-f, --framework <framework>` - Framework to use (react, vue, angular)
307
+ - `-t, --template <template>` - Template package name
308
+ - `-v, --version <version>` - Template version to use
309
+ - `-y, --yes` - Skip prompts and use defaults
310
+ - `--typescript` - Use TypeScript (default: true)
311
+ - `--tailwind` - Use Tailwind CSS (default: true)
312
+ - `--api-url <url>` - API URL for the backend
313
+ - `--socket-url <url>` - Socket.IO URL for real-time features
314
+
315
+ **Examples:**
237
316
  ```bash
238
- # Generate with specific features
239
- diagramers extend --module <module-name> \
240
- --crud \
241
- --validation \
242
- --tests \
243
- --docs \
244
- --migrations \
245
- --seeders
317
+ # Create React admin project
318
+ diagramers admin init react-typescript my-admin-app
319
+
320
+ # Create Vue admin project with specific version
321
+ diagramers admin init vue-typescript my-vue-admin --version 1.0.0
246
322
 
247
- # Generate with custom paths
248
- diagramers extend --module <module-name> \
249
- --path src/modules/custom \
250
- --template custom-template
323
+ # Create Angular admin project with custom API URL
324
+ diagramers admin init angular my-angular-admin --api-url http://localhost:3000
325
+
326
+ # Create with all options
327
+ diagramers admin init react-typescript my-admin-app \
328
+ --framework react \
329
+ --typescript \
330
+ --tailwind \
331
+ --api-url http://localhost:3000 \
332
+ --socket-url http://localhost:3000
251
333
  ```
252
334
 
253
- ### Table Generation Commands
335
+ ### Admin Project Extension
254
336
 
255
- #### Generate Tables
337
+ #### Extend Admin Project
338
+ ```bash
339
+ diagramers admin extend [options]
340
+ ```
341
+
342
+ **Options:**
343
+ - `-p, --page <name>` - Generate a new page
344
+ - `-c, --component <name>` - Generate a new component
345
+ - `-s, --service <name>` - Generate a new service
346
+ - `-h, --hook <name>` - Generate a new custom hook
347
+ - `-m, --module <name>` - Generate a complete module with CRUD
348
+ - `--crud` - Include CRUD operations for module
349
+ - `--api` - Include API integration for module
350
+ - `--socket` - Include Socket.IO integration for module
351
+ - `--table` - Include data table for module
352
+ - `--form` - Include form components for module
353
+ - `--chart` - Include chart components for module
354
+ - `--auth` - Include authentication for module
355
+ - `--path <path>` - Custom path for generated files
356
+
357
+ **Examples:**
256
358
  ```bash
257
- # Add table to existing module
258
- diagramers extend --table <module>:<table> --fields <field1>,<field2>
359
+ # Generate a new module with CRUD operations
360
+ diagramers admin extend --module products --crud --api --table
361
+
362
+ # Generate a new page
363
+ diagramers admin extend --page analytics
259
364
 
260
- # Generate table with various field types
261
- diagramers extend --table users:profiles \
262
- --fields bio,avatar,birth_date,is_verified,preferences
365
+ # Generate a new component
366
+ diagramers admin extend --component ProductCard
263
367
 
264
- # Generate table with relationships
265
- diagramers extend --table products:categories \
266
- --fields name,description,slug,parent_id \
267
- --relations parent:categories:one-to-many
368
+ # Generate a new service
369
+ diagramers admin extend --service orderService
268
370
 
269
- # Generate table with indexes
270
- diagramers extend --table products:products \
271
- --fields name,price,description,category_id,sku \
272
- --indexes name,sku,category_id
371
+ # Generate a new custom hook
372
+ diagramers admin extend --hook useOrders
373
+
374
+ # Generate complete module with all features
375
+ diagramers admin extend --module orders --crud --api --socket --table --form --chart --auth
273
376
  ```
274
377
 
275
- #### Field Types
378
+ ### Admin Project Updates
379
+
380
+ #### Update Admin Project
276
381
  ```bash
277
- # String fields
278
- diagramers extend --table users:profiles \
279
- --fields name:string,email:string,phone:string
382
+ diagramers admin update [options]
383
+ ```
280
384
 
281
- # Numeric fields
282
- diagramers extend --table products:products \
283
- --fields price:number,stock:integer,rating:float
385
+ **Options:**
386
+ - `-t, --template <template>` - Template to update
387
+ - `-v, --version <version>` - Version to update to
388
+ - `--force` - Force update even if conflicts exist
389
+ - `--backup` - Create backup before updating
284
390
 
285
- # Date fields
286
- diagramers extend --table orders:orders \
287
- --fields created_at:date,updated_at:date,delivery_date:datetime
391
+ **Examples:**
392
+ ```bash
393
+ # Update to latest version
394
+ diagramers admin update
395
+
396
+ # Update to specific version
397
+ diagramers admin update --version 1.0.0
288
398
 
289
- # Boolean fields
290
- diagramers extend --table users:users \
291
- --fields is_active:boolean,email_verified:boolean
399
+ # Force update with backup
400
+ diagramers admin update --force --backup
401
+ ```
292
402
 
293
- # Object/JSON fields
294
- diagramers extend --table users:profiles \
295
- --fields preferences:object,metadata:json
403
+ ### Admin Version Management
296
404
 
297
- # Array fields
298
- diagramers extend --table products:products \
299
- --fields tags:array,images:array
405
+ #### Check Admin Version
406
+ ```bash
407
+ diagramers admin version [options]
300
408
  ```
301
409
 
302
- ### Endpoint Generation Commands
410
+ **Options:**
411
+ - `-c, --check <version>` - Check if specific version exists
303
412
 
304
- #### Generate Endpoints
413
+ **Examples:**
305
414
  ```bash
306
- # Add GET endpoint
307
- diagramers extend --endpoint <module>:<endpoint> --method GET
415
+ # Show current version info
416
+ diagramers admin version
308
417
 
309
- # Add POST endpoint with custom path
310
- diagramers extend --endpoint users:reset-password --method POST --path /reset-password
418
+ # Check specific version
419
+ diagramers admin version --check 1.0.0
420
+ ```
311
421
 
312
- # Add endpoint with validation
313
- diagramers extend --endpoint products:create --method POST \
314
- --validation name:required,price:required:number
422
+ #### List Available Admin Versions
423
+ ```bash
424
+ diagramers admin versions [options]
425
+ ```
315
426
 
316
- # Add endpoint with authentication
317
- diagramers extend --endpoint users:profile --method GET \
318
- --auth required --roles user,admin
427
+ **Options:**
428
+ - `-a, --all` - Show all versions (default: show last 10)
319
429
 
320
- # Add endpoint with custom logic
321
- diagramers extend --endpoint products:search --method GET \
322
- --description "Search products with filters" \
323
- --query name,price_min,price_max,category_id
430
+ **Examples:**
431
+ ```bash
432
+ # Show last 10 versions
433
+ diagramers admin versions
434
+
435
+ # Show all available versions
436
+ diagramers admin versions --all
437
+ ```
438
+
439
+ ### Admin Project Features
440
+
441
+ #### Available Templates
442
+ - **React TypeScript Admin** - React 18 + TypeScript + Tailwind CSS
443
+ - **Vue TypeScript Admin** - Vue 3 + TypeScript + Tailwind CSS
444
+ - **Angular Admin** - Angular 17 + TypeScript + Tailwind CSS
445
+
446
+ #### Built-in Features
447
+ - **Authentication System** - Login, register, password reset, JWT management
448
+ - **Dashboard** - Analytics overview, metric cards, chart widgets
449
+ - **User Management** - User CRUD, profiles, role management, activity tracking
450
+ - **Real-time Updates** - Socket.IO integration, live notifications
451
+ - **Data Tables** - Advanced filtering, sorting, pagination, bulk actions
452
+ - **Charts & Analytics** - Line, bar, pie, area charts with real-time data
453
+ - **Form Builder** - Dynamic forms, validation, file uploads, multi-step forms
454
+ - **File Upload** - Drag & drop, progress tracking, file preview
455
+ - **Notifications** - Toast notifications, notification center, push notifications
456
+ - **Settings Panel** - Application settings, user preferences, theme customization
457
+
458
+ #### Project Structure
459
+ ```
460
+ my-admin-app/
461
+ β”œβ”€β”€ src/
462
+ β”‚ β”œβ”€β”€ components/ # Reusable UI components
463
+ β”‚ β”‚ β”œβ”€β”€ ui/ # Base UI components
464
+ β”‚ β”‚ └── layout/ # Layout components
465
+ β”‚ β”œβ”€β”€ features/ # Feature modules
466
+ β”‚ β”‚ β”œβ”€β”€ auth/ # Authentication
467
+ β”‚ β”‚ β”œβ”€β”€ dashboard/ # Dashboard
468
+ β”‚ β”‚ β”œβ”€β”€ users/ # User management
469
+ β”‚ β”‚ └── [modules]/ # Generated modules
470
+ β”‚ β”œβ”€β”€ hooks/ # Custom React hooks
471
+ β”‚ β”œβ”€β”€ services/ # API services
472
+ β”‚ β”œβ”€β”€ lib/ # Utilities and configurations
473
+ β”‚ β”œβ”€β”€ types/ # TypeScript type definitions
474
+ β”‚ β”œβ”€β”€ styles/ # Global styles
475
+ β”‚ └── assets/ # Static assets
476
+ β”œβ”€β”€ public/ # Public assets
477
+ β”œβ”€β”€ package.json # Dependencies and scripts
478
+ β”œβ”€β”€ tsconfig.json # TypeScript configuration
479
+ β”œβ”€β”€ tailwind.config.js # Tailwind CSS configuration
480
+ β”œβ”€β”€ vite.config.ts # Vite configuration
481
+ └── .env # Environment variables
482
+ ```
483
+
484
+ ### Email System Management
485
+
486
+ #### Generate Email Module
487
+ ```bash
488
+ diagramers extend --module email --crud
324
489
  ```
325
490
 
326
- #### Endpoint Options
491
+ #### Add Email Configuration Table
327
492
  ```bash
328
- # Generate with specific features
329
- diagramers extend --endpoint <module>:<endpoint> \
330
- --method GET \
331
- --auth required \
332
- --roles admin \
333
- --validation \
334
- --tests \
335
- --docs \
336
- --rate-limit 100:1m
493
+ diagramers extend --table email:configs --fields provider,code,credentials,fromName,fromEmail,default
494
+ ```
337
495
 
338
- # Generate with custom response
339
- diagramers extend --endpoint products:featured \
340
- --method GET \
341
- --response "Product[]" \
342
- --description "Get featured products"
496
+ #### Add Email Templates Table
497
+ ```bash
498
+ diagramers extend --table email:templates --fields name,subject,body,isActive,createdAt
343
499
  ```
344
500
 
345
- ### Relationship Generation Commands
501
+ #### Add Email Logs Table
502
+ ```bash
503
+ diagramers extend --table email:logs --fields to,subject,status,provider,error,createdAt
504
+ ```
346
505
 
347
- #### Generate Relationships
506
+ #### Create Email Relations
348
507
  ```bash
349
- # One-to-many relation (default)
350
- diagramers extend --relation <module>:<relation-name>
508
+ # One-to-many: User to Email Configs
509
+ diagramers extend --relation email:user-config:one-to-many
351
510
 
352
- # One-to-one relation
353
- diagramers extend --relation users:user-profile:one-to-one
511
+ # One-to-many: Email Config to Email Logs
512
+ diagramers extend --relation email:config-log:one-to-many
513
+ ```
354
514
 
355
- # Many-to-many relation
356
- diagramers extend --relation products:product-tag:many-to-many
515
+ #### Add Email Endpoints
516
+ ```bash
517
+ # Send email endpoint
518
+ diagramers extend --endpoint email:send --method POST --description "Send email using configured provider"
357
519
 
358
- # Complex relationships
359
- diagramers extend --relation orders:order-items:one-to-many \
360
- --through products \
361
- --fields quantity,price
520
+ # Test email endpoint
521
+ diagramers extend --endpoint email:test --method POST --description "Test email configuration"
362
522
 
363
- # Self-referencing relationships
364
- diagramers extend --relation categories:parent-child:one-to-many \
365
- --self-referencing
523
+ # Get email statistics
524
+ diagramers extend --endpoint email:stats --method GET --description "Get email sending statistics"
366
525
  ```
367
526
 
368
- ### Authentication Commands
369
-
370
- #### Generate Auth Modules
527
+ #### Email Provider Setup Commands
371
528
  ```bash
372
- # Generate basic authentication
373
- diagramers extend --auth --providers internal
529
+ # Add Gmail SMTP configuration
530
+ diagramers extend --endpoint email:setup-gmail --method POST --description "Setup Gmail SMTP configuration"
374
531
 
375
- # Generate multi-provider authentication
376
- diagramers extend --auth --providers internal,oauth,sms,email
532
+ # Add SendGrid configuration
533
+ diagramers extend --endpoint email:setup-sendgrid --method POST --description "Setup SendGrid configuration"
377
534
 
378
- # Generate OAuth providers
379
- diagramers extend --auth --providers oauth \
380
- --oauth google,github,facebook,twitter
535
+ # Add AWS SES configuration
536
+ diagramers extend --endpoint email:setup-ses --method POST --description "Setup AWS SES configuration"
537
+ ```
381
538
 
382
- # Generate SMS authentication
383
- diagramers extend --auth --providers sms \
384
- --sms twilio,aws-sns,vonage
539
+ ### User Management System
385
540
 
386
- # Generate email authentication
387
- diagramers extend --auth --providers email \
388
- --email sendgrid,aws-ses,mailgun
541
+ #### Generate User Module
542
+ ```bash
543
+ diagramers extend --module users --crud
389
544
  ```
390
545
 
391
- #### Auth Configuration
546
+ #### Add User Profile Table
392
547
  ```bash
393
- # Generate with specific features
394
- diagramers extend --auth \
395
- --providers internal,oauth,sms \
396
- --features registration,login,logout,password-reset,email-verification \
397
- --oauth google,github \
398
- --sms twilio \
399
- --jwt \
400
- --refresh-tokens \
401
- --rate-limiting
548
+ diagramers extend --table users:profiles --fields bio,avatar,socialLinks,location,website,birthDate,preferences
402
549
  ```
403
550
 
404
- ### Communication Commands
551
+ #### Add User Sessions Table
552
+ ```bash
553
+ diagramers extend --table users:sessions --fields userId,deviceInfo,ipAddress,userAgent,isActive,lastActivity
554
+ ```
405
555
 
406
- #### Generate Email System
556
+ #### Add User Activity Table
407
557
  ```bash
408
- # Generate email module
409
- diagramers extend --email --providers sendgrid,aws-ses,mailgun
558
+ diagramers extend --table users:activities --fields userId,action,details,ipAddress,userAgent,timestamp
559
+ ```
410
560
 
411
- # Generate email templates
412
- diagramers extend --email-templates \
413
- --templates welcome,password-reset,verification,notification
561
+ #### Create User Relations
562
+ ```bash
563
+ # One-to-one: User to Profile
564
+ diagramers extend --relation users:user-profile:one-to-one
414
565
 
415
- # Generate email configuration
416
- diagramers extend --email-config \
417
- --providers sendgrid,aws-ses \
418
- --templates handlebars
566
+ # One-to-many: User to Sessions
567
+ diagramers extend --relation users:user-session:one-to-many
568
+
569
+ # One-to-many: User to Activities
570
+ diagramers extend --relation users:user-activity:one-to-many
419
571
  ```
420
572
 
421
- #### Generate SMS System
573
+ #### Add User Endpoints
422
574
  ```bash
423
- # Generate SMS module
424
- diagramers extend --sms --providers twilio,aws-sns,vonage
575
+ # User profile management
576
+ diagramers extend --endpoint users:profile --method GET --description "Get user profile"
577
+ diagramers extend --endpoint users:update-profile --method PUT --description "Update user profile"
578
+ diagramers extend --endpoint users:upload-avatar --method POST --description "Upload user avatar"
425
579
 
426
- # Generate SMS templates
427
- diagramers extend --sms-templates \
428
- --templates verification,notification,alert
580
+ # User administration
581
+ diagramers extend --endpoint users:list --method GET --description "List all users (admin)"
582
+ diagramers extend --endpoint users:create --method POST --description "Create user (admin)"
583
+ diagramers extend --endpoint users:update --method PUT --description "Update user (admin)"
584
+ diagramers extend --endpoint users:delete --method DELETE --description "Delete user (admin)"
429
585
 
430
- # Generate SMS configuration
431
- diagramers extend --sms-config \
432
- --providers twilio,aws-sns \
433
- --features verification,notifications
586
+ # User statistics
587
+ diagramers extend --endpoint users:stats --method GET --description "Get user statistics"
588
+ diagramers extend --endpoint users:activity --method GET --description "Get user activity"
434
589
  ```
435
590
 
436
- ### Database Commands
591
+ ## πŸ”§ Workflow Examples
592
+
593
+ ### Complete Product Management System
437
594
 
438
- #### Database Operations
439
595
  ```bash
440
- # Run database seeding
441
- diagramers db seed
596
+ # 1. Create new API project
597
+ diagramers init api ecommerce-api
598
+ cd ecommerce-api
442
599
 
443
- # Reset and reseed database
444
- diagramers db seed --reset
600
+ # 2. Generate products module
601
+ diagramers extend --module products --crud
445
602
 
446
- # Generate seeders for specific modules
447
- diagramers db seed --modules products,users
603
+ # 3. Add categories table
604
+ diagramers extend --table products:categories --fields name,description,slug
448
605
 
449
- # Create database migration
450
- diagramers db migrate --create <migration-name>
606
+ # 4. Add products table
607
+ diagramers extend --table products:products --fields name,price,description,category_id
451
608
 
452
- # Run database migrations
453
- diagramers db migrate --run
609
+ # 5. Create category-product relation
610
+ diagramers extend --relation products:category-product:one-to-many
454
611
 
455
- # Rollback migrations
456
- diagramers db migrate --rollback
612
+ # 6. Add custom search endpoint
613
+ diagramers extend --endpoint products:search --method GET --description "Search products"
614
+
615
+ # 7. Install dependencies and start
616
+ npm install
617
+ npm start
457
618
  ```
458
619
 
459
- #### Database Configuration
620
+ ### User Management with Profiles
621
+
460
622
  ```bash
461
- # Generate database configuration
462
- diagramers db config --type mongodb --connection-pool 10
623
+ # 1. Generate users module (if not exists)
624
+ diagramers extend --module users --crud
625
+
626
+ # 2. Add user profiles table
627
+ diagramers extend --table users:profiles --fields bio,avatar,social_links,birth_date
463
628
 
464
- # Generate database schemas
465
- diagramers db schemas --modules products,users,orders
629
+ # 3. Create user-profile relation
630
+ diagramers extend --relation users:user-profile:one-to-one
466
631
 
467
- # Generate database indexes
468
- diagramers db indexes --modules products --indexes name,price,category_id
632
+ # 4. Add profile endpoints
633
+ diagramers extend --endpoint users:update-profile --method PUT
634
+ diagramers extend --endpoint users:get-profile --method GET
469
635
  ```
470
636
 
471
- ### Testing Commands
637
+ ### Complete Email System Setup
472
638
 
473
- #### Generate Tests
474
639
  ```bash
475
- # Generate unit tests
476
- diagramers test --unit --modules products,users
477
-
478
- # Generate integration tests
479
- diagramers test --integration --modules products
640
+ # 1. Generate email module with CRUD operations
641
+ diagramers extend --module email --crud
480
642
 
481
- # Generate API tests
482
- diagramers test --api --endpoints products,users
643
+ # 2. Add email configurations table
644
+ diagramers extend --table email:configs --fields provider,code,credentials,fromName,fromEmail,default
483
645
 
484
- # Generate test configuration
485
- diagramers test --config --framework jest --coverage
486
- ```
646
+ # 3. Add email templates table
647
+ diagramers extend --table email:templates --fields name,subject,body,isActive,createdAt
487
648
 
488
- ### Documentation Commands
649
+ # 4. Add email logs table for tracking
650
+ diagramers extend --table email:logs --fields to,subject,status,provider,error,createdAt
489
651
 
490
- #### Generate Documentation
491
- ```bash
492
- # Generate API documentation
493
- diagramers docs api --format swagger --output docs/api
652
+ # 5. Create relationships
653
+ diagramers extend --relation email:user-config:one-to-many
654
+ diagramers extend --relation email:config-log:one-to-many
494
655
 
495
- # Generate module documentation
496
- diagramers docs modules --format markdown --output docs/modules
656
+ # 6. Add email-specific endpoints
657
+ diagramers extend --endpoint email:send --method POST --description "Send email using configured provider"
658
+ diagramers extend --endpoint email:test --method POST --description "Test email configuration"
659
+ diagramers extend --endpoint email:stats --method GET --description "Get email sending statistics"
497
660
 
498
- # Generate deployment documentation
499
- diagramers docs deployment --platforms docker,firebase --output docs/deployment
661
+ # 7. Add provider setup endpoints
662
+ diagramers extend --endpoint email:setup-gmail --method POST --description "Setup Gmail SMTP configuration"
663
+ diagramers extend --endpoint email:setup-sendgrid --method POST --description "Setup SendGrid configuration"
500
664
 
501
- # Generate README files
502
- diagramers docs readme --modules products,users --output docs
665
+ # 8. Install dependencies and start
666
+ npm install
667
+ npm start
503
668
  ```
504
669
 
505
- ### Documentation Templates
670
+ ### Complete User Management System Setup
671
+
506
672
  ```bash
507
- # Use custom documentation template
508
- diagramers docs --template custom-docs --output docs
673
+ # 1. Generate users module with CRUD operations
674
+ diagramers extend --module users --crud
509
675
 
510
- # Generate documentation for specific features
511
- diagramers docs --features auth,email,sms --output docs/features
512
- ```
676
+ # 2. Add user profiles table
677
+ diagramers extend --table users:profiles --fields bio,avatar,socialLinks,location,website,birthDate,preferences
513
678
 
514
- ## πŸ” Troubleshooting
679
+ # 3. Add user sessions table for tracking
680
+ diagramers extend --table users:sessions --fields userId,deviceInfo,ipAddress,userAgent,isActive,lastActivity
515
681
 
516
- ### Common Issues
682
+ # 4. Add user activity table for audit
683
+ diagramers extend --table users:activities --fields userId,action,details,ipAddress,userAgent,timestamp
517
684
 
518
- #### Project Generation Issues
519
- ```bash
520
- # Clear CLI cache
521
- diagramers cache clear
685
+ # 5. Create user relationships
686
+ diagramers extend --relation users:user-profile:one-to-one
687
+ diagramers extend --relation users:user-session:one-to-many
688
+ diagramers extend --relation users:user-activity:one-to-many
522
689
 
523
- # Update CLI to latest version
524
- npm update -g @diagramers/cli
690
+ # 6. Add user profile endpoints
691
+ diagramers extend --endpoint users:profile --method GET --description "Get user profile"
692
+ diagramers extend --endpoint users:update-profile --method PUT --description "Update user profile"
693
+ diagramers extend --endpoint users:upload-avatar --method POST --description "Upload user avatar"
525
694
 
526
- # Check template availability
527
- diagramers template list --available
695
+ # 7. Add user administration endpoints
696
+ diagramers extend --endpoint users:list --method GET --description "List all users (admin)"
697
+ diagramers extend --endpoint users:create --method POST --description "Create user (admin)"
698
+ diagramers extend --endpoint users:update --method PUT --description "Update user (admin)"
699
+ diagramers extend --endpoint users:delete --method DELETE --description "Delete user (admin)"
700
+
701
+ # 8. Add user analytics endpoints
702
+ diagramers extend --endpoint users:stats --method GET --description "Get user statistics"
703
+ diagramers extend --endpoint users:activity --method GET --description "Get user activity"
704
+
705
+ # 9. Install dependencies and start
706
+ npm install
707
+ npm start
528
708
  ```
529
709
 
530
- #### Module Generation Issues
531
- ```bash
532
- # Validate module configuration
533
- diagramers validate --module products
710
+ ## πŸ› οΈ Advanced Usage
534
711
 
535
- # Check field types
536
- diagramers validate --fields name:string,price:number
712
+ ### Database Seeding
537
713
 
538
- # Verify relationships
539
- diagramers validate --relation products:categories
540
- ```
714
+ All generated tables automatically include:
715
+ - **Sample data** - 3 sample records per table
716
+ - **Seeder integration** - Automatic database seeding
717
+ - **Development data** - Realistic test data
541
718
 
542
- #### Database Issues
543
719
  ```bash
544
- # Check database connection
545
- diagramers db check --connection
546
-
547
- # Validate database schema
548
- diagramers db validate --schema
720
+ # Run database seeding
721
+ npm run seed
549
722
 
550
- # Test database operations
551
- diagramers db test --operations
723
+ # Reset and reseed database
724
+ npm run seed --reset
552
725
  ```
553
726
 
554
- ### Debug Mode
555
- ```bash
556
- # Enable debug logging
557
- diagramers --debug init api my-project
727
+ ### Template Updates
558
728
 
559
- # Verbose output
560
- diagramers --verbose extend --module products
729
+ ```bash
730
+ # Update project with latest template
731
+ diagramers update
561
732
 
562
- # Dry run (preview changes)
563
- diagramers --dry-run extend --module products
733
+ # Force update with backup
734
+ diagramers update --force --backup
564
735
  ```
565
736
 
566
- ## 🀝 Contributing
737
+ ### Custom Field Types
567
738
 
568
- ### Development Setup
569
- ```bash
570
- # Clone repository
571
- git clone https://github.com/diagramers/diagramers-cli.git
572
- cd diagramers-cli
739
+ The CLI automatically detects field types based on naming conventions:
573
740
 
574
- # Install dependencies
575
- npm install
741
+ ```bash
742
+ # These fields will be auto-typed:
743
+ diagramers extend --table products:products --fields \
744
+ name,description,price,stock_count,created_at,is_active,category_id
745
+ ```
746
+
747
+ **Auto-detection:**
748
+ - `name`, `title`, `description` β†’ String
749
+ - `price`, `count`, `stock_count` β†’ Number
750
+ - `created_at`, `updated_at` β†’ Date
751
+ - `is_active`, `verified` β†’ Boolean
752
+ - `category_id`, `user_id` β†’ ObjectId
753
+
754
+ ## πŸ“š Project Structure
755
+
756
+ Generated projects follow this structure:
757
+
758
+ ```
759
+ my-project/
760
+ β”œβ”€β”€ src/
761
+ β”‚ β”œβ”€β”€ modules/
762
+ β”‚ β”‚ β”œβ”€β”€ products/
763
+ β”‚ β”‚ β”‚ β”œβ”€β”€ controllers/
764
+ β”‚ β”‚ β”‚ β”œβ”€β”€ entities/
765
+ β”‚ β”‚ β”‚ β”œβ”€β”€ schemas/
766
+ β”‚ β”‚ β”‚ β”œβ”€β”€ services/
767
+ β”‚ β”‚ β”‚ └── routes/
768
+ β”‚ β”‚ └── users/
769
+ β”‚ β”œβ”€β”€ core/
770
+ β”‚ β”‚ β”œβ”€β”€ database/
771
+ β”‚ β”‚ β”œβ”€β”€ config/
772
+ β”‚ β”‚ └── server/
773
+ β”‚ └── shared/
774
+ β”œβ”€β”€ scripts/
775
+ └── package.json
776
+ ```
576
777
 
577
- # Link for development
578
- npm link
778
+ ## πŸ” Troubleshooting
579
779
 
580
- # Run tests
581
- npm test
780
+ ### Common Issues
582
781
 
583
- # Build project
584
- npm run build
782
+ #### Module Not Found
783
+ ```bash
784
+ ❌ Module 'inventory' does not exist
785
+ ```
786
+ **Solution:** Create the module first:
787
+ ```bash
788
+ diagramers extend --module inventory
585
789
  ```
586
790
 
587
- ### Contributing Guidelines
588
- 1. Fork the repository
589
- 2. Create a feature branch
590
- 3. Make your changes
591
- 4. Add tests for new functionality
592
- 5. Ensure all tests pass
593
- 6. Submit a pull request
791
+ #### Table Already Exists
792
+ ```bash
793
+ ❌ Table 'products' already exists in module 'products'
794
+ ```
795
+ **Solution:** Use a different table name or check existing tables
594
796
 
595
- ### Code Style
797
+ #### Invalid Relation
798
+ ```bash
799
+ ❌ Table 'categories' does not exist in module 'products'
800
+ ```
801
+ **Solution:** Create both tables before creating relations:
596
802
  ```bash
597
- # Run linting
598
- npm run lint
803
+ diagramers extend --table products:categories --fields name,description
804
+ diagramers extend --table products:products --fields name,price
805
+ diagramers extend --relation products:category-product
806
+ ```
599
807
 
600
- # Fix linting issues
601
- npm run lint:fix
808
+ ### Getting Help
602
809
 
603
- # Format code
604
- npm run format
810
+ ```bash
811
+ # General help
812
+ diagramers --help
605
813
 
606
- # Type checking
607
- npm run type-check
814
+ # Command-specific help
815
+ diagramers init --help
816
+ diagramers extend --help
817
+ diagramers update --help
608
818
  ```
609
819
 
820
+ ## 🀝 Contributing
821
+
822
+ We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.
823
+
610
824
  ## πŸ“„ License
611
825
 
612
- MIT License - see LICENSE file for details
826
+ MIT License - see [LICENSE](LICENSE) file for details.
613
827
 
614
828
  ## πŸ”— Related Packages
615
829
 
616
- - [@diagramers/api](./diagramers-api) - Node.js API template
617
- - [@diagramers/admin](./diagramers-admin) - React admin dashboard template
830
+ - [@diagramers/api](https://npmjs.com/package/@diagramers/api) - API template package
831
+ - [@diagramers/admin](https://npmjs.com/package/@diagramers/admin) - Admin template package
618
832
 
619
833
  ## πŸ“ž Support
620
834
 
621
- For support and questions:
622
- - Create an issue on GitHub
623
- - Check the documentation
624
- - Review the examples in the codebase
625
- - Join our community discussions
626
-
627
- ## πŸ—ΊοΈ Roadmap
628
-
629
- ### Upcoming Features
630
- - [ ] GraphQL support
631
- - [ ] Microservices architecture
632
- - [ ] Kubernetes deployment
633
- - [ ] Advanced caching strategies
634
- - [ ] Real-time analytics
635
- - [ ] Advanced security features
636
- - [ ] Multi-tenant support
637
- - [ ] API versioning
638
- - [ ] Advanced rate limiting
639
- - [ ] Webhook system
640
-
641
- ### Plugin Ecosystem
642
- - [ ] Plugin marketplace
643
- - [ ] Community plugins
644
- - [ ] Plugin development tools
645
- - [ ] Plugin testing framework
646
- - [ ] Plugin documentation generator
647
-
648
- ### Integration Features
649
- - [ ] Third-party service integrations
650
- - [ ] Payment gateway integrations
651
- - [ ] Analytics integrations
652
- - [ ] Monitoring integrations
653
- - [ ] Backup service integrations
835
+ - **Issues**: [GitHub Issues](https://github.com/diagramers/diagramers-cli/issues)
836
+ - **Documentation**: [Official Docs](https://docs.diagramers.com)
837
+ - **Community**: [Discord Server](https://discord.gg/diagramers)