1818
1919## Description
2020
21- This generator will help you to build your own Nest.JS Mongodb/ MySQL API using TypeScript 4
21+ This boilerplate will help you bootstrap your own Nest.JS/MongoDB/ MySQL/Typescript API quickly with common enterprise configurations done for you.
2222
23- ### Project Introduction
23+ ### Project Overview
2424
2525- Admin.js
2626- Support ES6/ES7 features
@@ -36,9 +36,9 @@ This generator will help you to build your own Nest.JS Mongodb/MySQL API using T
3636
3737### Authentication
3838
39- - passport local strategy
40- - jwt authentication
41- - passport google 2.0 strategy
39+ - PassportJS local strategy
40+ - JWT authentication (using passport-jwt)
41+ - Passport OAuth 2.0 strategy (for Google)
4242
4343### AdminJS
4444
@@ -54,17 +54,17 @@ If you are not logged in, you will be redirected to the admin login page.
5454http://localhost:3000/admin/login
5555```
5656
57- To login in the admin panel, you have to have registered verified user with admin role.
57+ To login in the admin panel, you should have a ** verified user** registered with the ` admin ` role.
5858
59- To create a default admin user you can run migrations:
59+ To create a default admin user, run the provided migrations:
6060
6161``` bash
6262npm install migrate-mongo
6363
6464npx migrate-mongo up
6565```
6666
67- The migrations will create a default admin user in db with credentials:
67+ The migrations will create a default admin user in the database with following credentials:
6868
6969``` bash
7070login: admin@test.com
@@ -73,10 +73,10 @@ password: String_12345
7373
7474![ Alt Text2] ( https://media.giphy.com/media/HdWGgOGfQa0QRLNXME/giphy.gif )
7575
76- _ Note: admin cat be generated only with mongo + jwt/passport_
76+ _ Note: admin can be generated only with mongo + jwt/passport_
7777
7878### Roles
79- For now, we are implement only few roles: ` user ` and ` admin `
79+ For now, we have implemented only two roles: ` user ` and ` admin `
8080
8181Usage example:
8282
@@ -89,16 +89,16 @@ or for all roles:
8989@Auth ()
9090```
9191
92- _ Note: before use it for sql database , you must run migrations._
92+ _ Note: before using it with sql databases , you must run migrations._
9393
9494### Serialization
95- Implementing ` @Serialize ` decorator will start process before objects are returned in a network response
95+ Use ` @Serialize ` decorator to process the objects before they are returned in the network response
9696Example:
9797
9898``` typescript
9999 @Serialize (UserResponseDto )
100100```
101- use Exclude decorator to exclude properties from serialization
101+ use ` @ Exclude` decorator to exclude properties from serialization
102102``` typescript
103103 @Exclude ()
104104 password : string = ' ' ;
@@ -251,48 +251,52 @@ To start the application in development mode, run:
251251npm run start:dev
252252```
253253
254- Start the application in production env :
254+ Start the application in production environment :
255255
256- Install ts pm2 and typescript compiler :
256+ Install ` pm2 ` and ` typescript ` to make pm2 work with typescript codebase :
257257
258258``` bash
259259npm install -g pm2
260260pm2 install typescript
261261```
262262
263- example start with scale on 2 core:
263+ Here is an example command to start the process with 2 instances and a load-balancer
264264
265265``` bash
266266pm2 start ./dist/main.js -i 2 --no-daemon
267267```
268268
269- Express server listening on http://localhost:3000/ , in development mode
270- The developer mode will watch your changes then will transpile the TypeScript code and re-run the node application automatically.
269+ Express server listening on http://localhost:3000 , in development mode
270+ _ In development mode will watch your changes then will transpile the TypeScript code and re-run the node application automatically._
271271
272272### Docker
273273
2742741 . [ Install Docker] ( https://docs.docker.com/get-docker/ )
2752752 . [ Install docker-compose] ( https://docs.docker.com/compose/install/ )
276276
277- To run your app in docker containers choose "Yes" when the generator asks you about docker.
277+ To run your app in docker containers, choose "Yes" when the generator asks you about docker.
278278
279- #### Now, lift up your app in docker
279+ #### Now, spin up your app in docker
280280
281281``` bash
282282 docker-compose up
283283```
284284
285285## Set up environment
286286
287- In root folder you can find ` .env ` . You can use this config or change it for your purposes .
287+ In root folder you can find ` .env ` . You can use this config as a template for your application .
288288
289289## Deploy
290290
291291### Heroku
292292
293- Check all urls to dbs if they are true, they must connect to dbs which located at them own servers like mongodb on Mlab
293+ Check all urls to databases if they are true, they must connect to dbs which located at them own servers like mongodb on Mlab
294294When you'll run npm run deploy: heroku you'll need to sign in on heroku. You will be redirected to login form.
295295
296+ ** Check all database URLs to be valid. They should connect to their respective hosted instances (local or otherwise).**
297+
298+ _ Note: you may need to sign in on heroku (if not done already). You will be redirected to Heroku login, if required, by the cli._
299+
296300``` bash
297301npm run deploy:heroku
298302```
@@ -305,7 +309,7 @@ npm run deploy:heroku
305309
306310![ Alt Text3] ( https://media.giphy.com/media/RiWDyLQwXaJXu972SM/giphy.gif )
307311
308- When you go by http://localhost:3000/google route, google'll ask you to authorize into your account. After successfully sign in to your account you will be redirected to http://localhost:3000/google/redirect route
312+ To initiate the google sign-in, use http://localhost:3000/google . Once authorized, you will be redirected to http://localhost:3000/google/redirect .
309313
310314## Documentation
311315
@@ -319,8 +323,12 @@ TypeDoc documentation will be available after entering the command:
319323npm run docs
320324```
321325
322- This command will create a folder with documents in which you can see index.html, which needs to be opened in a browser
323- to view the documentation.
326+ This will build the documentation in a subfolder with ` index.html ` as the entrypoint. You can open the ` index.html ` in a web browser to explore the documentation or host the subdirectory using a simple http server like ` lite-server ` using the following command.
327+
328+ ``` bash
329+ npx lite-server ./path/to/documentation/
330+ ```
331+
324332### REST API
325333
326334#### Swagger
@@ -332,7 +340,7 @@ http://localhost:3000/api
332340```
333341
334342> Please note: </br >
335- > All users not verified by default. Please set ``` "verified": true ``` , for sign-in request.
343+ > Users are not verified by default. Please set ``` "verified": true ``` , for sign-in request.
336344
337345
338346![ Alt Text1] ( https://media.giphy.com/media/XEUyeEL03IcaZYw6SB/giphy.gif )
0 commit comments