nestcraftx 0.2.4 → 0.2.6
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/.gitattributes +6 -0
- package/.github/ISSUE_TEMPLATE/bug_report.md +33 -0
- package/.github/ISSUE_TEMPLATE/feature_request.md +19 -0
- package/.github/ISSUE_TEMPLATE/pull_request_template.md +24 -0
- package/CHANGELOG.fr.md +97 -97
- package/CHANGELOG.md +98 -98
- package/CLI_USAGE.fr.md +331 -331
- package/CLI_USAGE.md +364 -364
- package/DEMO.fr.md +292 -292
- package/DEMO.md +294 -294
- package/LICENSE +21 -21
- package/MIGRATION_GUIDE.fr.md +127 -127
- package/MIGRATION_GUIDE.md +124 -124
- package/QUICK_START.fr.md +152 -152
- package/QUICK_START.md +169 -169
- package/README.fr.md +653 -659
- package/SECURITY.md +10 -0
- package/bin/nestcraft.js +84 -64
- package/commands/demo.js +333 -330
- package/commands/generate.js +93 -0
- package/commands/generateConf.js +91 -0
- package/commands/help.js +78 -78
- package/commands/info.js +48 -48
- package/commands/new.js +338 -335
- package/commands/start.js +19 -19
- package/commands/test.js +7 -7
- package/package.json +41 -41
- package/readme.md +638 -643
- package/utils/cliParser.js +133 -76
- package/utils/colors.js +62 -62
- package/utils/configs/configureDocker.js +120 -120
- package/utils/configs/setupCleanArchitecture.js +563 -557
- package/utils/configs/setupLightArchitecture.js +701 -660
- package/utils/envGenerator.js +122 -122
- package/utils/file-utils/packageJsonUtils.js +49 -55
- package/utils/file-utils/saveProjectConfig.js +36 -0
- package/utils/fullModeInput.js +607 -607
- package/utils/generators/application/dtoUpdater.js +54 -0
- package/utils/generators/cleanModuleGenerator.js +475 -0
- package/utils/generators/database/setupDatabase.js +31 -0
- package/utils/generators/domain/entityUpdater.js +78 -0
- package/utils/generators/infrastructure/mapperUpdater.js +65 -0
- package/utils/generators/lightModuleGenerator.js +131 -0
- package/utils/generators/relation/relation.engine.js +64 -0
- package/utils/interactive/askEntityInputs.js +165 -0
- package/utils/lightModeInput.js +460 -460
- package/utils/loggers/logError.js +7 -7
- package/utils/loggers/logInfo.js +7 -7
- package/utils/loggers/logSuccess.js +7 -7
- package/utils/loggers/logWarning.js +7 -7
- package/utils/setups/orms/typeOrmSetup.js +630 -630
- package/utils/setups/projectSetup.js +46 -46
- package/utils/setups/setupAuth.js +973 -926
- package/utils/setups/setupDatabase.js +75 -75
- package/utils/setups/setupLogger.js +69 -59
- package/utils/setups/setupMongoose.js +377 -432
- package/utils/setups/setupPrisma.js +802 -630
- package/utils/setups/setupSwagger.js +97 -88
- package/utils/shell.js +32 -32
- package/utils/spinner.js +57 -57
- package/utils/systemCheck.js +124 -124
- package/utils/userInput.js +421 -421
- package/utils/utils.js +2197 -1762
package/CLI_USAGE.fr.md
CHANGED
|
@@ -1,331 +1,331 @@
|
|
|
1
|
-
# NestCraftX CLI - Guide d'utilisation
|
|
2
|
-
|
|
3
|
-
## Installation
|
|
4
|
-
|
|
5
|
-
```bash
|
|
6
|
-
npm install -g nestcraftx
|
|
7
|
-
```
|
|
8
|
-
|
|
9
|
-
## Commandes disponibles
|
|
10
|
-
|
|
11
|
-
### Creer un nouveau projet
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
nestcraftx new <project-name> [options]
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
## Modes de generation
|
|
18
|
-
|
|
19
|
-
### Mode FULL (Architecture Complete - Clean Architecture + DDD)
|
|
20
|
-
|
|
21
|
-
Structure complete avec use-cases, mappers, adapters et separation stricte des couches.
|
|
22
|
-
Ideal pour les projets complexes et scalables.
|
|
23
|
-
|
|
24
|
-
```bash
|
|
25
|
-
nestcraftx new mon-projet --full
|
|
26
|
-
nestcraftx new mon-projet --mode=full
|
|
27
|
-
nestcraftx new mon-projet
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
**Structure generee :**
|
|
31
|
-
|
|
32
|
-
```
|
|
33
|
-
src
|
|
34
|
-
├── [entity]
|
|
35
|
-
│ ├── application
|
|
36
|
-
│ │ ├── dtos
|
|
37
|
-
│ │ ├── services
|
|
38
|
-
│ │ ├── use-cases
|
|
39
|
-
│ │ └── interfaces
|
|
40
|
-
│ │
|
|
41
|
-
│ ├── domain
|
|
42
|
-
│ │ ├── entities
|
|
43
|
-
│ │ ├── enums
|
|
44
|
-
│ │ └── interfaces
|
|
45
|
-
│ │
|
|
46
|
-
│ ├── infrastructure
|
|
47
|
-
│ │ ├── adapters
|
|
48
|
-
│ │ ├── mappers
|
|
49
|
-
│ │ ├── repositories
|
|
50
|
-
│ │ └── services
|
|
51
|
-
│ │
|
|
52
|
-
│ ├── presentation
|
|
53
|
-
│ │ └── controllers
|
|
54
|
-
│ │
|
|
55
|
-
│ └── [entity].module.ts
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
### Mode LIGHT (MVP Simplifie)
|
|
59
|
-
|
|
60
|
-
Structure plate avec moins de couches d'abstraction.
|
|
61
|
-
Parfait pour prototypes et petits projets.
|
|
62
|
-
|
|
63
|
-
```bash
|
|
64
|
-
nestcraftx new mon-projet --light
|
|
65
|
-
nestcraftx new mon-projet --mode=light
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
**Structure generee :**
|
|
69
|
-
|
|
70
|
-
```
|
|
71
|
-
src
|
|
72
|
-
├── [entity]
|
|
73
|
-
│ ├── entities
|
|
74
|
-
│ ├── dto
|
|
75
|
-
│ ├── services
|
|
76
|
-
│ ├── repositories
|
|
77
|
-
│ ├── controllers
|
|
78
|
-
│ └── [entity].module.ts
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
## Options disponibles
|
|
82
|
-
|
|
83
|
-
### ORM
|
|
84
|
-
|
|
85
|
-
Choisir l'ORM a utiliser :
|
|
86
|
-
|
|
87
|
-
```bash
|
|
88
|
-
--orm=prisma # Prisma (par defaut)
|
|
89
|
-
--orm=typeorm # TypeORM
|
|
90
|
-
--orm=mongoose # Mongoose (MongoDB - phase de test)
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
**Exemples :**
|
|
94
|
-
|
|
95
|
-
```bash
|
|
96
|
-
nestcraftx new mon-api --light --orm=prisma
|
|
97
|
-
nestcraftx new mon-api --full --orm=typeorm
|
|
98
|
-
nestcraftx new mon-api --orm=mongoose
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
### Authentification
|
|
102
|
-
|
|
103
|
-
Activer l'authentification JWT :
|
|
104
|
-
|
|
105
|
-
```bash
|
|
106
|
-
--auth # Active l'auth avec JWT
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
**Exemple :**
|
|
110
|
-
|
|
111
|
-
```bash
|
|
112
|
-
nestcraftx new mon-api --light --auth --orm=prisma
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
Avec `--auth`, une entite User est automatiquement generee avec :
|
|
116
|
-
|
|
117
|
-
- email (string)
|
|
118
|
-
- password (string)
|
|
119
|
-
- isActive (boolean)
|
|
120
|
-
|
|
121
|
-
### Swagger
|
|
122
|
-
|
|
123
|
-
Activer la documentation Swagger/OpenAPI :
|
|
124
|
-
|
|
125
|
-
```bash
|
|
126
|
-
--swagger # Active Swagger UI
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
**Exemple :**
|
|
130
|
-
|
|
131
|
-
```bash
|
|
132
|
-
nestcraftx new mon-api --light --swagger
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
Swagger sera accessible a : `http://localhost:3000/api/docs`
|
|
136
|
-
|
|
137
|
-
### Docker
|
|
138
|
-
|
|
139
|
-
Desactiver Docker (active par defaut) :
|
|
140
|
-
|
|
141
|
-
```bash
|
|
142
|
-
--docker=false # Desactive Docker
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
**Exemple :**
|
|
146
|
-
|
|
147
|
-
```bash
|
|
148
|
-
nestcraftx new mon-api --light --docker=false
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
## Exemples de commandes completes
|
|
152
|
-
|
|
153
|
-
### Projet LIGHT avec toutes les options
|
|
154
|
-
|
|
155
|
-
```bash
|
|
156
|
-
nestcraftx new mon-api --light --orm=prisma --auth --swagger
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
### Projet FULL avec TypeORM et Auth
|
|
160
|
-
|
|
161
|
-
```bash
|
|
162
|
-
nestcraftx new mon-api --full --orm=typeorm --auth
|
|
163
|
-
```
|
|
164
|
-
|
|
165
|
-
### Projet minimal LIGHT (mode interactif)
|
|
166
|
-
|
|
167
|
-
```bash
|
|
168
|
-
nestcraftx new mon-api --light
|
|
169
|
-
# Le CLI demandera toutes les options necessaires
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
### Projet MongoDB avec Mongoose
|
|
173
|
-
|
|
174
|
-
```bash
|
|
175
|
-
nestcraftx new mon-api --light --orm=mongoose --auth --swagger
|
|
176
|
-
```
|
|
177
|
-
|
|
178
|
-
## Configuration automatique
|
|
179
|
-
|
|
180
|
-
### Fichier .env genere
|
|
181
|
-
|
|
182
|
-
Le CLI genere automatiquement un fichier `.env` avec :
|
|
183
|
-
|
|
184
|
-
**Pour PostgreSQL (Prisma/TypeORM) :**
|
|
185
|
-
|
|
186
|
-
```env
|
|
187
|
-
NODE_ENV=development
|
|
188
|
-
PORT=3000
|
|
189
|
-
JWT_SECRET=<secret-auto-genere-64-chars>
|
|
190
|
-
JWT_REFRESH_SECRET=<secret-auto-genere-64-chars>
|
|
191
|
-
JWT_EXPIRES_IN=15m
|
|
192
|
-
JWT_REFRESH_EXPIRES_IN=7d
|
|
193
|
-
POSTGRES_USER=postgres
|
|
194
|
-
POSTGRES_PASSWORD=postgres
|
|
195
|
-
POSTGRES_DB=mon-api
|
|
196
|
-
POSTGRES_HOST=localhost
|
|
197
|
-
POSTGRES_PORT=5432
|
|
198
|
-
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/mon-api?schema=public
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
**Pour MongoDB (Mongoose) :**
|
|
202
|
-
|
|
203
|
-
```env
|
|
204
|
-
NODE_ENV=development
|
|
205
|
-
PORT=3000
|
|
206
|
-
JWT_SECRET=<secret-auto-genere-64-chars>
|
|
207
|
-
JWT_REFRESH_SECRET=<secret-auto-genere-64-chars>
|
|
208
|
-
JWT_EXPIRES_IN=15m
|
|
209
|
-
JWT_REFRESH_EXPIRES_IN=7d
|
|
210
|
-
MONGO_URI=mongodb://localhost:27017
|
|
211
|
-
MONGO_DB=mon-api
|
|
212
|
-
```
|
|
213
|
-
|
|
214
|
-
Les secrets JWT sont generes automatiquement de maniere securisee.
|
|
215
|
-
|
|
216
|
-
## Modes Interactifs
|
|
217
|
-
|
|
218
|
-
### Mode LIGHT Interactif
|
|
219
|
-
|
|
220
|
-
Si vous ne fournissez pas tous les flags necessaires, le CLI passera en mode interactif pour demander les options manquantes.
|
|
221
|
-
|
|
222
|
-
**Exemple :**
|
|
223
|
-
|
|
224
|
-
```bash
|
|
225
|
-
nestcraftx new mon-api --light
|
|
226
|
-
|
|
227
|
-
[MODE LIGHT] Configuration simplifiee pour mon-api
|
|
228
|
-
|
|
229
|
-
[?] Choisissez un ORM (prisma, typeorm, mongoose) [prisma]: prisma
|
|
230
|
-
[?] Activer l'authentification JWT ? (Y/n): y
|
|
231
|
-
[INFO] Auth active : ajout automatique de l'entite User
|
|
232
|
-
[?] Activer Swagger pour la documentation API ? (Y/n): y
|
|
233
|
-
[?] Generer les fichiers Docker ? (Y/n): y
|
|
234
|
-
|
|
235
|
-
[INFO] Configuration PostgreSQL
|
|
236
|
-
Utilisateur PostgreSQL [postgres]:
|
|
237
|
-
Mot de passe PostgreSQL [postgres]:
|
|
238
|
-
Nom de la base [mon-api]:
|
|
239
|
-
Hote PostgreSQL [localhost]:
|
|
240
|
-
Port PostgreSQL [5432]:
|
|
241
|
-
|
|
242
|
-
[?] Voulez-vous ajouter des entites supplementaires ? (Y/n): n
|
|
243
|
-
|
|
244
|
-
[INFO] Demarrage de la generation du projet...
|
|
245
|
-
```
|
|
246
|
-
|
|
247
|
-
### Mode FULL Interactif
|
|
248
|
-
|
|
249
|
-
Le mode FULL est toujours interactif pour vous donner un controle total sur la configuration.
|
|
250
|
-
|
|
251
|
-
**Exemple :**
|
|
252
|
-
|
|
253
|
-
```bash
|
|
254
|
-
nestcraftx new mon-projet
|
|
255
|
-
|
|
256
|
-
[MODE FULL] Configuration complete avec Clean Architecture
|
|
257
|
-
|
|
258
|
-
[?] Nom du projet : mon-projet
|
|
259
|
-
[?] Base de donnees (postgresql, mongodb) [postgresql]: postgresql
|
|
260
|
-
|
|
261
|
-
[INFO] Configuration PostgreSQL
|
|
262
|
-
Utilisateur PostgreSQL [postgres]:
|
|
263
|
-
Mot de passe PostgreSQL [postgres]:
|
|
264
|
-
...
|
|
265
|
-
|
|
266
|
-
[?] ORM pour PostgreSQL (prisma, typeorm) [prisma]: prisma
|
|
267
|
-
[?] Utiliser Yarn ? (Y/n): n
|
|
268
|
-
[?] Generer fichiers Docker ? (Y/n): y
|
|
269
|
-
[?] Ajouter authentification JWT ? (Y/n): y
|
|
270
|
-
[?] Installer Swagger ? (Y/n): y
|
|
271
|
-
|
|
272
|
-
[INFO] Configuration Swagger
|
|
273
|
-
Titre API [mon-projet API]:
|
|
274
|
-
Description [API generated by NestCraftX]:
|
|
275
|
-
Version [1.0.0]:
|
|
276
|
-
Endpoint [api/docs]:
|
|
277
|
-
|
|
278
|
-
[INFO] Saisie des entites (Mode FULL - Architecture complete)
|
|
279
|
-
[?] Ajouter une entite ? (Y/n): y
|
|
280
|
-
Nom de l'entite : post
|
|
281
|
-
Champs pour "post" :
|
|
282
|
-
Nom du champ (vide pour terminer) : title
|
|
283
|
-
Type de "title" (string, number, boolean, Date, enum) : string
|
|
284
|
-
Nom du champ (vide pour terminer) : content
|
|
285
|
-
Type de "content" (string, number, boolean, Date, enum) : string
|
|
286
|
-
Nom du champ (vide pour terminer) :
|
|
287
|
-
|
|
288
|
-
[✓] Entite "post" ajoutee avec 2 champ(s)
|
|
289
|
-
[?] Ajouter une autre entite ? (Y/n): n
|
|
290
|
-
[?] Ajouter des relations entre entites ? (Y/n): n
|
|
291
|
-
```
|
|
292
|
-
|
|
293
|
-
## Apres la creation
|
|
294
|
-
|
|
295
|
-
```bash
|
|
296
|
-
cd mon-projet
|
|
297
|
-
npm run start:dev
|
|
298
|
-
```
|
|
299
|
-
|
|
300
|
-
Si Swagger est active :
|
|
301
|
-
|
|
302
|
-
```
|
|
303
|
-
http://localhost:3000/api/docs
|
|
304
|
-
```
|
|
305
|
-
|
|
306
|
-
## Autres commandes
|
|
307
|
-
|
|
308
|
-
### Verifier l'environnement
|
|
309
|
-
|
|
310
|
-
```bash
|
|
311
|
-
nestcraftx test
|
|
312
|
-
```
|
|
313
|
-
|
|
314
|
-
### Informations CLI
|
|
315
|
-
|
|
316
|
-
```bash
|
|
317
|
-
nestcraftx info
|
|
318
|
-
```
|
|
319
|
-
|
|
320
|
-
### Aide
|
|
321
|
-
|
|
322
|
-
```bash
|
|
323
|
-
nestcraftx --help
|
|
324
|
-
```
|
|
325
|
-
|
|
326
|
-
## Notes importantes
|
|
327
|
-
|
|
328
|
-
- Les secrets JWT sont auto-generes de maniere securisee (64 caracteres)
|
|
329
|
-
- DATABASE_URL est automatiquement construit selon l'ORM choisi
|
|
330
|
-
- Docker est active par defaut en mode LIGHT
|
|
331
|
-
- Le mode FULL necessite une configuration interactive si aucune option n'est fournie
|
|
1
|
+
# NestCraftX CLI - Guide d'utilisation
|
|
2
|
+
|
|
3
|
+
## Installation
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm install -g nestcraftx
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Commandes disponibles
|
|
10
|
+
|
|
11
|
+
### Creer un nouveau projet
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
nestcraftx new <project-name> [options]
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Modes de generation
|
|
18
|
+
|
|
19
|
+
### Mode FULL (Architecture Complete - Clean Architecture + DDD)
|
|
20
|
+
|
|
21
|
+
Structure complete avec use-cases, mappers, adapters et separation stricte des couches.
|
|
22
|
+
Ideal pour les projets complexes et scalables.
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
nestcraftx new mon-projet --full
|
|
26
|
+
nestcraftx new mon-projet --mode=full
|
|
27
|
+
nestcraftx new mon-projet
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
**Structure generee :**
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
src
|
|
34
|
+
├── [entity]
|
|
35
|
+
│ ├── application
|
|
36
|
+
│ │ ├── dtos
|
|
37
|
+
│ │ ├── services
|
|
38
|
+
│ │ ├── use-cases
|
|
39
|
+
│ │ └── interfaces
|
|
40
|
+
│ │
|
|
41
|
+
│ ├── domain
|
|
42
|
+
│ │ ├── entities
|
|
43
|
+
│ │ ├── enums
|
|
44
|
+
│ │ └── interfaces
|
|
45
|
+
│ │
|
|
46
|
+
│ ├── infrastructure
|
|
47
|
+
│ │ ├── adapters
|
|
48
|
+
│ │ ├── mappers
|
|
49
|
+
│ │ ├── repositories
|
|
50
|
+
│ │ └── services
|
|
51
|
+
│ │
|
|
52
|
+
│ ├── presentation
|
|
53
|
+
│ │ └── controllers
|
|
54
|
+
│ │
|
|
55
|
+
│ └── [entity].module.ts
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Mode LIGHT (MVP Simplifie)
|
|
59
|
+
|
|
60
|
+
Structure plate avec moins de couches d'abstraction.
|
|
61
|
+
Parfait pour prototypes et petits projets.
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
nestcraftx new mon-projet --light
|
|
65
|
+
nestcraftx new mon-projet --mode=light
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
**Structure generee :**
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
src
|
|
72
|
+
├── [entity]
|
|
73
|
+
│ ├── entities
|
|
74
|
+
│ ├── dto
|
|
75
|
+
│ ├── services
|
|
76
|
+
│ ├── repositories
|
|
77
|
+
│ ├── controllers
|
|
78
|
+
│ └── [entity].module.ts
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Options disponibles
|
|
82
|
+
|
|
83
|
+
### ORM
|
|
84
|
+
|
|
85
|
+
Choisir l'ORM a utiliser :
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
--orm=prisma # Prisma (par defaut)
|
|
89
|
+
--orm=typeorm # TypeORM
|
|
90
|
+
--orm=mongoose # Mongoose (MongoDB - phase de test)
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
**Exemples :**
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
nestcraftx new mon-api --light --orm=prisma
|
|
97
|
+
nestcraftx new mon-api --full --orm=typeorm
|
|
98
|
+
nestcraftx new mon-api --orm=mongoose
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Authentification
|
|
102
|
+
|
|
103
|
+
Activer l'authentification JWT :
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
--auth # Active l'auth avec JWT
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
**Exemple :**
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
nestcraftx new mon-api --light --auth --orm=prisma
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Avec `--auth`, une entite User est automatiquement generee avec :
|
|
116
|
+
|
|
117
|
+
- email (string)
|
|
118
|
+
- password (string)
|
|
119
|
+
- isActive (boolean)
|
|
120
|
+
|
|
121
|
+
### Swagger
|
|
122
|
+
|
|
123
|
+
Activer la documentation Swagger/OpenAPI :
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
--swagger # Active Swagger UI
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
**Exemple :**
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
nestcraftx new mon-api --light --swagger
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Swagger sera accessible a : `http://localhost:3000/api/docs`
|
|
136
|
+
|
|
137
|
+
### Docker
|
|
138
|
+
|
|
139
|
+
Desactiver Docker (active par defaut) :
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
--docker=false # Desactive Docker
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
**Exemple :**
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
nestcraftx new mon-api --light --docker=false
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## Exemples de commandes completes
|
|
152
|
+
|
|
153
|
+
### Projet LIGHT avec toutes les options
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
nestcraftx new mon-api --light --orm=prisma --auth --swagger
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### Projet FULL avec TypeORM et Auth
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
nestcraftx new mon-api --full --orm=typeorm --auth
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### Projet minimal LIGHT (mode interactif)
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
nestcraftx new mon-api --light
|
|
169
|
+
# Le CLI demandera toutes les options necessaires
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### Projet MongoDB avec Mongoose
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
nestcraftx new mon-api --light --orm=mongoose --auth --swagger
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
## Configuration automatique
|
|
179
|
+
|
|
180
|
+
### Fichier .env genere
|
|
181
|
+
|
|
182
|
+
Le CLI genere automatiquement un fichier `.env` avec :
|
|
183
|
+
|
|
184
|
+
**Pour PostgreSQL (Prisma/TypeORM) :**
|
|
185
|
+
|
|
186
|
+
```env
|
|
187
|
+
NODE_ENV=development
|
|
188
|
+
PORT=3000
|
|
189
|
+
JWT_SECRET=<secret-auto-genere-64-chars>
|
|
190
|
+
JWT_REFRESH_SECRET=<secret-auto-genere-64-chars>
|
|
191
|
+
JWT_EXPIRES_IN=15m
|
|
192
|
+
JWT_REFRESH_EXPIRES_IN=7d
|
|
193
|
+
POSTGRES_USER=postgres
|
|
194
|
+
POSTGRES_PASSWORD=postgres
|
|
195
|
+
POSTGRES_DB=mon-api
|
|
196
|
+
POSTGRES_HOST=localhost
|
|
197
|
+
POSTGRES_PORT=5432
|
|
198
|
+
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/mon-api?schema=public
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
**Pour MongoDB (Mongoose) :**
|
|
202
|
+
|
|
203
|
+
```env
|
|
204
|
+
NODE_ENV=development
|
|
205
|
+
PORT=3000
|
|
206
|
+
JWT_SECRET=<secret-auto-genere-64-chars>
|
|
207
|
+
JWT_REFRESH_SECRET=<secret-auto-genere-64-chars>
|
|
208
|
+
JWT_EXPIRES_IN=15m
|
|
209
|
+
JWT_REFRESH_EXPIRES_IN=7d
|
|
210
|
+
MONGO_URI=mongodb://localhost:27017
|
|
211
|
+
MONGO_DB=mon-api
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
Les secrets JWT sont generes automatiquement de maniere securisee.
|
|
215
|
+
|
|
216
|
+
## Modes Interactifs
|
|
217
|
+
|
|
218
|
+
### Mode LIGHT Interactif
|
|
219
|
+
|
|
220
|
+
Si vous ne fournissez pas tous les flags necessaires, le CLI passera en mode interactif pour demander les options manquantes.
|
|
221
|
+
|
|
222
|
+
**Exemple :**
|
|
223
|
+
|
|
224
|
+
```bash
|
|
225
|
+
nestcraftx new mon-api --light
|
|
226
|
+
|
|
227
|
+
[MODE LIGHT] Configuration simplifiee pour mon-api
|
|
228
|
+
|
|
229
|
+
[?] Choisissez un ORM (prisma, typeorm, mongoose) [prisma]: prisma
|
|
230
|
+
[?] Activer l'authentification JWT ? (Y/n): y
|
|
231
|
+
[INFO] Auth active : ajout automatique de l'entite User
|
|
232
|
+
[?] Activer Swagger pour la documentation API ? (Y/n): y
|
|
233
|
+
[?] Generer les fichiers Docker ? (Y/n): y
|
|
234
|
+
|
|
235
|
+
[INFO] Configuration PostgreSQL
|
|
236
|
+
Utilisateur PostgreSQL [postgres]:
|
|
237
|
+
Mot de passe PostgreSQL [postgres]:
|
|
238
|
+
Nom de la base [mon-api]:
|
|
239
|
+
Hote PostgreSQL [localhost]:
|
|
240
|
+
Port PostgreSQL [5432]:
|
|
241
|
+
|
|
242
|
+
[?] Voulez-vous ajouter des entites supplementaires ? (Y/n): n
|
|
243
|
+
|
|
244
|
+
[INFO] Demarrage de la generation du projet...
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
### Mode FULL Interactif
|
|
248
|
+
|
|
249
|
+
Le mode FULL est toujours interactif pour vous donner un controle total sur la configuration.
|
|
250
|
+
|
|
251
|
+
**Exemple :**
|
|
252
|
+
|
|
253
|
+
```bash
|
|
254
|
+
nestcraftx new mon-projet
|
|
255
|
+
|
|
256
|
+
[MODE FULL] Configuration complete avec Clean Architecture
|
|
257
|
+
|
|
258
|
+
[?] Nom du projet : mon-projet
|
|
259
|
+
[?] Base de donnees (postgresql, mongodb) [postgresql]: postgresql
|
|
260
|
+
|
|
261
|
+
[INFO] Configuration PostgreSQL
|
|
262
|
+
Utilisateur PostgreSQL [postgres]:
|
|
263
|
+
Mot de passe PostgreSQL [postgres]:
|
|
264
|
+
...
|
|
265
|
+
|
|
266
|
+
[?] ORM pour PostgreSQL (prisma, typeorm) [prisma]: prisma
|
|
267
|
+
[?] Utiliser Yarn ? (Y/n): n
|
|
268
|
+
[?] Generer fichiers Docker ? (Y/n): y
|
|
269
|
+
[?] Ajouter authentification JWT ? (Y/n): y
|
|
270
|
+
[?] Installer Swagger ? (Y/n): y
|
|
271
|
+
|
|
272
|
+
[INFO] Configuration Swagger
|
|
273
|
+
Titre API [mon-projet API]:
|
|
274
|
+
Description [API generated by NestCraftX]:
|
|
275
|
+
Version [1.0.0]:
|
|
276
|
+
Endpoint [api/docs]:
|
|
277
|
+
|
|
278
|
+
[INFO] Saisie des entites (Mode FULL - Architecture complete)
|
|
279
|
+
[?] Ajouter une entite ? (Y/n): y
|
|
280
|
+
Nom de l'entite : post
|
|
281
|
+
Champs pour "post" :
|
|
282
|
+
Nom du champ (vide pour terminer) : title
|
|
283
|
+
Type de "title" (string, number, boolean, Date, enum) : string
|
|
284
|
+
Nom du champ (vide pour terminer) : content
|
|
285
|
+
Type de "content" (string, number, boolean, Date, enum) : string
|
|
286
|
+
Nom du champ (vide pour terminer) :
|
|
287
|
+
|
|
288
|
+
[✓] Entite "post" ajoutee avec 2 champ(s)
|
|
289
|
+
[?] Ajouter une autre entite ? (Y/n): n
|
|
290
|
+
[?] Ajouter des relations entre entites ? (Y/n): n
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
## Apres la creation
|
|
294
|
+
|
|
295
|
+
```bash
|
|
296
|
+
cd mon-projet
|
|
297
|
+
npm run start:dev
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
Si Swagger est active :
|
|
301
|
+
|
|
302
|
+
```
|
|
303
|
+
http://localhost:3000/api/docs
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
## Autres commandes
|
|
307
|
+
|
|
308
|
+
### Verifier l'environnement
|
|
309
|
+
|
|
310
|
+
```bash
|
|
311
|
+
nestcraftx test
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
### Informations CLI
|
|
315
|
+
|
|
316
|
+
```bash
|
|
317
|
+
nestcraftx info
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
### Aide
|
|
321
|
+
|
|
322
|
+
```bash
|
|
323
|
+
nestcraftx --help
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
## Notes importantes
|
|
327
|
+
|
|
328
|
+
- Les secrets JWT sont auto-generes de maniere securisee (64 caracteres)
|
|
329
|
+
- DATABASE_URL est automatiquement construit selon l'ORM choisi
|
|
330
|
+
- Docker est active par defaut en mode LIGHT
|
|
331
|
+
- Le mode FULL necessite une configuration interactive si aucune option n'est fournie
|