Skip to content

Commit af63dc0

Browse files
Merge pull request #84 from vndevteam/develop
feat: merge develop into main
2 parents 5271ef3 + 8541c61 commit af63dc0

26 files changed

+811
-298
lines changed

.env.docker

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
NODE_ENV=development
22
MODULES_SET=monolith
33
APP_NAME="NestJS API"
4+
APP_URL=http://localhost:3000
45
APP_PORT=3000
56
APP_DEBUG=false
67
API_PREFIX=api

.env.example

+21-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,31 @@
1-
NODE_ENV=development # local, development, staging, production, test
2-
MODULES_SET=monolith # monolith, api
1+
##== Environment
2+
# NODE_ENV values: local, development, staging, production, test
3+
NODE_ENV=development
4+
5+
# MODULES_SET values: monolith, api
6+
MODULES_SET=monolith
7+
8+
##== Application
39
APP_NAME="NestJS API"
10+
APP_URL=http://localhost:3000
411
APP_PORT=3000
12+
13+
# APP_DEBUG values: true, false
514
APP_DEBUG=false
15+
616
API_PREFIX=api
717
APP_FALLBACK_LANGUAGE=en
18+
19+
# APP_LOG_LEVEL values: fatal, error, warn, info, debug, trace, silent
820
APP_LOG_LEVEL=debug
9-
APP_LOG_SERVICE=console # support: console, google_logging, aws_cloudwatch
1021

22+
# APP_LOG_SERVICE values: console, google_logging, aws_cloudwatch
23+
APP_LOG_SERVICE=console
24+
25+
# APP_CORS_ORIGIN values: * | true | false | domain1,domain2,domain3 (comma-separated)
26+
APP_CORS_ORIGIN=http://localhost:3000,http://example.com
27+
28+
##== Database
1129
DATABASE_TYPE=postgres
1230
DATABASE_HOST=localhost
1331
DATABASE_PORT=5432

README.md

+8-6
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919

2020
NestJS boilerplate for a typical project
2121

22+
Demo: <https://nestjs-boilerplate-n27l.onrender.com>
23+
2224
## Getting started
2325

2426
```bash
@@ -56,19 +58,19 @@ $ pnpm run start:prod
5658

5759
## Feature
5860

59-
- [ ] Database. Support [TypeORM](https://www.npmjs.com/package/typeorm)
61+
- [x] Database. Support [TypeORM](https://www.npmjs.com/package/typeorm)
6062
- [ ] Seeding.
61-
- [ ] Config Service ([@nestjs/config](https://www.npmjs.com/package/@nestjs/config)).
63+
- [x] Config Service ([@nestjs/config](https://www.npmjs.com/package/@nestjs/config)).
6264
- [ ] Mailing ([nodemailer](https://www.npmjs.com/package/nodemailer)).
6365
- [ ] Sign in and sign up via email.
6466
- [ ] Social sign in (Apple, Facebook, Google, Twitter).
6567
- [ ] Admin and User roles.
66-
- [ ] Internationalization/Translations (I18N) ([nestjs-i18n](https://www.npmjs.com/package/nestjs-i18n)).
68+
- [x] Internationalization/Translations (I18N) ([nestjs-i18n](https://www.npmjs.com/package/nestjs-i18n)).
6769
- [ ] File uploads. Support local and Amazon S3 drivers.
68-
- [ ] Swagger.
70+
- [x] Swagger.
6971
- [ ] E2E and units tests.
70-
- [ ] Docker.
71-
- [ ] CI (Github Actions).
72+
- [x] Docker.
73+
- [x] CI (Github Actions).
7274

7375
## Support
7476

docs/.vuepress/config.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { viteBundler } from '@vuepress/bundler-vite';
2-
import { defaultTheme } from '@vuepress/theme-default';
32
import { searchPlugin } from '@vuepress/plugin-search';
3+
import { defaultTheme } from '@vuepress/theme-default';
44
import { defineUserConfig } from 'vuepress';
55
import { en as enThemeConfig } from './config/theme/en.config.mjs';
66
import { vi as viThemeConfig } from './config/theme/vi.config.mjs';

docs/.vuepress/config/theme/en.config.mjs

+8
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,18 @@ const en = {
88
],
99
sidebarDepth: 1,
1010
sidebar: [
11+
{
12+
text: 'Architecture',
13+
link: '/architecture.md',
14+
},
1115
{
1216
text: 'Database',
1317
link: '/database.md',
1418
},
19+
{
20+
text: 'Security',
21+
link: '/security.md',
22+
},
1523
{
1624
text: 'Convention',
1725
children: [

docs/architecture.md

+262
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,264 @@
11
# Architecture
22

3+
This document describes the architecture of the project.
4+
5+
- [Architecture](#architecture)
6+
- [`.github/workflows`](#githubworkflows)
7+
- [`check-semantic-prs.yml`](#check-semantic-prsyml)
8+
- [`ci.yml`](#ciyml)
9+
- [`deploy-docs.yml`](#deploy-docsyml)
10+
- [`.husky`](#husky)
11+
- [`docs`](#docs)
12+
- [`.vuepress`](#vuepress)
13+
- [`src`](#src)
14+
- [`api`](#api)
15+
- [`background`](#background)
16+
- [`common`](#common)
17+
- [`dto`](#dto)
18+
- [`interfaces`](#interfaces)
19+
- [`types`](#types)
20+
- [`config`](#config)
21+
- [`constants`](#constants)
22+
- [`database`](#database)
23+
- [`config` (for database)](#config-for-database)
24+
- [`decorators` (for database)](#decorators-for-database)
25+
- [`entities`](#entities)
26+
- [`migrations`](#migrations)
27+
- [`seeds`](#seeds)
28+
- [`data-source.ts`](#data-sourcets)
29+
- [`decorators`](#decorators)
30+
- [`exceptions`](#exceptions)
31+
- [`filters`](#filters)
32+
- [`generated`](#generated)
33+
- [`guards`](#guards)
34+
- [`i18n`](#i18n)
35+
- [`interceptors`](#interceptors)
36+
- [`libs`](#libs)
37+
- [`shared`](#shared)
38+
- [`utils`](#utils)
39+
- [`app.module.ts`](#appmodulets)
40+
- [`main.ts`](#maints)
41+
- [`test`](#test)
42+
- [`.env`](#env)
43+
- [`.gitignore`](#gitignore)
44+
- [`.prettierrc`](#prettierrc)
45+
- [`commitlint.config.mjs`](#commitlintconfigmjs)
46+
- [`docker-compose.yml`](#docker-composeyml)
47+
- [`Dockerfile`](#dockerfile)
48+
- [`eslint.config.mjs`](#eslintconfigmjs)
49+
- [`jest.config.json`](#jestconfigjson)
50+
- [`lint-staged.config.mjs`](#lint-stagedconfigmjs)
51+
- [`nest-cli.json`](#nest-clijson)
52+
- [`package.json`](#packagejson)
53+
- [`pnpm-lock.yaml`](#pnpm-lockyaml)
54+
- [`README.md`](#readmemd)
55+
- [`renovate.json`](#renovatejson)
56+
- [`setup-jest.mjs`](#setup-jestmjs)
57+
- [`tsconfig.build.json`](#tsconfigbuildjson)
58+
- [`tsconfig.json`](#tsconfigjson)
59+
60+
## `.github/workflows`
61+
62+
Here you can create and store yml files for each github action.
63+
64+
### `check-semantic-prs.yml`
65+
66+
Github action to check if the PR title is following the semantic commit message.
67+
68+
### `ci.yml`
69+
70+
Github action to run the test and build the project.
71+
72+
### `deploy-docs.yml`
73+
74+
Github action to deploy the documentation to the `gh-pages` branch.
75+
76+
## `.husky`
77+
78+
Husky is a tool to prevent bad git commit, git push, and more. See [the husky doc](https://typicode.github.io/husky/) for more.
79+
80+
## `docs`
81+
82+
Folder where we keep all our documentation files.
83+
84+
### `.vuepress`
85+
86+
Folder where we keep all our vuepress configuration files. See [the vuepress doc](https://vuepress.vuejs.org/) for more.
87+
88+
## `src`
89+
90+
Where we keep all our source files.
91+
92+
### `api`
93+
94+
### `background`
95+
96+
### `common`
97+
98+
Where we keep common typescript files, e.g. DTOs, interfaces, types.
99+
100+
#### `dto`
101+
102+
Where we keep all our DTOs.
103+
104+
#### `interfaces`
105+
106+
Where we keep all typescript [interfaces](https://www.typescriptlang.org/docs/handbook/interfaces.html).
107+
108+
#### `types`
109+
110+
Where we keep all typescript [types](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html).
111+
112+
### `config`
113+
114+
Where we keep application configuration files.
115+
116+
### `constants`
117+
118+
Where we keep all our constants.
119+
120+
### `database`
121+
122+
Folder to store files which are connected only to database.
123+
124+
#### `config` (for database)
125+
126+
Folder to store database configuration files.
127+
128+
#### `decorators` (for database)
129+
130+
Folder to store database decorators.
131+
132+
#### `entities`
133+
134+
Folder to store application common entities
135+
136+
#### `migrations`
137+
138+
Folder to store application migrations which will be generated by typeorm.
139+
140+
#### `seeds`
141+
142+
Folder to store application seeds, it adds necessary data for the development.
143+
144+
#### `data-source.ts`
145+
146+
File to store the data source configuration for migrations.
147+
148+
### `decorators`
149+
150+
This folder contains all global [decorators](https://www.typescriptlang.org/docs/handbook/decorators.html).
151+
152+
### `exceptions`
153+
154+
This folder contains all global exception classes.
155+
156+
### `filters`
157+
158+
In this folder you can find app level [filters](https://docs.nestjs.com/exception-filters).
159+
160+
### `generated`
161+
162+
Typescript files generated by the code generator. E.g. i18n.generated.ts file generated by [the nestjs-i18n](https://www.npmjs.com/package/nestjs-i18n) package.
163+
164+
### `guards`
165+
166+
You can store all guards here.
167+
168+
### `i18n`
169+
170+
Internalization JSON files are storied here.
171+
172+
### `interceptors`
173+
174+
Where we are keep [interceptors](https://docs.nestjs.com/interceptors).
175+
176+
### `libs`
177+
178+
Where we keep all common modules. See [NestJS modules documentation](https://docs.nestjs.com/modules) for more.
179+
180+
### `shared`
181+
182+
Shared module with global singleton services.
183+
184+
### `utils`
185+
186+
Where we keep all our utility functions.
187+
188+
### `app.module.ts`
189+
190+
The root application module.
191+
192+
### `main.ts`
193+
194+
## `test`
195+
196+
Folder where we keep all our e2e test files.
197+
198+
## `.env`
199+
200+
Environment variables which will load before app start and will be stored in `process.env`, (*) is a env name (local, development, test, staging, production)
201+
202+
## `.gitignore`
203+
204+
Here you can store the files and folders that you want to ignore in the git repository.
205+
206+
## `.prettierrc`
207+
208+
Prettier configuration file, see [the prettier doc](https://prettier.io/) for more.
209+
210+
## `commitlint.config.mjs`
211+
212+
Commitlint configuration file, see [the commitlint doc](https://commitlint.js.org/) for more.
213+
214+
## `docker-compose.yml`
215+
216+
Docker compose configuration file, see [the docker docs](https://docs.docker.com/compose/compose-file/) for more.
217+
218+
## `Dockerfile`
219+
220+
The basic Dockerfile configuration to build the app, see [the docker docs](https://docs.docker.com/engine/reference/builder/) for more.
221+
222+
## `eslint.config.mjs`
223+
224+
Eslint configuration file, see [the eslint doc](https://eslint.org/) & [typescript-eslint](https://typescript-eslint.io/) for more.
225+
226+
## `jest.config.json`
227+
228+
Jest configuration file, see [the jest doc](https://jestjs.io/) for more.
229+
230+
## `lint-staged.config.mjs`
231+
232+
The configuration of the lint-staged, see [the lint-staged doc](https://github.com/lint-staged/lint-staged) for more.
233+
234+
## `nest-cli.json`
235+
236+
Nestjs cli configuration file, see [the nestjs doc](https://docs.nestjs.com/) for more.
237+
238+
## `package.json`
239+
240+
Here you can store the configuration of the project.
241+
242+
## `pnpm-lock.yaml`
243+
244+
pnpm lock file generated by pnpm.
245+
246+
## `README.md`
247+
248+
Here you can store the description of the project.
249+
250+
## `renovate.json`
251+
252+
Renovate configuration file, see [the renovate doc](https://docs.renovatebot.com/) for more.
253+
254+
## `setup-jest.mjs`
255+
256+
Setup file for jest.
257+
258+
## `tsconfig.build.json`
259+
260+
Here you can store the typescript configuration of the project for the build.
261+
262+
## `tsconfig.json`
263+
264+
Here you can store the typescript configuration of the project.

0 commit comments

Comments
 (0)