Skip to content

Commit 0a50ba0

Browse files
chore: merge pull request #115 from vndevteam/develop
chore: merge develop into main
2 parents da9b46a + 454e8fc commit 0a50ba0

19 files changed

+531
-308
lines changed

.env.example

+1-13
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,16 @@
11
##== Environment
2-
# NODE_ENV values: local, development, staging, production, test
32
NODE_ENV=development
4-
5-
# MODULES_SET values: monolith, api
63
MODULES_SET=monolith
74

85
##== Application
96
APP_NAME="NestJS API"
107
APP_URL=http://localhost:3000
118
APP_PORT=3000
12-
13-
# APP_DEBUG values: true, false
149
APP_DEBUG=false
15-
1610
API_PREFIX=api
1711
APP_FALLBACK_LANGUAGE=en
18-
19-
# APP_LOG_LEVEL values: fatal, error, warn, info, debug, trace, silent
2012
APP_LOG_LEVEL=debug
21-
22-
# APP_LOG_SERVICE values: console, google_logging, aws_cloudwatch
2313
APP_LOG_SERVICE=console
24-
25-
# APP_CORS_ORIGIN values: * | true | false | domain1,domain2,domain3 (comma-separated)
2614
APP_CORS_ORIGIN=http://localhost:3000,http://example.com
2715

2816
##== Database
@@ -45,7 +33,7 @@ DATABASE_CERT=
4533
AUTH_JWT_SECRET=secret
4634
AUTH_JWT_TOKEN_EXPIRES_IN=15m
4735
AUTH_REFRESH_SECRET=secret_for_refresh
48-
AUTH_REFRESH_TOKEN_EXPIRES_IN=3650d
36+
AUTH_REFRESH_TOKEN_EXPIRES_IN=365d
4937
AUTH_FORGOT_SECRET=secret_for_forgot
5038
AUTH_FORGOT_TOKEN_EXPIRES_IN=30m
5139
AUTH_CONFIRM_EMAIL_SECRET=secret_for_confirm_email

README.md

+8-4
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,16 @@ When you use this template, try follow the checklist to update your info properl
4747

4848
```bash
4949
# development
50-
$ pnpm run start
50+
$ pnpm start
5151

5252
# watch mode
53-
$ pnpm run start:dev
53+
$ pnpm start:dev
5454

5555
# production mode
56-
$ pnpm run start:prod
56+
$ pnpm start:prod
5757
```
5858

59-
## Feature
59+
## Features
6060

6161
- [x] Database. Support [TypeORM](https://www.npmjs.com/package/typeorm)
6262
- [ ] Seeding.
@@ -72,6 +72,10 @@ $ pnpm run start:prod
7272
- [x] Docker.
7373
- [x] CI (Github Actions).
7474

75+
## More documentations
76+
77+
Please read the [docs](docs/README.md). It contains the details about the project structure, conventions, and more.
78+
7579
## References
7680

7781
- [Awesome Nest Boilerplate](https://github.com/NarHakobyan/awesome-nest-boilerplate)

docs/.vuepress/config.mjs

+5
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ export default defineUserConfig({
1111
description: 'NestJS boilerplate',
1212
base: '/nestjs-boilerplate/',
1313
bundler: viteBundler(),
14+
markdown: {
15+
toc: {
16+
level: [2, 3, 4, 5],
17+
},
18+
},
1419
locales: {
1520
'/': {
1621
lang: 'en-US',

docs/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# NestJS Boilerplate Documentation
22

3+
This is a boilerplate for NestJS projects. It is a starting point for building a RESTful API with NestJS.
4+
35
- [Setup & Development](development.md)
46
- [Architecture](architecture.md)
57
- [Database](database.md)

docs/architecture.md

+3-54
Original file line numberDiff line numberDiff line change
@@ -2,60 +2,9 @@
22

33
This document describes the architecture of the project.
44

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)
5+
---
6+
7+
[[toc]]
598

609
## `.github/workflows`
6110

docs/conventions/branch-conventions.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Branch conventions
22

3+
[[toc]]
4+
35
## Code Flow Branches
46

57
These branches which we expect to be permanently available on the repository follow the flow of code changes starting from development until the production.

docs/conventions/commit-conventions.md

+4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
We use convention at [here](https://www.conventionalcommits.org/en/v1.0.0/)
44

5+
---
6+
7+
[[toc]]
8+
59
## Commit messages must be matched by the following regex
610

711
```js

docs/conventions/linting.md

+4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
This project uses [Typescript Eslint](https://typescript-eslint.io/), and [Prettier](https://prettier.io/) to catch errors and avoid bike-shedding by enforcing a common code style.
44

5+
---
6+
7+
[[toc]]
8+
59
## Languages
610

711
- **Typescript** is linted by Typescript Eslint and formatted by Prettier

docs/conventions/naming-cheatsheet.md

+1-25
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,7 @@
22

33
> Source: <https://github.com/kettanaito/naming-cheatsheet/blob/main/README.md>
44
5-
- [Naming cheatsheet](#naming-cheatsheet)
6-
- [English language](#english-language)
7-
- [Naming convention](#naming-convention)
8-
- [S-I-D](#s-i-d)
9-
- [Avoid contractions](#avoid-contractions)
10-
- [Avoid context duplication](#avoid-context-duplication)
11-
- [Reflect the expected result](#reflect-the-expected-result)
12-
- [Naming functions](#naming-functions)
13-
- [A/HC/LC Pattern](#ahclc-pattern)
14-
- [Actions](#actions)
15-
- [`get`](#get)
16-
- [`set`](#set)
17-
- [`reset`](#reset)
18-
- [`remove`](#remove)
19-
- [`delete`](#delete)
20-
- [`compose`](#compose)
21-
- [`handle`](#handle)
22-
- [Context](#context)
23-
- [Prefixes](#prefixes)
24-
- [`is`](#is)
25-
- [`has`](#has)
26-
- [`should`](#should)
27-
- [`min`/`max`](#minmax)
28-
- [`prev`/`next`](#prevnext)
29-
- [Singular and Plurals](#singular-and-plurals)
5+
[[toc]]
306

317
---
328

docs/database.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# Work with database
22

3-
- [Working with database entity (TypeORM)](#working-with-database-entity-typeorm)
4-
- [Generate migration](#generate-migration)
5-
- [Show migration](#show-migration)
6-
- [Run migration](#run-migration)
7-
- [Revert migration](#revert-migration)
3+
We use [TypeORM](https://typeorm.io/) as an ORM for working with databases. It supports MySQL, PostgreSQL, MariaDB, SQLite, MS SQL Server, Oracle, WebSQL databases.
4+
5+
---
6+
7+
[[toc]]
88

99
## Working with database entity (TypeORM)
1010

@@ -35,7 +35,7 @@
3535
1. Next, generate migration file:
3636

3737
```bash
38-
pnpm run migration:generate src/database/migrations/create-post-table
38+
pnpm migration:generate src/database/migrations/create-post-table
3939
```
4040

4141
1. Apply this migration to database via [pnpm migration:up](#run-migration).

docs/deployment.md

+52
Original file line numberDiff line numberDiff line change
@@ -1 +1,53 @@
11
# Deployment
2+
3+
This document outlines the steps required to deploy the application to a production environment.
4+
5+
---
6+
7+
[[toc]]
8+
9+
## Prerequisites
10+
11+
- Access to the production server
12+
- Necessary credentials for database and other services
13+
- The latest version of the application code
14+
15+
## Steps
16+
17+
1. **Prepare the Environment**:
18+
- Ensure the production server is running and accessible.
19+
- Verify that all required software is installed on the server.
20+
21+
2. **Upload the Application**:
22+
- Use SCP or FTP to transfer the application files to the server.
23+
- Place the files in the appropriate directory.
24+
25+
3. **Configure the Application**:
26+
- Copy the `.env.production` file to the server, if applicable.
27+
- Update any environment-specific configuration settings.
28+
29+
4. **Set Up the Database**:
30+
- Create the production database, if not already set up.
31+
- Run migrations and seed the database with any necessary data.
32+
33+
5. **Start the Application**:
34+
- Depending on the application, this might involve starting a web server, a background job processor, etc.
35+
- Ensure that all services are running as expected.
36+
37+
6. **Verify the Deployment**:
38+
- Access the application through its public URL to ensure it's running correctly.
39+
- Check application logs for any errors or warnings.
40+
41+
7. **Monitor the Application**:
42+
- Set up monitoring and alerting tools to keep track of the application's health and performance.
43+
44+
## Rollback Plan
45+
46+
In case of any issues, have a rollback plan ready:
47+
48+
- Keep the previous version of the application ready for deployment.
49+
- Ensure database backups are taken before the deployment, to restore if necessary.
50+
51+
## Conclusion
52+
53+
Following these steps will help ensure a smooth deployment process. Always test thoroughly in a staging environment before deploying to production.

0 commit comments

Comments
 (0)