@diagramers/cli 1.0.25 → 1.0.27
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 +239 -388
- package/dist/commands/extend.d.ts.map +1 -1
- package/dist/commands/extend.js +49 -10
- package/dist/commands/extend.js.map +1 -1
- package/dist/commands/init.js +1 -1
- package/dist/commands/init.js.map +1 -1
- package/dist/services/project-extender.d.ts +17 -0
- package/dist/services/project-extender.d.ts.map +1 -1
- package/dist/services/project-extender.js +677 -1
- package/dist/services/project-extender.js.map +1 -1
- package/dist/services/project-initializer.d.ts.map +1 -1
- package/dist/services/project-initializer.js +4 -3
- package/dist/services/project-initializer.js.map +1 -1
- package/dist/services/template-processor.js +1 -1
- package/dist/services/template-processor.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
@@ -1,504 +1,355 @@
|
|
1
|
-
#
|
1
|
+
# Diagramers CLI
|
2
2
|
|
3
|
-
A powerful command-line interface for
|
3
|
+
A powerful command-line interface for managing Diagramers projects, generating modules, and extending functionality with a comprehensive template system.
|
4
4
|
|
5
5
|
## 🚀 Features
|
6
6
|
|
7
|
-
|
8
|
-
- **
|
9
|
-
- **
|
10
|
-
- **Database
|
11
|
-
- **
|
7
|
+
### Core Capabilities
|
8
|
+
- **Project Initialization** - Create new projects from templates
|
9
|
+
- **Module Generation** - Generate complete modules with CRUD operations
|
10
|
+
- **Database Schema Generation** - Create tables and collections
|
11
|
+
- **Relation Management** - Generate database relations and references
|
12
|
+
- **Feature Extension** - Add features to existing projects
|
13
|
+
- **Template Management** - Download and update project templates
|
14
|
+
|
15
|
+
### Supported Templates
|
16
|
+
- **API Projects** - Full-featured Node.js API with TypeScript
|
17
|
+
- **Admin Projects** - Admin dashboard and management interfaces
|
18
|
+
- **Custom Templates** - Extensible template system
|
19
|
+
|
20
|
+
### Database Support
|
21
|
+
- **MongoDB** - Primary database with Mongoose schemas
|
22
|
+
- **SQL Databases** - MySQL, PostgreSQL, SQLite support
|
23
|
+
- **Schema Generation** - Automatic schema and relation creation
|
12
24
|
|
13
25
|
## 📦 Installation
|
14
26
|
|
27
|
+
### Global Installation
|
15
28
|
```bash
|
16
29
|
npm install -g @diagramers/cli
|
17
30
|
```
|
18
31
|
|
19
|
-
|
32
|
+
### Local Installation
|
33
|
+
```bash
|
34
|
+
npm install @diagramers/cli
|
35
|
+
npx diagramers --help
|
36
|
+
```
|
37
|
+
|
38
|
+
## 🚀 Quick Start
|
20
39
|
|
21
40
|
```bash
|
22
|
-
#
|
23
|
-
|
41
|
+
# Install the CLI globally
|
42
|
+
npm install -g @diagramers/cli
|
24
43
|
|
25
|
-
#
|
26
|
-
|
44
|
+
# Create a new API project
|
45
|
+
diagramers init api my-new-api
|
27
46
|
|
28
|
-
#
|
29
|
-
|
47
|
+
# Navigate to the project
|
48
|
+
cd my-new-api
|
30
49
|
|
31
|
-
#
|
32
|
-
|
33
|
-
|
50
|
+
# Set up environment variables
|
51
|
+
cp env.example .env.development
|
52
|
+
echo "NODE_ENV=development" >> .env.development
|
34
53
|
|
35
|
-
#
|
36
|
-
|
37
|
-
diagramers api generate:relation product brand
|
54
|
+
# Start development server
|
55
|
+
npm start
|
38
56
|
```
|
39
57
|
|
40
|
-
##
|
41
|
-
|
42
|
-
### Project Initialization
|
58
|
+
## 🛠️ Usage
|
43
59
|
|
60
|
+
### Initialize New Project
|
44
61
|
```bash
|
45
|
-
#
|
46
|
-
diagramers init api
|
62
|
+
# Initialize new API project
|
63
|
+
diagramers init api my-api-project
|
47
64
|
|
48
|
-
#
|
49
|
-
diagramers init admin
|
50
|
-
```
|
65
|
+
# Initialize new admin project
|
66
|
+
diagramers init admin my-admin-project
|
51
67
|
|
52
|
-
|
53
|
-
-
|
54
|
-
- Express.js server setup
|
55
|
-
- MongoDB with Mongoose
|
56
|
-
- Firebase Functions integration
|
57
|
-
- Socket.io for real-time features
|
58
|
-
- **Multi-Provider Authentication System** - Internal, Firebase, OAuth, SMS OTP, Email OTP
|
59
|
-
- Email and SMS services
|
60
|
-
- Audit logging
|
61
|
-
- Environment configurations with comprehensive auth settings
|
68
|
+
# Initialize with specific template version
|
69
|
+
diagramers init api my-project --template 1.0.0
|
62
70
|
|
63
|
-
|
71
|
+
# Skip prompts and use defaults
|
72
|
+
diagramers init api my-project --yes
|
73
|
+
```
|
74
|
+
|
75
|
+
**Important:** After initializing a project, remember to:
|
76
|
+
1. Copy `env.example` to `.env.development`
|
77
|
+
2. Set `NODE_ENV=development` in `.env.development`
|
78
|
+
3. Configure your database and other environment variables
|
64
79
|
|
80
|
+
### Generate Modules
|
65
81
|
```bash
|
66
|
-
#
|
67
|
-
diagramers
|
82
|
+
# Generate basic module
|
83
|
+
diagramers extend --module products
|
68
84
|
|
69
|
-
#
|
70
|
-
diagramers
|
85
|
+
# Generate module with CRUD operations
|
86
|
+
diagramers extend --module orders --crud
|
71
87
|
|
72
|
-
#
|
73
|
-
diagramers
|
88
|
+
# Generate module with custom fields
|
89
|
+
diagramers extend --module categories --fields name,description,slug
|
90
|
+
|
91
|
+
# Generate module with specific database type
|
92
|
+
diagramers extend --module users --type mongodb --fields email,username,role
|
74
93
|
```
|
75
94
|
|
76
|
-
###
|
95
|
+
### Generate Database Schemas
|
96
|
+
```bash
|
97
|
+
# Generate MongoDB collection
|
98
|
+
diagramers extend --table products --fields name,price,description
|
99
|
+
|
100
|
+
# Generate SQL table
|
101
|
+
diagramers extend --table orders --type mysql --fields customer_id,amount,status
|
77
102
|
|
103
|
+
# Generate PostgreSQL table
|
104
|
+
diagramers extend --table categories --type postgres --fields name,slug,parent_id
|
105
|
+
```
|
106
|
+
|
107
|
+
### Generate Database Relations
|
78
108
|
```bash
|
79
|
-
#
|
80
|
-
diagramers extend --
|
109
|
+
# Generate MongoDB relations
|
110
|
+
diagramers extend --relation user-posts --type mongodb
|
111
|
+
|
112
|
+
# Generate SQL relations
|
113
|
+
diagramers extend --relation product-categories --type mysql
|
114
|
+
```
|
81
115
|
|
82
|
-
|
116
|
+
### Add Features
|
117
|
+
```bash
|
118
|
+
# Add authentication feature
|
83
119
|
diagramers extend --feature auth
|
84
120
|
|
85
|
-
# Add email
|
121
|
+
# Add email notification feature
|
86
122
|
diagramers extend --feature email
|
87
123
|
|
88
|
-
# Add WebSocket
|
124
|
+
# Add WebSocket feature
|
89
125
|
diagramers extend --feature socket
|
90
126
|
|
91
|
-
# Add
|
127
|
+
# Add scheduled tasks feature
|
92
128
|
diagramers extend --feature cron
|
93
129
|
|
94
|
-
# Add audit logging
|
130
|
+
# Add audit logging feature
|
95
131
|
diagramers extend --feature audit
|
96
132
|
```
|
97
133
|
|
98
|
-
###
|
99
|
-
|
100
|
-
The CLI now supports the enhanced multi-provider authentication system:
|
101
|
-
|
102
|
-
- **Internal Authentication** - Email/password with configurable policies
|
103
|
-
- **Firebase Authentication** - Google Firebase integration
|
104
|
-
- **OAuth Providers** - Google, Facebook, GitHub, LinkedIn, Twitter
|
105
|
-
- **SMS OTP** - One-time passwords via SMS (Twilio/AWS SNS)
|
106
|
-
- **Email OTP** - One-time passwords via email
|
107
|
-
- **Session Management** - JWT tokens with refresh capabilities
|
108
|
-
- **Unified User Model** - Single user with multiple auth providers
|
109
|
-
|
110
|
-
All new projects include comprehensive authentication configuration with dummy values that developers can replace with their own credentials.
|
111
|
-
|
112
|
-
## 🔧 API Development Commands
|
113
|
-
|
114
|
-
### Generate Complete Module
|
115
|
-
|
116
|
-
Creates a full CRUD module with all layers:
|
117
|
-
|
134
|
+
### List Available Options
|
118
135
|
```bash
|
119
|
-
|
136
|
+
# List all available features and templates
|
137
|
+
diagramers extend --list
|
120
138
|
```
|
121
139
|
|
122
|
-
|
140
|
+
### Update Projects
|
123
141
|
```bash
|
124
|
-
|
125
|
-
|
142
|
+
# Update project structure
|
143
|
+
diagramers update
|
126
144
|
|
127
|
-
|
145
|
+
# Update with specific version
|
146
|
+
diagramers update --version 1.0.0
|
128
147
|
```
|
129
|
-
src/
|
130
|
-
├── entities/product.ts # TypeScript interface
|
131
|
-
├── schemas/product.ts # Mongoose schema
|
132
|
-
├── services/product-service.ts # Business logic
|
133
|
-
├── controllers/product-controller.ts # Request handlers
|
134
|
-
└── routes/product-routes.ts # API endpoints
|
135
|
-
```
|
136
|
-
|
137
|
-
**API Endpoints Created:**
|
138
|
-
- `GET /api/products` - List all products
|
139
|
-
- `GET /api/products/:id` - Get product by ID
|
140
|
-
- `POST /api/products` - Create new product
|
141
|
-
- `PUT /api/products/:id` - Update product
|
142
|
-
- `DELETE /api/products/:id` - Delete product
|
143
148
|
|
144
|
-
|
149
|
+
## 📁 Generated Module Structure
|
145
150
|
|
146
|
-
|
151
|
+
When you generate a module, the CLI creates a complete structure:
|
147
152
|
|
148
|
-
```bash
|
149
|
-
diagramers api generate:table <name>
|
150
153
|
```
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
154
|
+
src/modules/your-module/
|
155
|
+
├── entities/
|
156
|
+
│ └── your-module.entity.ts # TypeScript interfaces
|
157
|
+
├── schemas/
|
158
|
+
│ └── your-module.schema.ts # Database schemas
|
159
|
+
├── services/
|
160
|
+
│ └── your-module.service.ts # Business logic
|
161
|
+
├── controllers/
|
162
|
+
│ └── your-module.controller.ts # HTTP handlers
|
163
|
+
└── routes/
|
164
|
+
└── your-module.routes.ts # API routes
|
157
165
|
```
|
158
166
|
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
**Use Cases:**
|
167
|
-
- Lookup tables (categories, brands, statuses)
|
168
|
-
- Configuration tables (settings, preferences)
|
169
|
-
- Reference data (countries, currencies)
|
170
|
-
- Internal data models
|
171
|
-
|
172
|
-
### Generate Table Relationships
|
167
|
+
### Generated Files Include:
|
168
|
+
- **Entities** - TypeScript interfaces with CRUD operations
|
169
|
+
- **Schemas** - Database schemas with validation and indexes
|
170
|
+
- **Services** - Business logic with Result model integration
|
171
|
+
- **Controllers** - HTTP handlers with Swagger documentation
|
172
|
+
- **Routes** - Express routes with proper binding
|
173
173
|
|
174
|
-
|
174
|
+
## 🔧 Configuration
|
175
175
|
|
176
|
+
### Template Configuration
|
177
|
+
The CLI uses npm packages for templates:
|
178
|
+
- `@diagramers/api` - API project template
|
179
|
+
- `@diagramers/admin` - Admin project template
|
180
|
+
|
181
|
+
### Custom Templates
|
182
|
+
You can create custom templates by:
|
183
|
+
1. Creating a package with the template structure
|
184
|
+
2. Publishing to npm with `@diagramers/` prefix
|
185
|
+
3. Using the template with `--template` flag
|
186
|
+
|
187
|
+
## 📋 Available Features
|
188
|
+
|
189
|
+
### Authentication Features
|
190
|
+
- **Internal Auth** - Username/password with JWT
|
191
|
+
- **Firebase Auth** - Google Firebase integration
|
192
|
+
- **OAuth Providers** - Google, GitHub, Facebook
|
193
|
+
- **SMS OTP** - Twilio, AWS SNS integration
|
194
|
+
- **Email OTP** - Email-based verification
|
195
|
+
|
196
|
+
### Communication Features
|
197
|
+
- **Email System** - Nodemailer with templates
|
198
|
+
- **SMS System** - Twilio integration
|
199
|
+
- **WebSocket** - Real-time communication
|
200
|
+
- **Push Notifications** - Firebase messaging
|
201
|
+
|
202
|
+
### System Features
|
203
|
+
- **Cron Jobs** - Scheduled task system
|
204
|
+
- **Audit Logging** - Activity tracking
|
205
|
+
- **File Upload** - File management system
|
206
|
+
- **Caching** - Redis integration
|
207
|
+
|
208
|
+
## 🗄️ Database Support
|
209
|
+
|
210
|
+
### MongoDB (Default)
|
176
211
|
```bash
|
177
|
-
|
212
|
+
# Generate MongoDB collection
|
213
|
+
diagramers extend --table products --type mongodb --fields name,price,category
|
178
214
|
```
|
179
215
|
|
180
|
-
|
181
|
-
- `one-to-one` (default)
|
182
|
-
- `one-to-many`
|
183
|
-
- `many-to-many`
|
184
|
-
|
185
|
-
**Examples:**
|
216
|
+
### SQL Databases
|
186
217
|
```bash
|
187
|
-
#
|
188
|
-
diagramers
|
218
|
+
# MySQL table
|
219
|
+
diagramers extend --table orders --type mysql --fields customer_id,amount,status
|
189
220
|
|
190
|
-
#
|
191
|
-
diagramers
|
221
|
+
# PostgreSQL table
|
222
|
+
diagramers extend --table users --type postgres --fields email,username,role
|
192
223
|
|
193
|
-
#
|
194
|
-
diagramers
|
224
|
+
# SQLite table
|
225
|
+
diagramers extend --table settings --type sqlite --fields key,value
|
195
226
|
```
|
196
227
|
|
197
|
-
|
198
|
-
- Updates entity interfaces with relationship fields
|
199
|
-
- Updates schemas with references and indexes
|
200
|
-
- Adds population methods to services
|
201
|
-
- Updates database context
|
202
|
-
|
203
|
-
### Process Template
|
204
|
-
|
205
|
-
Customize your project for different environments:
|
206
|
-
|
228
|
+
### Relations
|
207
229
|
```bash
|
208
|
-
|
209
|
-
|
230
|
+
# One-to-Many relations
|
231
|
+
diagramers extend --relation user-posts --type mongodb
|
210
232
|
|
211
|
-
|
212
|
-
|
213
|
-
diagramers api process:template ecommerce-production
|
214
|
-
```
|
215
|
-
|
216
|
-
**What it updates:**
|
217
|
-
- Package.json name and description
|
218
|
-
- README.md title and description
|
219
|
-
- Database names in configuration files
|
220
|
-
- Environment-specific settings
|
221
|
-
- Creates .env.example template
|
222
|
-
|
223
|
-
## 🏗️ Project Structure
|
224
|
-
|
225
|
-
After using the CLI, your project will have this structure:
|
226
|
-
|
227
|
-
```
|
228
|
-
src/
|
229
|
-
├── entities/ # TypeScript interfaces
|
230
|
-
│ ├── user.ts
|
231
|
-
│ ├── product.ts
|
232
|
-
│ └── category.ts
|
233
|
-
├── schemas/ # Mongoose schemas
|
234
|
-
│ ├── user.ts
|
235
|
-
│ ├── product.ts
|
236
|
-
│ └── category.ts
|
237
|
-
├── services/ # Business logic layer
|
238
|
-
│ ├── user-service.ts
|
239
|
-
│ ├── product-service.ts
|
240
|
-
│ └── category-service.ts
|
241
|
-
├── controllers/ # Request handlers
|
242
|
-
│ ├── user-controller.ts
|
243
|
-
│ ├── product-controller.ts
|
244
|
-
│ └── category-controller.ts
|
245
|
-
├── routes/ # API endpoints
|
246
|
-
│ ├── user-routes.ts
|
247
|
-
│ ├── product-routes.ts
|
248
|
-
│ ├── category-routes.ts
|
249
|
-
│ └── index.ts
|
250
|
-
├── helpers/ # Utilities and helpers
|
251
|
-
│ ├── dbcontext.ts # Database context
|
252
|
-
│ ├── auth.ts
|
253
|
-
│ ├── mailer.ts
|
254
|
-
│ └── result.ts
|
255
|
-
└── config/ # Environment configurations
|
256
|
-
├── development.ts
|
257
|
-
├── staging.ts
|
258
|
-
└── production.ts
|
233
|
+
# Many-to-Many relations
|
234
|
+
diagramers extend --relation product-categories --type mysql
|
259
235
|
```
|
260
236
|
|
261
|
-
##
|
237
|
+
## 🔌 Plugin System
|
262
238
|
|
263
|
-
|
239
|
+
The CLI supports plugin generation for extending functionality:
|
264
240
|
|
241
|
+
### Generate Plugin
|
265
242
|
```bash
|
266
|
-
#
|
267
|
-
diagramers
|
268
|
-
cd ecommerce-api
|
269
|
-
|
270
|
-
# 2. Generate main entities with full CRUD
|
271
|
-
diagramers api generate:module product
|
272
|
-
diagramers api generate:module user
|
273
|
-
diagramers api generate:module order
|
274
|
-
|
275
|
-
# 3. Generate supporting tables
|
276
|
-
diagramers api generate:table category
|
277
|
-
diagramers api generate:table brand
|
278
|
-
diagramers api generate:table tag
|
279
|
-
diagramers api generate:table shipping_method
|
280
|
-
diagramers api generate:table payment_method
|
281
|
-
|
282
|
-
# 4. Create relationships
|
283
|
-
diagramers api generate:relation product category one-to-many
|
284
|
-
diagramers api generate:relation product brand one-to-many
|
285
|
-
diagramers api generate:relation product tag many-to-many
|
286
|
-
diagramers api generate:relation order user one-to-many
|
287
|
-
diagramers api generate:relation order shipping_method one-to-one
|
288
|
-
|
289
|
-
# 5. Customize for production
|
290
|
-
diagramers api process:template ecommerce-production
|
291
|
-
```
|
292
|
-
|
293
|
-
### Blog API Development
|
243
|
+
# Generate plugin structure
|
244
|
+
diagramers extend --plugin my-plugin
|
294
245
|
|
295
|
-
|
296
|
-
|
297
|
-
diagramers init api blog-api
|
298
|
-
cd blog-api
|
299
|
-
|
300
|
-
# 2. Generate main entities
|
301
|
-
diagramers api generate:module post
|
302
|
-
diagramers api generate:module user
|
303
|
-
diagramers api generate:module comment
|
304
|
-
|
305
|
-
# 3. Generate supporting tables
|
306
|
-
diagramers api generate:table category
|
307
|
-
diagramers api generate:table tag
|
308
|
-
|
309
|
-
# 4. Create relationships
|
310
|
-
diagramers api generate:relation post user one-to-many
|
311
|
-
diagramers api generate:relation post category one-to-many
|
312
|
-
diagramers api generate:relation post tag many-to-many
|
313
|
-
diagramers api generate:relation comment post one-to-many
|
314
|
-
diagramers api generate:relation comment user one-to-many
|
246
|
+
# Generate plugin with configuration
|
247
|
+
diagramers extend --plugin payment-gateway --config stripe,paypal
|
315
248
|
```
|
316
249
|
|
317
|
-
##
|
250
|
+
## 📚 Examples
|
318
251
|
|
319
|
-
###
|
252
|
+
### Complete E-commerce Module
|
253
|
+
```bash
|
254
|
+
# Generate products module
|
255
|
+
diagramers extend --module products --crud --fields name,price,description,category,stock
|
320
256
|
|
321
|
-
|
322
|
-
|
323
|
-
interface IProduct {
|
324
|
-
_id: ObjectId;
|
325
|
-
name: string;
|
326
|
-
_categoryId: ObjectId; // Reference to category (with _ prefix)
|
327
|
-
category?: ICategory; // Populated field
|
328
|
-
}
|
257
|
+
# Generate orders module
|
258
|
+
diagramers extend --module orders --crud --fields customer_id,products,total,status
|
329
259
|
|
330
|
-
|
331
|
-
|
332
|
-
name: string;
|
333
|
-
products?: IProduct[]; // Virtual field
|
334
|
-
}
|
335
|
-
```
|
260
|
+
# Generate categories module
|
261
|
+
diagramers extend --module categories --crud --fields name,description,parent_id
|
336
262
|
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
// Product has many Tags
|
341
|
-
interface IProduct {
|
342
|
-
_id: ObjectId;
|
343
|
-
name: string;
|
344
|
-
_tagIds: ObjectId[]; // Array of references (with _ prefix)
|
345
|
-
tags?: ITag[]; // Populated field
|
346
|
-
}
|
347
|
-
|
348
|
-
interface ITag {
|
349
|
-
_id: ObjectId;
|
350
|
-
name: string;
|
351
|
-
_productIds: ObjectId[]; // Array of references (with _ prefix)
|
352
|
-
products?: IProduct[]; // Virtual field
|
353
|
-
}
|
263
|
+
# Generate relations
|
264
|
+
diagramers extend --relation product-category --type mongodb
|
265
|
+
diagramers extend --relation order-product --type mongodb
|
354
266
|
```
|
355
267
|
|
356
|
-
###
|
357
|
-
|
358
|
-
```typescript
|
359
|
-
// User has one Profile
|
360
|
-
interface IUser {
|
361
|
-
_id: ObjectId;
|
362
|
-
email: string;
|
363
|
-
_profileId: ObjectId; // Reference to profile (with _ prefix)
|
364
|
-
profile?: IProfile; // Populated field
|
365
|
-
}
|
366
|
-
|
367
|
-
interface IProfile {
|
368
|
-
_id: ObjectId;
|
369
|
-
firstName: string;
|
370
|
-
lastName: string;
|
371
|
-
_userId: ObjectId; // Reference back to user (with _ prefix)
|
372
|
-
user?: IUser; // Populated field
|
373
|
-
}
|
374
|
-
```
|
375
|
-
|
376
|
-
## 🛠️ Development Workflow
|
377
|
-
|
378
|
-
### 1. Project Setup
|
268
|
+
### User Management System
|
379
269
|
```bash
|
380
|
-
#
|
381
|
-
diagramers
|
382
|
-
cd my-api
|
270
|
+
# Generate users module
|
271
|
+
diagramers extend --module users --crud --fields email,username,role,status
|
383
272
|
|
384
|
-
#
|
385
|
-
|
273
|
+
# Generate profiles module
|
274
|
+
diagramers extend --module profiles --crud --fields user_id,first_name,last_name,avatar
|
386
275
|
|
387
|
-
#
|
388
|
-
|
389
|
-
```
|
276
|
+
# Generate permissions module
|
277
|
+
diagramers extend --module permissions --crud --fields name,description,resource
|
390
278
|
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
diagramers api generate:module product
|
279
|
+
# Generate relations
|
280
|
+
diagramers extend --relation user-profile --type mongodb
|
281
|
+
diagramers extend --relation user-permissions --type mongodb
|
282
|
+
```
|
396
283
|
|
397
|
-
|
398
|
-
diagramers api generate:table category
|
399
|
-
diagramers api generate:table brand
|
284
|
+
## 🚀 Advanced Usage
|
400
285
|
|
401
|
-
|
402
|
-
|
403
|
-
|
286
|
+
### Custom Field Types
|
287
|
+
```bash
|
288
|
+
# Generate with different field types
|
289
|
+
diagramers extend --module products --fields name:string,price:number,active:boolean,created:date
|
404
290
|
```
|
405
291
|
|
406
|
-
###
|
292
|
+
### Nested Modules
|
407
293
|
```bash
|
408
|
-
#
|
409
|
-
|
410
|
-
curl http://localhost:4000/api/categories
|
294
|
+
# Generate nested module structure
|
295
|
+
diagramers extend --module admin/users --crud --fields email,role,permissions
|
411
296
|
```
|
412
297
|
|
413
|
-
###
|
298
|
+
### API Documentation
|
414
299
|
```bash
|
415
|
-
#
|
416
|
-
diagramers api
|
417
|
-
|
418
|
-
# Build and deploy
|
419
|
-
npm run build:prod
|
420
|
-
npm run deploy
|
300
|
+
# Generate with enhanced Swagger docs
|
301
|
+
diagramers extend --module api/products --crud --swagger --fields name,price,description
|
421
302
|
```
|
422
303
|
|
423
|
-
## 🔧
|
304
|
+
## 🔧 Development
|
424
305
|
|
425
|
-
###
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
# Server Configuration
|
431
|
-
PORT=4000
|
432
|
-
HOST=localhost
|
433
|
-
|
434
|
-
# Database Configuration
|
435
|
-
MONGODB_URI=mongodb://127.0.0.1:27017/my-api-development
|
306
|
+
### Local Development
|
307
|
+
```bash
|
308
|
+
# Clone the repository
|
309
|
+
git clone https://github.com/diagramers/diagramers-cli.git
|
310
|
+
cd diagramers-cli
|
436
311
|
|
437
|
-
#
|
438
|
-
|
439
|
-
FIREBASE_AUTH_DOMAIN=your-project.firebaseapp.com
|
312
|
+
# Install dependencies
|
313
|
+
npm install
|
440
314
|
|
441
|
-
#
|
442
|
-
|
315
|
+
# Build the project
|
316
|
+
npm run build
|
443
317
|
|
444
|
-
#
|
445
|
-
|
446
|
-
SMTP_PORT=587
|
447
|
-
SMTP_USER=your-email@gmail.com
|
448
|
-
SMTP_PASS=your-app-password
|
318
|
+
# Link for local development
|
319
|
+
npm link
|
449
320
|
```
|
450
321
|
|
451
|
-
###
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
- **Development**: `my-api-development`
|
456
|
-
- **Staging**: `my-api-staging`
|
457
|
-
- **Production**: `my-api-production`
|
458
|
-
|
459
|
-
## 🚀 Best Practices
|
460
|
-
|
461
|
-
### 1. Naming Conventions
|
462
|
-
- Use singular names for entities: `product`, `user`, `category`
|
463
|
-
- Use descriptive names: `user_profile`, `product_inventory`
|
464
|
-
- Follow camelCase for multi-word names
|
322
|
+
### Testing
|
323
|
+
```bash
|
324
|
+
# Run tests
|
325
|
+
npm test
|
465
326
|
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
- Use `generate:module` for main business entities
|
470
|
-
- Always create relationships after both tables exist
|
327
|
+
# Run with coverage
|
328
|
+
npm run test:coverage
|
329
|
+
```
|
471
330
|
|
472
|
-
|
473
|
-
- Test endpoints after generation
|
474
|
-
- Customize generated code for your business logic
|
475
|
-
- Add validation and error handling
|
476
|
-
- Implement proper authentication and authorization
|
331
|
+
## 📄 License
|
477
332
|
|
478
|
-
|
479
|
-
- Keep related files together
|
480
|
-
- Use consistent naming patterns
|
481
|
-
- Document your API endpoints
|
482
|
-
- Version your API properly
|
333
|
+
This project is licensed under the MIT License.
|
483
334
|
|
484
335
|
## 🤝 Contributing
|
485
336
|
|
486
337
|
1. Fork the repository
|
487
338
|
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
|
488
|
-
3. Commit your changes (`git commit -m 'Add amazing feature'`)
|
339
|
+
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
|
489
340
|
4. Push to the branch (`git push origin feature/amazing-feature`)
|
490
341
|
5. Open a Pull Request
|
491
342
|
|
492
|
-
##
|
493
|
-
|
494
|
-
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
495
|
-
|
496
|
-
## 🆘 Support
|
343
|
+
## 📞 Support
|
497
344
|
|
498
|
-
|
499
|
-
-
|
500
|
-
-
|
345
|
+
For support and questions:
|
346
|
+
- 📖 Check the documentation
|
347
|
+
- 🐛 Open an issue on GitHub
|
348
|
+
- 💬 Join our community discussions
|
349
|
+
- 📧 Contact: support@diagramers.com
|
501
350
|
|
502
|
-
|
351
|
+
## 🔗 Related Packages
|
503
352
|
|
504
|
-
**
|
353
|
+
- **@diagramers/api** - API framework and template
|
354
|
+
- **@diagramers/admin** - Admin dashboard template
|
355
|
+
- **@diagramers/shared** - Shared utilities and types
|