@diagramers/cli 1.0.25 → 1.0.26
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 +217 -391
- package/package.json +1 -1
package/README.md
CHANGED
@@ -1,504 +1,330 @@
|
|
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
|
-
|
20
|
-
|
32
|
+
### Local Installation
|
21
33
|
```bash
|
22
|
-
|
23
|
-
diagramers
|
24
|
-
|
25
|
-
# Navigate to your project
|
26
|
-
cd my-ecommerce-api
|
34
|
+
npm install @diagramers/cli
|
35
|
+
npx diagramers --help
|
36
|
+
```
|
27
37
|
|
28
|
-
|
29
|
-
diagramers api generate:module product
|
38
|
+
## 🛠️ Usage
|
30
39
|
|
31
|
-
|
32
|
-
|
33
|
-
|
40
|
+
### Initialize New Project
|
41
|
+
```bash
|
42
|
+
# Initialize new API project
|
43
|
+
diagramers init api my-api-project
|
34
44
|
|
35
|
-
#
|
36
|
-
diagramers
|
37
|
-
diagramers api generate:relation product brand
|
38
|
-
```
|
45
|
+
# Initialize new admin project
|
46
|
+
diagramers init admin my-admin-project
|
39
47
|
|
40
|
-
|
48
|
+
# Initialize with specific template version
|
49
|
+
diagramers init api my-project --template 1.0.0
|
41
50
|
|
42
|
-
|
51
|
+
# Skip prompts and use defaults
|
52
|
+
diagramers init api my-project --yes
|
53
|
+
```
|
43
54
|
|
55
|
+
### Generate Modules
|
44
56
|
```bash
|
45
|
-
#
|
46
|
-
diagramers
|
57
|
+
# Generate basic module
|
58
|
+
diagramers extend --module products
|
47
59
|
|
48
|
-
#
|
49
|
-
diagramers
|
50
|
-
```
|
60
|
+
# Generate module with CRUD operations
|
61
|
+
diagramers extend --module orders --crud
|
51
62
|
|
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
|
63
|
+
# Generate module with custom fields
|
64
|
+
diagramers extend --module categories --fields name,description,slug
|
62
65
|
|
63
|
-
|
66
|
+
# Generate module with specific database type
|
67
|
+
diagramers extend --module users --type mongodb --fields email,username,role
|
68
|
+
```
|
64
69
|
|
70
|
+
### Generate Database Schemas
|
65
71
|
```bash
|
66
|
-
#
|
67
|
-
diagramers
|
72
|
+
# Generate MongoDB collection
|
73
|
+
diagramers extend --table products --fields name,price,description
|
68
74
|
|
69
|
-
#
|
70
|
-
diagramers
|
75
|
+
# Generate SQL table
|
76
|
+
diagramers extend --table orders --type mysql --fields customer_id,amount,status
|
71
77
|
|
72
|
-
#
|
73
|
-
diagramers
|
78
|
+
# Generate PostgreSQL table
|
79
|
+
diagramers extend --table categories --type postgres --fields name,slug,parent_id
|
74
80
|
```
|
75
81
|
|
76
|
-
###
|
77
|
-
|
82
|
+
### Generate Database Relations
|
78
83
|
```bash
|
79
|
-
#
|
80
|
-
diagramers extend --
|
84
|
+
# Generate MongoDB relations
|
85
|
+
diagramers extend --relation user-posts --type mongodb
|
86
|
+
|
87
|
+
# Generate SQL relations
|
88
|
+
diagramers extend --relation product-categories --type mysql
|
89
|
+
```
|
81
90
|
|
82
|
-
|
91
|
+
### Add Features
|
92
|
+
```bash
|
93
|
+
# Add authentication feature
|
83
94
|
diagramers extend --feature auth
|
84
95
|
|
85
|
-
# Add email
|
96
|
+
# Add email notification feature
|
86
97
|
diagramers extend --feature email
|
87
98
|
|
88
|
-
# Add WebSocket
|
99
|
+
# Add WebSocket feature
|
89
100
|
diagramers extend --feature socket
|
90
101
|
|
91
|
-
# Add
|
102
|
+
# Add scheduled tasks feature
|
92
103
|
diagramers extend --feature cron
|
93
104
|
|
94
|
-
# Add audit logging
|
105
|
+
# Add audit logging feature
|
95
106
|
diagramers extend --feature audit
|
96
107
|
```
|
97
108
|
|
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
|
-
|
109
|
+
### List Available Options
|
118
110
|
```bash
|
119
|
-
|
111
|
+
# List all available features and templates
|
112
|
+
diagramers extend --list
|
120
113
|
```
|
121
114
|
|
122
|
-
|
115
|
+
### Update Projects
|
123
116
|
```bash
|
124
|
-
|
125
|
-
|
117
|
+
# Update project structure
|
118
|
+
diagramers update
|
126
119
|
|
127
|
-
|
128
|
-
|
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
|
120
|
+
# Update with specific version
|
121
|
+
diagramers update --version 1.0.0
|
135
122
|
```
|
136
123
|
|
137
|
-
|
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
|
-
|
144
|
-
### Generate Database Table
|
145
|
-
|
146
|
-
Creates only the database layer (entity and schema):
|
147
|
-
|
148
|
-
```bash
|
149
|
-
diagramers api generate:table <name>
|
150
|
-
```
|
124
|
+
## 📁 Generated Module Structure
|
151
125
|
|
152
|
-
|
153
|
-
```bash
|
154
|
-
diagramers api generate:table category
|
155
|
-
diagramers api generate:table brand
|
156
|
-
diagramers api generate:table inventory
|
157
|
-
```
|
126
|
+
When you generate a module, the CLI creates a complete structure:
|
158
127
|
|
159
|
-
**Generated Files:**
|
160
128
|
```
|
161
|
-
src/
|
162
|
-
├── entities/
|
163
|
-
└──
|
129
|
+
src/modules/your-module/
|
130
|
+
├── entities/
|
131
|
+
│ └── your-module.entity.ts # TypeScript interfaces
|
132
|
+
├── schemas/
|
133
|
+
│ └── your-module.schema.ts # Database schemas
|
134
|
+
├── services/
|
135
|
+
│ └── your-module.service.ts # Business logic
|
136
|
+
├── controllers/
|
137
|
+
│ └── your-module.controller.ts # HTTP handlers
|
138
|
+
└── routes/
|
139
|
+
└── your-module.routes.ts # API routes
|
164
140
|
```
|
165
141
|
|
166
|
-
|
167
|
-
-
|
168
|
-
-
|
169
|
-
-
|
170
|
-
-
|
171
|
-
|
172
|
-
### Generate Table Relationships
|
142
|
+
### Generated Files Include:
|
143
|
+
- **Entities** - TypeScript interfaces with CRUD operations
|
144
|
+
- **Schemas** - Database schemas with validation and indexes
|
145
|
+
- **Services** - Business logic with Result model integration
|
146
|
+
- **Controllers** - HTTP handlers with Swagger documentation
|
147
|
+
- **Routes** - Express routes with proper binding
|
173
148
|
|
174
|
-
|
149
|
+
## 🔧 Configuration
|
175
150
|
|
151
|
+
### Template Configuration
|
152
|
+
The CLI uses npm packages for templates:
|
153
|
+
- `@diagramers/api` - API project template
|
154
|
+
- `@diagramers/admin` - Admin project template
|
155
|
+
|
156
|
+
### Custom Templates
|
157
|
+
You can create custom templates by:
|
158
|
+
1. Creating a package with the template structure
|
159
|
+
2. Publishing to npm with `@diagramers/` prefix
|
160
|
+
3. Using the template with `--template` flag
|
161
|
+
|
162
|
+
## 📋 Available Features
|
163
|
+
|
164
|
+
### Authentication Features
|
165
|
+
- **Internal Auth** - Username/password with JWT
|
166
|
+
- **Firebase Auth** - Google Firebase integration
|
167
|
+
- **OAuth Providers** - Google, GitHub, Facebook
|
168
|
+
- **SMS OTP** - Twilio, AWS SNS integration
|
169
|
+
- **Email OTP** - Email-based verification
|
170
|
+
|
171
|
+
### Communication Features
|
172
|
+
- **Email System** - Nodemailer with templates
|
173
|
+
- **SMS System** - Twilio integration
|
174
|
+
- **WebSocket** - Real-time communication
|
175
|
+
- **Push Notifications** - Firebase messaging
|
176
|
+
|
177
|
+
### System Features
|
178
|
+
- **Cron Jobs** - Scheduled task system
|
179
|
+
- **Audit Logging** - Activity tracking
|
180
|
+
- **File Upload** - File management system
|
181
|
+
- **Caching** - Redis integration
|
182
|
+
|
183
|
+
## 🗄️ Database Support
|
184
|
+
|
185
|
+
### MongoDB (Default)
|
176
186
|
```bash
|
177
|
-
|
187
|
+
# Generate MongoDB collection
|
188
|
+
diagramers extend --table products --type mongodb --fields name,price,category
|
178
189
|
```
|
179
190
|
|
180
|
-
|
181
|
-
- `one-to-one` (default)
|
182
|
-
- `one-to-many`
|
183
|
-
- `many-to-many`
|
184
|
-
|
185
|
-
**Examples:**
|
191
|
+
### SQL Databases
|
186
192
|
```bash
|
187
|
-
#
|
188
|
-
diagramers
|
189
|
-
|
190
|
-
# Many-to-many: Product has many Tags
|
191
|
-
diagramers api generate:relation product tag many-to-many
|
192
|
-
|
193
|
-
# One-to-one: User has one Profile
|
194
|
-
diagramers api generate:relation user profile one-to-one
|
195
|
-
```
|
193
|
+
# MySQL table
|
194
|
+
diagramers extend --table orders --type mysql --fields customer_id,amount,status
|
196
195
|
|
197
|
-
|
198
|
-
|
199
|
-
- Updates schemas with references and indexes
|
200
|
-
- Adds population methods to services
|
201
|
-
- Updates database context
|
196
|
+
# PostgreSQL table
|
197
|
+
diagramers extend --table users --type postgres --fields email,username,role
|
202
198
|
|
203
|
-
|
204
|
-
|
205
|
-
Customize your project for different environments:
|
206
|
-
|
207
|
-
```bash
|
208
|
-
diagramers api process:template <project-name>
|
199
|
+
# SQLite table
|
200
|
+
diagramers extend --table settings --type sqlite --fields key,value
|
209
201
|
```
|
210
202
|
|
211
|
-
|
203
|
+
### Relations
|
212
204
|
```bash
|
213
|
-
|
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
|
205
|
+
# One-to-Many relations
|
206
|
+
diagramers extend --relation user-posts --type mongodb
|
222
207
|
|
223
|
-
|
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
|
208
|
+
# Many-to-Many relations
|
209
|
+
diagramers extend --relation product-categories --type mysql
|
259
210
|
```
|
260
211
|
|
261
|
-
##
|
212
|
+
## 🔌 Plugin System
|
262
213
|
|
263
|
-
|
214
|
+
The CLI supports plugin generation for extending functionality:
|
264
215
|
|
216
|
+
### Generate Plugin
|
265
217
|
```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
|
218
|
+
# Generate plugin structure
|
219
|
+
diagramers extend --plugin my-plugin
|
294
220
|
|
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
|
221
|
+
# Generate plugin with configuration
|
222
|
+
diagramers extend --plugin payment-gateway --config stripe,paypal
|
315
223
|
```
|
316
224
|
|
317
|
-
##
|
225
|
+
## 📚 Examples
|
318
226
|
|
319
|
-
###
|
227
|
+
### Complete E-commerce Module
|
228
|
+
```bash
|
229
|
+
# Generate products module
|
230
|
+
diagramers extend --module products --crud --fields name,price,description,category,stock
|
320
231
|
|
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
|
-
}
|
232
|
+
# Generate orders module
|
233
|
+
diagramers extend --module orders --crud --fields customer_id,products,total,status
|
329
234
|
|
330
|
-
|
331
|
-
|
332
|
-
name: string;
|
333
|
-
products?: IProduct[]; // Virtual field
|
334
|
-
}
|
335
|
-
```
|
336
|
-
|
337
|
-
### Many-to-Many Relationship
|
338
|
-
|
339
|
-
```typescript
|
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
|
-
}
|
354
|
-
```
|
235
|
+
# Generate categories module
|
236
|
+
diagramers extend --module categories --crud --fields name,description,parent_id
|
355
237
|
|
356
|
-
|
357
|
-
|
358
|
-
|
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
|
-
}
|
238
|
+
# Generate relations
|
239
|
+
diagramers extend --relation product-category --type mongodb
|
240
|
+
diagramers extend --relation order-product --type mongodb
|
374
241
|
```
|
375
242
|
|
376
|
-
|
377
|
-
|
378
|
-
### 1. Project Setup
|
243
|
+
### User Management System
|
379
244
|
```bash
|
380
|
-
#
|
381
|
-
diagramers
|
382
|
-
cd my-api
|
245
|
+
# Generate users module
|
246
|
+
diagramers extend --module users --crud --fields email,username,role,status
|
383
247
|
|
384
|
-
#
|
385
|
-
|
248
|
+
# Generate profiles module
|
249
|
+
diagramers extend --module profiles --crud --fields user_id,first_name,last_name,avatar
|
386
250
|
|
387
|
-
#
|
388
|
-
|
389
|
-
```
|
251
|
+
# Generate permissions module
|
252
|
+
diagramers extend --module permissions --crud --fields name,description,resource
|
390
253
|
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
diagramers api generate:module product
|
254
|
+
# Generate relations
|
255
|
+
diagramers extend --relation user-profile --type mongodb
|
256
|
+
diagramers extend --relation user-permissions --type mongodb
|
257
|
+
```
|
396
258
|
|
397
|
-
|
398
|
-
diagramers api generate:table category
|
399
|
-
diagramers api generate:table brand
|
259
|
+
## 🚀 Advanced Usage
|
400
260
|
|
401
|
-
|
402
|
-
|
403
|
-
|
261
|
+
### Custom Field Types
|
262
|
+
```bash
|
263
|
+
# Generate with different field types
|
264
|
+
diagramers extend --module products --fields name:string,price:number,active:boolean,created:date
|
404
265
|
```
|
405
266
|
|
406
|
-
###
|
267
|
+
### Nested Modules
|
407
268
|
```bash
|
408
|
-
#
|
409
|
-
|
410
|
-
curl http://localhost:4000/api/categories
|
269
|
+
# Generate nested module structure
|
270
|
+
diagramers extend --module admin/users --crud --fields email,role,permissions
|
411
271
|
```
|
412
272
|
|
413
|
-
###
|
273
|
+
### API Documentation
|
414
274
|
```bash
|
415
|
-
#
|
416
|
-
diagramers api
|
417
|
-
|
418
|
-
# Build and deploy
|
419
|
-
npm run build:prod
|
420
|
-
npm run deploy
|
275
|
+
# Generate with enhanced Swagger docs
|
276
|
+
diagramers extend --module api/products --crud --swagger --fields name,price,description
|
421
277
|
```
|
422
278
|
|
423
|
-
## 🔧
|
424
|
-
|
425
|
-
### Environment Variables
|
279
|
+
## 🔧 Development
|
426
280
|
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
HOST=localhost
|
433
|
-
|
434
|
-
# Database Configuration
|
435
|
-
MONGODB_URI=mongodb://127.0.0.1:27017/my-api-development
|
281
|
+
### Local Development
|
282
|
+
```bash
|
283
|
+
# Clone the repository
|
284
|
+
git clone https://github.com/diagramers/diagramers-cli.git
|
285
|
+
cd diagramers-cli
|
436
286
|
|
437
|
-
#
|
438
|
-
|
439
|
-
FIREBASE_AUTH_DOMAIN=your-project.firebaseapp.com
|
287
|
+
# Install dependencies
|
288
|
+
npm install
|
440
289
|
|
441
|
-
#
|
442
|
-
|
290
|
+
# Build the project
|
291
|
+
npm run build
|
443
292
|
|
444
|
-
#
|
445
|
-
|
446
|
-
SMTP_PORT=587
|
447
|
-
SMTP_USER=your-email@gmail.com
|
448
|
-
SMTP_PASS=your-app-password
|
293
|
+
# Link for local development
|
294
|
+
npm link
|
449
295
|
```
|
450
296
|
|
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
|
297
|
+
### Testing
|
298
|
+
```bash
|
299
|
+
# Run tests
|
300
|
+
npm test
|
465
301
|
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
- Use `generate:module` for main business entities
|
470
|
-
- Always create relationships after both tables exist
|
302
|
+
# Run with coverage
|
303
|
+
npm run test:coverage
|
304
|
+
```
|
471
305
|
|
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
|
306
|
+
## 📄 License
|
477
307
|
|
478
|
-
|
479
|
-
- Keep related files together
|
480
|
-
- Use consistent naming patterns
|
481
|
-
- Document your API endpoints
|
482
|
-
- Version your API properly
|
308
|
+
This project is licensed under the MIT License.
|
483
309
|
|
484
310
|
## 🤝 Contributing
|
485
311
|
|
486
312
|
1. Fork the repository
|
487
313
|
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
|
488
|
-
3. Commit your changes (`git commit -m 'Add amazing feature'`)
|
314
|
+
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
|
489
315
|
4. Push to the branch (`git push origin feature/amazing-feature`)
|
490
316
|
5. Open a Pull Request
|
491
317
|
|
492
|
-
##
|
493
|
-
|
494
|
-
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
495
|
-
|
496
|
-
## 🆘 Support
|
318
|
+
## 📞 Support
|
497
319
|
|
498
|
-
|
499
|
-
-
|
500
|
-
-
|
320
|
+
For support and questions:
|
321
|
+
- 📖 Check the documentation
|
322
|
+
- 🐛 Open an issue on GitHub
|
323
|
+
- 💬 Join our community discussions
|
324
|
+
- 📧 Contact: support@diagramers.com
|
501
325
|
|
502
|
-
|
326
|
+
## 🔗 Related Packages
|
503
327
|
|
504
|
-
**
|
328
|
+
- **@diagramers/api** - API framework and template
|
329
|
+
- **@diagramers/admin** - Admin dashboard template
|
330
|
+
- **@diagramers/shared** - Shared utilities and types
|