nestjs-archi-cli 1.0.0

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.
Files changed (67) hide show
  1. package/License.yaml +0 -0
  2. package/README.md +140 -0
  3. package/dist/index.js +29 -0
  4. package/package.json +47 -0
  5. package/template/.dockerignore +6 -0
  6. package/template/.env.example +12 -0
  7. package/template/.prettierrc +4 -0
  8. package/template/Dockerfile +48 -0
  9. package/template/README.md +99 -0
  10. package/template/aborescence.txt +238 -0
  11. package/template/docker-compose-dev.yml +22 -0
  12. package/template/docker-compose-prod.yml +20 -0
  13. package/template/dockerfile.dev +25 -0
  14. package/template/eslint.config.mjs +35 -0
  15. package/template/nest-cli.json +8 -0
  16. package/template/package.json +98 -0
  17. package/template/pnpm-lock.yaml +7665 -0
  18. package/template/prisma/schema.prisma +48 -0
  19. package/template/src/app.controller.spec.ts +22 -0
  20. package/template/src/app.controller.ts +20 -0
  21. package/template/src/app.module.ts +49 -0
  22. package/template/src/app.service.ts +8 -0
  23. package/template/src/common/auth/auth.controller.ts +51 -0
  24. package/template/src/common/auth/auth.module.ts +24 -0
  25. package/template/src/common/auth/auth.service.ts +72 -0
  26. package/template/src/common/auth/dto/create-auth.dto.ts +12 -0
  27. package/template/src/common/auth/dto/update-auth.dto.ts +11 -0
  28. package/template/src/common/auth/jwt/auth.guard.ts +45 -0
  29. package/template/src/common/auth/jwt/constant.ts +3 -0
  30. package/template/src/common/auth/jwt/jwt.guard.ts +6 -0
  31. package/template/src/common/auth/jwt/jwt.strategy.ts +46 -0
  32. package/template/src/common/auth/role/role.decorators.ts +3 -0
  33. package/template/src/common/auth/role/role.enum.ts +7 -0
  34. package/template/src/common/auth/role/role.guard.ts +34 -0
  35. package/template/src/common/http/http-client.module.ts +23 -0
  36. package/template/src/common/http/http-client.service.ts +127 -0
  37. package/template/src/common/logger/error.logging.ts +29 -0
  38. package/template/src/common/logger/logging.interceptor.ts +22 -0
  39. package/template/src/common/notification/notification.module.ts +12 -0
  40. package/template/src/common/notification/notification.service.ts +74 -0
  41. package/template/src/config/db.module.ts +15 -0
  42. package/template/src/config/db.ts +22 -0
  43. package/template/src/config/env.validation.ts +35 -0
  44. package/template/src/features/kafka/kafka.consumer.controller.ts +66 -0
  45. package/template/src/features/kafka/kafka.consumer.service.ts +89 -0
  46. package/template/src/features/kafka/kafka.module.ts +20 -0
  47. package/template/src/features/kafka/kafka.producer.service.ts +29 -0
  48. package/template/src/features/user/core/dto/create-user.dto.ts +28 -0
  49. package/template/src/features/user/core/dto/update-user.dto.ts +66 -0
  50. package/template/src/features/user/core/interface/user.repository.interface.ts +20 -0
  51. package/template/src/features/user/core/use-case/user.service.ts +101 -0
  52. package/template/src/features/user/inBound/user.controller.ts +117 -0
  53. package/template/src/features/user/outBound/user.repository.ts +332 -0
  54. package/template/src/features/user/user.module.ts +14 -0
  55. package/template/src/main.ts +59 -0
  56. package/template/src/utils/crypt.ts +36 -0
  57. package/template/src/utils/generate.ts +90 -0
  58. package/template/src/utils/logging.prisma.ts +17 -0
  59. package/template/src/utils/validation-fields.ts +15 -0
  60. package/template/src/utils/validation-option.ts +94 -0
  61. package/template/src/utils/validators/phoneNumber.validate.ts +22 -0
  62. package/template/test/app.e2e-spec.js +19 -0
  63. package/template/test/app.e2e-spec.ts +25 -0
  64. package/template/test/jest-e2e.json +9 -0
  65. package/template/tsconfig.build.json +27 -0
  66. package/template/tsconfig.build.tsbuildinfo +1 -0
  67. package/template/tsconfig.json +29 -0
package/License.yaml ADDED
File without changes
package/README.md ADDED
@@ -0,0 +1,140 @@
1
+ # NestJS Archi CLI
2
+
3
+
4
+ [![npm version](https://img.shields.io/npm/v/nestjs-archi-cli?color=blue)](https://www.npmjs.com/package/nestjs-archi-cli)
5
+ [![license](https://img.shields.io/npm/l/nestjs-archi-cli?color=green)](LICENSE)
6
+ [![build](https://img.shields.io/github/actions/workflow/status/Konanycode1/nestjs-archi-cli/build.yml?branch=main)](https://github.com/Konanycode1/nestjs-archi-cli/actions)
7
+
8
+ πŸš€ **NestJS Archi CLI** est un outil en ligne de commande pour gΓ©nΓ©rer rapidement un projet NestJS avec une **architecture prΓ©dΓ©finie et prΓͺte Γ  l’emploi**.
9
+
10
+ Il permet de crΓ©er un boilerplate propre avec les dossiers, modules et services dΓ©jΓ  organisΓ©s selon de bonnes pratiques.
11
+
12
+ ---
13
+
14
+ ---
15
+
16
+ ## 🌟 Features
17
+
18
+ - Structure de dossier **prΓ©-dΓ©finie** (`src/modules`, `common`, `config`, `utils`, `features`, etc.)
19
+ - Modules NestJS prΓͺts Γ  l’emploi : auth, user, kafka, notifications, utils, etc.
20
+ - Fichiers TypeScript et configuration TS/Prisma inclus
21
+ - Dockerfile et docker-compose pour dev et prod
22
+ - Compatible avec **pnpm, npm ou yarn**
23
+ - CLI simple : `npx nestjs-archi my-app`
24
+
25
+ ---
26
+
27
+ ## πŸ’Ώ Installation
28
+
29
+ ### Avec npx (recommandΓ©)
30
+ ```bash
31
+ npx nestjs-archi-cli my-app
32
+
33
+ cd my-app
34
+
35
+ pnpm install # ou npm install / yarn install
36
+
37
+ pnpm run start:dev # ou npm run start:dev
38
+
39
+ ```
40
+
41
+ ## πŸ“ Structure gΓ©nΓ©rΓ©e (exemple)
42
+
43
+ Lorsque vous crΓ©ez un projet avec **NestJS Archi CLI**, la structure suivante sera gΓ©nΓ©rΓ©e :
44
+
45
+ ```
46
+ nestjs-repos/
47
+ β”‚ β”œβ”€ prisma/
48
+ β”‚ β”‚ └─ schema.prisma
49
+ β”‚ β”œβ”€ src/
50
+ β”‚ β”œβ”€ common/
51
+ β”‚ β”‚ β”œβ”€ auth/
52
+ β”‚ β”‚ β”‚ β”œβ”€ dto/
53
+ β”‚ β”‚ β”‚ β”‚ β”œβ”€ create-auth.dto.ts
54
+ β”‚ β”‚ β”‚ β”‚ └─ update-auth.dto.ts
55
+ β”‚ β”‚ β”‚ β”œβ”€ jwt/
56
+ β”‚ β”‚ β”‚ β”‚ β”œβ”€ auth.guard.ts
57
+ β”‚ β”‚ β”‚ β”‚ β”œβ”€ constant.ts
58
+ β”‚ β”‚ β”‚ β”‚ β”œβ”€ jwt.guard.ts
59
+ β”‚ β”‚ β”‚ β”‚ └─ jwt.strategy.ts
60
+ β”‚ β”‚ β”‚ β”œβ”€ role/
61
+ β”‚ β”‚ β”‚ β”‚ β”œβ”€ role.decorators.ts
62
+ β”‚ β”‚ β”‚ β”‚ β”œβ”€ role.enum.ts
63
+ β”‚ β”‚ β”‚ β”‚ └─ role.guard.ts
64
+ β”‚ β”‚ β”‚ β”œβ”€ auth.controller.ts
65
+ β”‚ β”‚ β”‚ β”œβ”€ auth.module.ts
66
+ β”‚ β”‚ β”‚ └─ auth.service.ts
67
+ β”‚ β”‚ β”œβ”€ http/
68
+ β”‚ β”‚ β”‚ β”œβ”€ http-client.module.ts
69
+ β”‚ β”‚ β”‚ └─ http-client.service.ts
70
+ β”‚ β”‚ β”œβ”€ logger/
71
+ β”‚ β”‚ β”‚ β”œβ”€ error.logging.ts
72
+ β”‚ β”‚ β”‚ └─ logging.interceptor.ts
73
+ β”‚ β”‚ └─ notification/
74
+ β”‚ β”‚ β”œβ”€ notification.module.ts
75
+ β”‚ β”‚ └─ notification.service.ts
76
+ β”‚ β”œβ”€ config/
77
+ β”‚ β”‚ β”œβ”€ db.module.ts
78
+ β”‚ β”‚ β”œβ”€ db.ts
79
+ β”‚ β”‚ └─ env.validation.ts
80
+ β”‚ β”œβ”€ features/
81
+ β”‚ β”‚ β”œβ”€ kafka/
82
+ β”‚ β”‚ β”‚ β”œβ”€ kafka.consumer.controller.ts
83
+ β”‚ β”‚ β”‚ β”œβ”€ kafka.consumer.service.ts
84
+ β”‚ β”‚ β”‚ β”œβ”€ kafka.module.ts
85
+ β”‚ β”‚ β”‚ └─ kafka.producer.service.ts
86
+ β”‚ β”‚ └─ user/
87
+ β”‚ β”‚ β”œβ”€ core/
88
+ β”‚ β”‚ β”‚ β”œβ”€ dto/
89
+ β”‚ β”‚ β”‚ β”‚ β”œβ”€ create-user.dto.ts
90
+ β”‚ β”‚ β”‚ β”‚ └─ update-user.dto.ts
91
+ β”‚ β”‚ β”‚ β”œβ”€ interface/
92
+ β”‚ β”‚ β”‚ β”‚ └─ user.repository.interface.ts
93
+ β”‚ β”‚ β”‚ └─ use-case/
94
+ β”‚ β”‚ β”‚ └─ user.service.ts
95
+ β”‚ β”‚ β”œβ”€ inBound/
96
+ β”‚ β”‚ β”‚ └─ user.controller.ts
97
+ β”‚ β”‚ β”œβ”€ outBound/
98
+ β”‚ β”‚ β”‚ └─ user.repository.ts
99
+ β”‚ β”‚ └─ user.module.ts
100
+ β”‚ β”œβ”€ utils/
101
+ β”‚ β”‚ β”œβ”€ validators/
102
+ β”‚ β”‚ β”‚ └─ phoneNumber.validate.ts
103
+ β”‚ β”‚ β”œβ”€ crypt.ts
104
+ β”‚ β”‚ β”œβ”€ generate.ts
105
+ β”‚ β”‚ β”œβ”€ logging.prisma.ts
106
+ β”‚ β”‚ β”œβ”€ validation-fields.ts
107
+ β”‚ β”‚ └─ validation-option.ts
108
+ β”‚ β”œβ”€ app.controller.spec.ts
109
+ β”‚ β”œβ”€ app.controller.ts
110
+ β”‚ β”œβ”€ app.module.ts
111
+ β”‚ β”œβ”€ app.service.ts
112
+ β”‚ └─ main.ts
113
+ β”œβ”€ test/
114
+ β”‚ β”œβ”€ app.e2e-spec.js
115
+ β”‚ β”œβ”€ app.e2e-spec.ts
116
+ β”‚ └─ jest-e2e.json
117
+ β”œβ”€ .dockerignore
118
+ β”œβ”€ .env
119
+ β”œβ”€ .env.example
120
+ β”œβ”€ .env.production
121
+ β”œβ”€ .gitignore
122
+ β”œβ”€ .prettierrc
123
+ β”œβ”€ aborescence.txt
124
+ β”œβ”€ docker-compose-dev.yml
125
+ β”œβ”€ docker-compose-prod.yml
126
+ β”œβ”€ Dockerfile
127
+ β”œβ”€ dockerfile.dev
128
+ β”œβ”€ eslint.config.mjs
129
+ β”œβ”€ nest-cli.json
130
+ β”œβ”€ package.json
131
+ β”œβ”€ pnpm-lock.yaml
132
+ β”œβ”€ README.md
133
+ β”œβ”€ tsconfig.build.json
134
+ β”œβ”€ tsconfig.build.tsbuildinfo
135
+ └─ tsconfig.json
136
+
137
+
138
+ > Cette structure assure que le code est **modulaire, lisible et maintenable**, mΓͺme pour des projets complexes avec plusieurs modules mΓ©tier.
139
+
140
+
package/dist/index.js ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env node
2
+ import fs from "fs-extra";
3
+ import path from "path";
4
+ import inquirer from "inquirer";
5
+ import chalk from "chalk";
6
+ import { fileURLToPath } from "url";
7
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
8
+ async function main() {
9
+ console.log(chalk.cyan("\nπŸš€ GΓ©nΓ©rateur de repo NestJS customisΓ©\n"));
10
+ const { projectName } = await inquirer.prompt([
11
+ {
12
+ name: "projectName",
13
+ message: "project name:",
14
+ default: "my-nest-app"
15
+ }
16
+ ]);
17
+ const targetPath = path.join(process.cwd(), projectName);
18
+ const templatePath = path.join(__dirname, "../template");
19
+ if (fs.existsSync(targetPath)) {
20
+ console.log(chalk.red(`❌ your project ${projectName} already exists.`));
21
+ process.exit(1);
22
+ }
23
+ console.log(chalk.yellow("πŸ“‚ copy your code ..."));
24
+ await fs.copy(templatePath, targetPath);
25
+ console.log(chalk.green(`\nβœ… Project ${projectName} created !`));
26
+ console.log(chalk.blue(`πŸ‘‰ cd ${projectName} && pnpm install`));
27
+ console.log(chalk.blue(`πŸ‘‰ pnpm run start:dev`));
28
+ }
29
+ main();
package/package.json ADDED
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "nestjs-archi-cli",
3
+ "version": "1.0.0",
4
+ "description": "CLI tool to quickly scaffold a NestJS project with a predefined clean architecture",
5
+ "bin": {
6
+ "nestjs-archi": "dist/index.js"
7
+ },
8
+ "keywords": [
9
+ "nestjs",
10
+ "cli",
11
+ "architecture",
12
+ "boilerplate",
13
+ "generator",
14
+ "typescript"
15
+ ],
16
+ "author": "Abraham konan abrahamkonany@gmail.com",
17
+ "license": "MIT",
18
+ "homepage": "https://github.com/Konanycode1/nestjs-archi-cli#readme",
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "https://github.com/Konanycode1/nestjs-archi-cli.git"
22
+ },
23
+ "bugs": {
24
+ "url": "https://github.com/Konanycode1/nestjs-archi-cli/issues"
25
+ },
26
+ "files": [
27
+ "dist",
28
+ "template"
29
+ ],
30
+ "type": "module",
31
+ "scripts": {
32
+ "build": "tsc",
33
+ "dev": "ts-node src/index.ts"
34
+ },
35
+ "dependencies": {
36
+ "chalk": "^5.3.0",
37
+ "fs-extra": "^11.2.0",
38
+ "inquirer": "^9.2.7"
39
+ },
40
+ "devDependencies": {
41
+ "@types/chalk": "^0.4.31",
42
+ "@types/fs-extra": "^11.0.4",
43
+ "@types/inquirer": "^9.0.9",
44
+ "ts-node": "^10.9.2",
45
+ "typescript": "^5.4.0"
46
+ }
47
+ }
@@ -0,0 +1,6 @@
1
+ # .dockerignore
2
+ node_modules
3
+ npm-debug.log*
4
+ Dockerfile*
5
+ .git
6
+ dockerfile.dev
@@ -0,0 +1,12 @@
1
+
2
+ DATABASE_URL=
3
+ NODE_ENV=
4
+ PORT=
5
+ JWT_SECRET= '
6
+ JWT_EXPIRES_IN=
7
+ JWT_REFRESH_SECRET=
8
+ JWT_REFRESH_EXPIRES_IN=
9
+ KAFKA_CLIENT_ID=nestjs-archi-cli
10
+ KAFKA_BROKERS=kafka:9092
11
+ KAFKA_CONSUMER_GROUP_ID=
12
+
@@ -0,0 +1,4 @@
1
+ {
2
+ "singleQuote": true,
3
+ "trailingComma": "all"
4
+ }
@@ -0,0 +1,48 @@
1
+ # Stage 1: Development
2
+ FROM node:20-alpine AS development
3
+
4
+
5
+ # Dépendances système pour canvas
6
+ #RUN apt-get update && apt-get install -y \ build-essential \libcairo2-dev \libpango1.0-dev \libjpeg-dev \libgif-dev \librsvg2-dev
7
+
8
+
9
+ RUN npm i -g pnpm
10
+ WORKDIR /usr/src/app
11
+
12
+ COPY --chown=node:node pnpm-lock.yaml ./
13
+ RUN pnpm fetch --prod
14
+ COPY --chown=node:node . .
15
+ RUN pnpm install
16
+ RUN pnpm prisma generate
17
+ USER node
18
+
19
+ # Stage 2: Build
20
+ FROM node:20-alpine AS build
21
+ RUN npm i -g pnpm
22
+ WORKDIR /usr/src/app
23
+ COPY --chown=node:node pnpm-lock.yaml ./
24
+ COPY --chown=node:node --from=development /usr/src/app/node_modules ./node_modules
25
+ COPY --chown=node:node . .
26
+ RUN pnpm build
27
+ ENV NODE_ENV=production
28
+ RUN npx prisma generate && npx prisma db push
29
+
30
+ RUN pnpm install --prod --ignore-scripts \
31
+ && npm rebuild bcrypt --build-from-source
32
+ USER node
33
+
34
+ # Stage 3: Production
35
+ FROM node:20-alpine AS production
36
+
37
+ RUN apk add --no-cache ffmpeg
38
+ RUN apk add --no-cache curl
39
+ # DΓ©finir le rΓ©pertoire de travail de l'application
40
+ WORKDIR /usr/src/app
41
+
42
+ # Copier les dΓ©pendances et fichiers de build depuis le stage `build`
43
+ COPY --from=build /usr/src/app/node_modules ./node_modules
44
+ COPY --from=build /usr/src/app/dist ./dist
45
+
46
+ COPY --from=build /usr/src/app/.env.delivery .env
47
+ # DΓ©finir la commande de lancement de l'application en production
48
+ CMD ["node", "dist/src/main.js"]
@@ -0,0 +1,99 @@
1
+ <p align="center">
2
+ <a href="http://nestjs.com/" target="blank"><img src="https://nestjs.com/img/logo-small.svg" width="120" alt="Nest Logo" /></a>
3
+ </p>
4
+
5
+ [circleci-image]: https://img.shields.io/circleci/build/github/nestjs/nest/master?token=abc123def456
6
+ [circleci-url]: https://circleci.com/gh/nestjs/nest
7
+
8
+ <p align="center">A progressive <a href="http://nodejs.org" target="_blank">Node.js</a> framework for building efficient and scalable server-side applications.</p>
9
+ <p align="center">
10
+ <a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/v/@nestjs/core.svg" alt="NPM Version" /></a>
11
+ <a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/l/@nestjs/core.svg" alt="Package License" /></a>
12
+ <a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/dm/@nestjs/common.svg" alt="NPM Downloads" /></a>
13
+ <a href="https://circleci.com/gh/nestjs/nest" target="_blank"><img src="https://img.shields.io/circleci/build/github/nestjs/nest/master" alt="CircleCI" /></a>
14
+ <a href="https://coveralls.io/github/nestjs/nest?branch=master" target="_blank"><img src="https://coveralls.io/repos/github/nestjs/nest/badge.svg?branch=master#9" alt="Coverage" /></a>
15
+ <a href="https://discord.gg/G7Qnnhy" target="_blank"><img src="https://img.shields.io/badge/discord-online-brightgreen.svg" alt="Discord"/></a>
16
+ <a href="https://opencollective.com/nest#backer" target="_blank"><img src="https://opencollective.com/nest/backers/badge.svg" alt="Backers on Open Collective" /></a>
17
+ <a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://opencollective.com/nest/sponsors/badge.svg" alt="Sponsors on Open Collective" /></a>
18
+ <a href="https://paypal.me/kamilmysliwiec" target="_blank"><img src="https://img.shields.io/badge/Donate-PayPal-ff3f59.svg" alt="Donate us"/></a>
19
+ <a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://img.shields.io/badge/Support%20us-Open%20Collective-41B883.svg" alt="Support us"></a>
20
+ <a href="https://twitter.com/nestframework" target="_blank"><img src="https://img.shields.io/twitter/follow/nestframework.svg?style=social&label=Follow" alt="Follow us on Twitter"></a>
21
+ </p>
22
+ <!--[![Backers on Open Collective](https://opencollective.com/nest/backers/badge.svg)](https://opencollective.com/nest#backer)
23
+ [![Sponsors on Open Collective](https://opencollective.com/nest/sponsors/badge.svg)](https://opencollective.com/nest#sponsor)-->
24
+
25
+ ## Description
26
+
27
+ [Nest](https://github.com/nestjs/nest) framework TypeScript starter repository.
28
+
29
+ ## Project setup
30
+
31
+ ```bash
32
+ $ pnpm install
33
+ ```
34
+
35
+ ## Compile and run the project
36
+
37
+ ```bash
38
+ # development
39
+ $ pnpm run start
40
+
41
+ # watch mode
42
+ $ pnpm run start:dev
43
+
44
+ # production mode
45
+ $ pnpm run start:prod
46
+ ```
47
+
48
+ ## Run tests
49
+
50
+ ```bash
51
+ # unit tests
52
+ $ pnpm run test
53
+
54
+ # e2e tests
55
+ $ pnpm run test:e2e
56
+
57
+ # test coverage
58
+ $ pnpm run test:cov
59
+ ```
60
+
61
+ ## Deployment
62
+
63
+ When you're ready to deploy your NestJS application to production, there are some key steps you can take to ensure it runs as efficiently as possible. Check out the [deployment documentation](https://docs.nestjs.com/deployment) for more information.
64
+
65
+ If you are looking for a cloud-based platform to deploy your NestJS application, check out [Mau](https://mau.nestjs.com), our official platform for deploying NestJS applications on AWS. Mau makes deployment straightforward and fast, requiring just a few simple steps:
66
+
67
+ ```bash
68
+ $ pnpm install -g mau
69
+ $ mau deploy
70
+ ```
71
+
72
+ With Mau, you can deploy your application in just a few clicks, allowing you to focus on building features rather than managing infrastructure.
73
+
74
+ ## Resources
75
+
76
+ Check out a few resources that may come in handy when working with NestJS:
77
+
78
+ - Visit the [NestJS Documentation](https://docs.nestjs.com) to learn more about the framework.
79
+ - For questions and support, please visit our [Discord channel](https://discord.gg/G7Qnnhy).
80
+ - To dive deeper and get more hands-on experience, check out our official video [courses](https://courses.nestjs.com/).
81
+ - Deploy your application to AWS with the help of [NestJS Mau](https://mau.nestjs.com) in just a few clicks.
82
+ - Visualize your application graph and interact with the NestJS application in real-time using [NestJS Devtools](https://devtools.nestjs.com).
83
+ - Need help with your project (part-time to full-time)? Check out our official [enterprise support](https://enterprise.nestjs.com).
84
+ - To stay in the loop and get updates, follow us on [X](https://x.com/nestframework) and [LinkedIn](https://linkedin.com/company/nestjs).
85
+ - Looking for a job, or have a job to offer? Check out our official [Jobs board](https://jobs.nestjs.com).
86
+
87
+ ## Support
88
+
89
+ Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support).
90
+
91
+ ## Stay in touch
92
+
93
+ - Author - [Kamil MyΕ›liwiec](https://twitter.com/kammysliwiec)
94
+ - Website - [https://nestjs.com](https://nestjs.com/)
95
+ - Twitter - [@nestframework](https://twitter.com/nestframework)
96
+
97
+ ## License
98
+
99
+ Nest is [MIT licensed](https://github.com/nestjs/nest/blob/master/LICENSE).
@@ -0,0 +1,238 @@
1
+ nestjs-repo-architecture/
2
+ β”œβ”€ dist/
3
+ β”‚ β”œβ”€ src/
4
+ β”‚ β”‚ β”œβ”€ common/
5
+ β”‚ β”‚ β”‚ β”œβ”€ auth/
6
+ β”‚ β”‚ β”‚ β”‚ β”œβ”€ dto/
7
+ β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€ create-auth.dto.d.ts
8
+ β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€ create-auth.dto.js
9
+ β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€ create-auth.dto.js.map
10
+ β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€ update-auth.dto.d.ts
11
+ β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€ update-auth.dto.js
12
+ β”‚ β”‚ β”‚ β”‚ β”‚ └─ update-auth.dto.js.map
13
+ β”‚ β”‚ β”‚ β”‚ β”œβ”€ jwt/
14
+ β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€ auth.guard.d.ts
15
+ β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€ auth.guard.js
16
+ β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€ auth.guard.js.map
17
+ β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€ constant.d.ts
18
+ β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€ constant.js
19
+ β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€ constant.js.map
20
+ β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€ jwt.guard.d.ts
21
+ β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€ jwt.guard.js
22
+ β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€ jwt.guard.js.map
23
+ β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€ jwt.strategy.d.ts
24
+ β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€ jwt.strategy.js
25
+ β”‚ β”‚ β”‚ β”‚ β”‚ └─ jwt.strategy.js.map
26
+ β”‚ β”‚ β”‚ β”‚ β”œβ”€ role/
27
+ β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€ role.decorators.d.ts
28
+ β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€ role.decorators.js
29
+ β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€ role.decorators.js.map
30
+ β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€ role.enum.d.ts
31
+ β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€ role.enum.js
32
+ β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€ role.enum.js.map
33
+ β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€ role.guard.d.ts
34
+ β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€ role.guard.js
35
+ β”‚ β”‚ β”‚ β”‚ β”‚ └─ role.guard.js.map
36
+ β”‚ β”‚ β”‚ β”‚ β”œβ”€ auth.controller.d.ts
37
+ β”‚ β”‚ β”‚ β”‚ β”œβ”€ auth.controller.js
38
+ β”‚ β”‚ β”‚ β”‚ β”œβ”€ auth.controller.js.map
39
+ β”‚ β”‚ β”‚ β”‚ β”œβ”€ auth.module.d.ts
40
+ β”‚ β”‚ β”‚ β”‚ β”œβ”€ auth.module.js
41
+ β”‚ β”‚ β”‚ β”‚ β”œβ”€ auth.module.js.map
42
+ β”‚ β”‚ β”‚ β”‚ β”œβ”€ auth.service.d.ts
43
+ β”‚ β”‚ β”‚ β”‚ β”œβ”€ auth.service.js
44
+ β”‚ β”‚ β”‚ β”‚ └─ auth.service.js.map
45
+ β”‚ β”‚ β”‚ β”œβ”€ http/
46
+ β”‚ β”‚ β”‚ β”‚ β”œβ”€ http-client.module.d.ts
47
+ β”‚ β”‚ β”‚ β”‚ β”œβ”€ http-client.module.js
48
+ β”‚ β”‚ β”‚ β”‚ β”œβ”€ http-client.module.js.map
49
+ β”‚ β”‚ β”‚ β”‚ β”œβ”€ http-client.service.d.ts
50
+ β”‚ β”‚ β”‚ β”‚ β”œβ”€ http-client.service.js
51
+ β”‚ β”‚ β”‚ β”‚ └─ http-client.service.js.map
52
+ β”‚ β”‚ β”‚ β”œβ”€ logger/
53
+ β”‚ β”‚ β”‚ β”‚ β”œβ”€ error.logging.d.ts
54
+ β”‚ β”‚ β”‚ β”‚ β”œβ”€ error.logging.js
55
+ β”‚ β”‚ β”‚ β”‚ β”œβ”€ error.logging.js.map
56
+ β”‚ β”‚ β”‚ β”‚ β”œβ”€ logging.interceptor.d.ts
57
+ β”‚ β”‚ β”‚ β”‚ β”œβ”€ logging.interceptor.js
58
+ β”‚ β”‚ β”‚ β”‚ └─ logging.interceptor.js.map
59
+ β”‚ β”‚ β”‚ └─ notification/
60
+ β”‚ β”‚ β”‚ β”œβ”€ notification.module.d.ts
61
+ β”‚ β”‚ β”‚ β”œβ”€ notification.module.js
62
+ β”‚ β”‚ β”‚ β”œβ”€ notification.module.js.map
63
+ β”‚ β”‚ β”‚ β”œβ”€ notification.service.d.ts
64
+ β”‚ β”‚ β”‚ β”œβ”€ notification.service.js
65
+ β”‚ β”‚ β”‚ └─ notification.service.js.map
66
+ β”‚ β”‚ β”œβ”€ config/
67
+ β”‚ β”‚ β”‚ β”œβ”€ db.d.ts
68
+ β”‚ β”‚ β”‚ β”œβ”€ db.js
69
+ β”‚ β”‚ β”‚ β”œβ”€ db.js.map
70
+ β”‚ β”‚ β”‚ β”œβ”€ db.module.d.ts
71
+ β”‚ β”‚ β”‚ β”œβ”€ db.module.js
72
+ β”‚ β”‚ β”‚ β”œβ”€ db.module.js.map
73
+ β”‚ β”‚ β”‚ β”œβ”€ env.validation.d.ts
74
+ β”‚ β”‚ β”‚ β”œβ”€ env.validation.js
75
+ β”‚ β”‚ β”‚ └─ env.validation.js.map
76
+ β”‚ β”‚ β”œβ”€ features/
77
+ β”‚ β”‚ β”‚ β”œβ”€ kafka/
78
+ β”‚ β”‚ β”‚ β”‚ β”œβ”€ kafka.consumer.controller.d.ts
79
+ β”‚ β”‚ β”‚ β”‚ β”œβ”€ kafka.consumer.controller.js
80
+ β”‚ β”‚ β”‚ β”‚ β”œβ”€ kafka.consumer.controller.js.map
81
+ β”‚ β”‚ β”‚ β”‚ β”œβ”€ kafka.consumer.service.d.ts
82
+ β”‚ β”‚ β”‚ β”‚ β”œβ”€ kafka.consumer.service.js
83
+ β”‚ β”‚ β”‚ β”‚ β”œβ”€ kafka.consumer.service.js.map
84
+ β”‚ β”‚ β”‚ β”‚ β”œβ”€ kafka.module.d.ts
85
+ β”‚ β”‚ β”‚ β”‚ β”œβ”€ kafka.module.js
86
+ β”‚ β”‚ β”‚ β”‚ β”œβ”€ kafka.module.js.map
87
+ β”‚ β”‚ β”‚ β”‚ β”œβ”€ kafka.producer.service.d.ts
88
+ β”‚ β”‚ β”‚ β”‚ β”œβ”€ kafka.producer.service.js
89
+ β”‚ β”‚ β”‚ β”‚ └─ kafka.producer.service.js.map
90
+ β”‚ β”‚ β”‚ └─ user/
91
+ β”‚ β”‚ β”‚ β”œβ”€ core/
92
+ β”‚ β”‚ β”‚ β”‚ β”œβ”€ dto/
93
+ β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€ create-user.dto.d.ts
94
+ β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€ create-user.dto.js
95
+ β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€ create-user.dto.js.map
96
+ β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€ update-user.dto.d.ts
97
+ β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€ update-user.dto.js
98
+ β”‚ β”‚ β”‚ β”‚ β”‚ └─ update-user.dto.js.map
99
+ β”‚ β”‚ β”‚ β”‚ β”œβ”€ interface/
100
+ β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€ user.repository.interface.d.ts
101
+ β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€ user.repository.interface.js
102
+ β”‚ β”‚ β”‚ β”‚ β”‚ └─ user.repository.interface.js.map
103
+ β”‚ β”‚ β”‚ β”‚ └─ use-case/
104
+ β”‚ β”‚ β”‚ β”‚ β”œβ”€ user.service.d.ts
105
+ β”‚ β”‚ β”‚ β”‚ β”œβ”€ user.service.js
106
+ β”‚ β”‚ β”‚ β”‚ └─ user.service.js.map
107
+ β”‚ β”‚ β”‚ β”œβ”€ inBound/
108
+ β”‚ β”‚ β”‚ β”‚ β”œβ”€ user.controller.d.ts
109
+ β”‚ β”‚ β”‚ β”‚ β”œβ”€ user.controller.js
110
+ β”‚ β”‚ β”‚ β”‚ └─ user.controller.js.map
111
+ β”‚ β”‚ β”‚ β”œβ”€ outBound/
112
+ β”‚ β”‚ β”‚ β”‚ β”œβ”€ user.repository.d.ts
113
+ β”‚ β”‚ β”‚ β”‚ β”œβ”€ user.repository.js
114
+ β”‚ β”‚ β”‚ β”‚ └─ user.repository.js.map
115
+ β”‚ β”‚ β”‚ β”œβ”€ user.module.d.ts
116
+ β”‚ β”‚ β”‚ β”œβ”€ user.module.js
117
+ β”‚ β”‚ β”‚ └─ user.module.js.map
118
+ β”‚ β”‚ β”œβ”€ utils/
119
+ β”‚ β”‚ β”‚ β”œβ”€ validators/
120
+ β”‚ β”‚ β”‚ β”‚ β”œβ”€ phoneNumber.validate.d.ts
121
+ β”‚ β”‚ β”‚ β”‚ β”œβ”€ phoneNumber.validate.js
122
+ β”‚ β”‚ β”‚ β”‚ └─ phoneNumber.validate.js.map
123
+ β”‚ β”‚ β”‚ β”œβ”€ crypt.d.ts
124
+ β”‚ β”‚ β”‚ β”œβ”€ crypt.js
125
+ β”‚ β”‚ β”‚ β”œβ”€ crypt.js.map
126
+ β”‚ β”‚ β”‚ β”œβ”€ generate.d.ts
127
+ β”‚ β”‚ β”‚ β”œβ”€ generate.js
128
+ β”‚ β”‚ β”‚ β”œβ”€ generate.js.map
129
+ β”‚ β”‚ β”‚ β”œβ”€ logging.prisma.d.ts
130
+ β”‚ β”‚ β”‚ β”œβ”€ logging.prisma.js
131
+ β”‚ β”‚ β”‚ β”œβ”€ logging.prisma.js.map
132
+ β”‚ β”‚ β”‚ β”œβ”€ validation-fields.d.ts
133
+ β”‚ β”‚ β”‚ β”œβ”€ validation-fields.js
134
+ β”‚ β”‚ β”‚ β”œβ”€ validation-fields.js.map
135
+ β”‚ β”‚ β”‚ β”œβ”€ validation-option.d.ts
136
+ β”‚ β”‚ β”‚ β”œβ”€ validation-option.js
137
+ β”‚ β”‚ β”‚ └─ validation-option.js.map
138
+ β”‚ β”‚ β”œβ”€ app.controller.d.ts
139
+ β”‚ β”‚ β”œβ”€ app.controller.js
140
+ β”‚ β”‚ β”œβ”€ app.controller.js.map
141
+ β”‚ β”‚ β”œβ”€ app.module.d.ts
142
+ β”‚ β”‚ β”œβ”€ app.module.js
143
+ β”‚ β”‚ β”œβ”€ app.module.js.map
144
+ β”‚ β”‚ β”œβ”€ app.service.d.ts
145
+ β”‚ β”‚ β”œβ”€ app.service.js
146
+ β”‚ β”‚ β”œβ”€ app.service.js.map
147
+ β”‚ β”‚ β”œβ”€ main.d.ts
148
+ β”‚ β”‚ β”œβ”€ main.js
149
+ β”‚ β”‚ └─ main.js.map
150
+ β”‚ └─ tsconfig.build.tsbuildinfo
151
+ β”œβ”€ prisma/
152
+ β”‚ └─ schema.prisma
153
+ β”œβ”€ src/
154
+ β”‚ β”œβ”€ common/
155
+ β”‚ β”‚ β”œβ”€ auth/
156
+ β”‚ β”‚ β”‚ β”œβ”€ dto/
157
+ β”‚ β”‚ β”‚ β”‚ β”œβ”€ create-auth.dto.ts
158
+ β”‚ β”‚ β”‚ β”‚ └─ update-auth.dto.ts
159
+ β”‚ β”‚ β”‚ β”œβ”€ jwt/
160
+ β”‚ β”‚ β”‚ β”‚ β”œβ”€ auth.guard.ts
161
+ β”‚ β”‚ β”‚ β”‚ β”œβ”€ constant.ts
162
+ β”‚ β”‚ β”‚ β”‚ β”œβ”€ jwt.guard.ts
163
+ β”‚ β”‚ β”‚ β”‚ └─ jwt.strategy.ts
164
+ β”‚ β”‚ β”‚ β”œβ”€ role/
165
+ β”‚ β”‚ β”‚ β”‚ β”œβ”€ role.decorators.ts
166
+ β”‚ β”‚ β”‚ β”‚ β”œβ”€ role.enum.ts
167
+ β”‚ β”‚ β”‚ β”‚ └─ role.guard.ts
168
+ β”‚ β”‚ β”‚ β”œβ”€ auth.controller.ts
169
+ β”‚ β”‚ β”‚ β”œβ”€ auth.module.ts
170
+ β”‚ β”‚ β”‚ └─ auth.service.ts
171
+ β”‚ β”‚ β”œβ”€ http/
172
+ β”‚ β”‚ β”‚ β”œβ”€ http-client.module.ts
173
+ β”‚ β”‚ β”‚ └─ http-client.service.ts
174
+ β”‚ β”‚ β”œβ”€ logger/
175
+ β”‚ β”‚ β”‚ β”œβ”€ error.logging.ts
176
+ β”‚ β”‚ β”‚ └─ logging.interceptor.ts
177
+ β”‚ β”‚ └─ notification/
178
+ β”‚ β”‚ β”œβ”€ notification.module.ts
179
+ β”‚ β”‚ └─ notification.service.ts
180
+ β”‚ β”œβ”€ config/
181
+ β”‚ β”‚ β”œβ”€ db.module.ts
182
+ β”‚ β”‚ β”œβ”€ db.ts
183
+ β”‚ β”‚ └─ env.validation.ts
184
+ β”‚ β”œβ”€ features/
185
+ β”‚ β”‚ β”œβ”€ kafka/
186
+ β”‚ β”‚ β”‚ β”œβ”€ kafka.consumer.controller.ts
187
+ β”‚ β”‚ β”‚ β”œβ”€ kafka.consumer.service.ts
188
+ β”‚ β”‚ β”‚ β”œβ”€ kafka.module.ts
189
+ β”‚ β”‚ β”‚ └─ kafka.producer.service.ts
190
+ β”‚ β”‚ └─ user/
191
+ β”‚ β”‚ β”œβ”€ core/
192
+ β”‚ β”‚ β”‚ β”œβ”€ dto/
193
+ β”‚ β”‚ β”‚ β”‚ β”œβ”€ create-user.dto.ts
194
+ β”‚ β”‚ β”‚ β”‚ └─ update-user.dto.ts
195
+ β”‚ β”‚ β”‚ β”œβ”€ interface/
196
+ β”‚ β”‚ β”‚ β”‚ └─ user.repository.interface.ts
197
+ β”‚ β”‚ β”‚ └─ use-case/
198
+ β”‚ β”‚ β”‚ └─ user.service.ts
199
+ β”‚ β”‚ β”œβ”€ inBound/
200
+ β”‚ β”‚ β”‚ └─ user.controller.ts
201
+ β”‚ β”‚ β”œβ”€ outBound/
202
+ β”‚ β”‚ β”‚ └─ user.repository.ts
203
+ β”‚ β”‚ └─ user.module.ts
204
+ β”‚ β”œβ”€ utils/
205
+ β”‚ β”‚ β”œβ”€ validators/
206
+ β”‚ β”‚ β”‚ └─ phoneNumber.validate.ts
207
+ β”‚ β”‚ β”œβ”€ crypt.ts
208
+ β”‚ β”‚ β”œβ”€ generate.ts
209
+ β”‚ β”‚ β”œβ”€ logging.prisma.ts
210
+ β”‚ β”‚ β”œβ”€ validation-fields.ts
211
+ β”‚ β”‚ └─ validation-option.ts
212
+ β”‚ β”œβ”€ app.controller.spec.ts
213
+ β”‚ β”œβ”€ app.controller.ts
214
+ β”‚ β”œβ”€ app.module.ts
215
+ β”‚ β”œβ”€ app.service.ts
216
+ β”‚ └─ main.ts
217
+ β”œβ”€ test/
218
+ β”‚ β”œβ”€ app.e2e-spec.ts
219
+ β”‚ └─ jest-e2e.json
220
+ β”œβ”€ .dockerignore
221
+ β”œβ”€ .env
222
+ β”œβ”€ .env.example
223
+ β”œβ”€ .env.production
224
+ β”œβ”€ .gitignore
225
+ β”œβ”€ .prettierrc
226
+ β”œβ”€ aborescence.txt
227
+ β”œβ”€ docker-compose-dev.yml
228
+ β”œβ”€ docker-compose-prod.yml
229
+ β”œβ”€ Dockerfile
230
+ β”œβ”€ dockerfile.dev
231
+ β”œβ”€ eslint.config.mjs
232
+ β”œβ”€ nest-cli.json
233
+ β”œβ”€ package.json
234
+ β”œβ”€ pnpm-lock.yaml
235
+ β”œβ”€ README.md
236
+ β”œβ”€ tsconfig.build.json
237
+ β”œβ”€ tsconfig.build.tsbuildinfo
238
+ └─ tsconfig.json
@@ -0,0 +1,22 @@
1
+ services:
2
+
3
+ delivery:
4
+ container_name: nestjs-archi-cli
5
+ build:
6
+ context: .
7
+ dockerfile: dockerfile.dev
8
+ ports:
9
+ - "3500:3500"
10
+ volumes: []
11
+ command: pnpm run start:dev -- --poll=1000
12
+ env_file:
13
+ - .env
14
+ environment:
15
+ # Pointe sur le broker Kafka exposΓ© par Server A
16
+ - KAFKA_BOOTSTRAP_SERVERS=kafka:9092
17
+ networks:
18
+ - kafka-network
19
+ networks:
20
+ kafka-network:
21
+ external: true
22
+
@@ -0,0 +1,20 @@
1
+ services:
2
+
3
+ delivery:
4
+ container_name: nestjs-archi-cli
5
+ image: konandev/nestjs-archi-cli :latest
6
+ build:
7
+ context: .
8
+ dockerfile: Dockerfile
9
+ target: production
10
+ ports:
11
+ - "3500:3500"
12
+ # command: pnpm run start:dev -- --poll=1000
13
+ env_file:
14
+ - .env.production
15
+ networks:
16
+ - prod
17
+ networks:
18
+ prod:
19
+ external: true
20
+