Skip to content

Commit 18ff6ff

Browse files
committed
Added some readme
1 parent 7406969 commit 18ff6ff

20 files changed

+183
-123
lines changed

README.md

Lines changed: 58 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -1,98 +1,63 @@
1-
<div align="center">
2-
<img width="250" src="https://camo.githubusercontent.com/18fe3feea5e3593c593e12e552494a3995eceacf/687474703a2f2f6b616d696c6d79736c69776965632e636f6d2f7075626c69632f6e6573742d6c6f676f2e706e672331" alt="Awesome">
3-
<br>
4-
<h3>real-world-example-nestjs-mongoose-jwt-auth-roles-and-permission</h3>
5-
<hr>
6-
</div>
7-
8-
9-
# Write scripts to create few folders during startup if not exists
10-
crm_response
11-
12-
# Getting started
13-
14-
## Installation
15-
16-
Clone the repository
17-
18-
git clone https://github.com/pejmanhadavi/real-world-example-nestjs-mongoose-jwt-auth.git
19-
20-
Switch to the repo folder
21-
22-
cd real-world-example-nestjs-mongoose-jwt-auth
23-
24-
Install dependencies
25-
26-
npm install
27-
28-
Create a .env file and write it as follows
29-
30-
MONGO_URI='mongodb://localhost/YOURMONGODBNAME'
31-
JWT_SECRET='YOURJWTSECRETCHANGEIT'
32-
ENCRYPT_JWT_SECRET='YOURJWTENCRIPTINGPASSCHANGEIT'
33-
JWT_EXPIRATION=30m
34-
35-
----------
36-
37-
## Database
38-
39-
The example codebase uses [Mongoose](https://mongoosejs.com/).
40-
41-
----------
42-
43-
## NPM scripts
44-
- `npm run start:watch` - Start application in watch mode
45-
46-
----------
47-
# Authentication
48-
49-
This applications uses JSON Web Token (JWT) to handle authentication.
50-
This app uses <strong>refresh-Token</strong> mechanism to refresh jsonwebtoken after 30 minutes.
51-
52-
----------
53-
54-
# Swagger API docs
55-
56-
Visit http://127.0.0.1:3000/api in your browser
57-
58-
This example repo uses the NestJS swagger module for API documentation. [NestJS Swagger](https://github.com/nestjs/swagger) - [www.swagger.io](https://swagger.io/)
59-
60-
## Authors
61-
62-
### Aggregating results based on month, year and leadStatus
63-
```json
64-
db.getCollection('leadhistories').aggregate([
65-
{
66-
$project: { "year":{"$year":"$createdAt"}, "month":{"$month":"$createdAt"}, leadStatus: "$leadStatus"}
67-
},
68-
{ $match: {"year": 2021} },
69-
{
70-
$group : {
71-
_id : {
72-
month : "$month",
73-
year : "$year",
74-
leadStatus: "$leadStatus"
75-
},
76-
total : {"$sum" : 1},
77-
}
78-
},
79-
{
80-
$addFields: {
81-
month: {
82-
$let: {
83-
vars: {
84-
monthsInString: [, 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'July', 'August', 'September', 'October', 'November', 'December']
85-
},
86-
in: {
87-
$arrayElemAt: ['$$monthsInString', '$_id.month']
88-
}
89-
}
90-
}
91-
}
92-
}
93-
])
1+
# Getting Started
2+
3+
To get started with your project, follow the steps below:
4+
1. Install Redis and MongoDB
5+
6+
Redis and MongoDB are both required to run your project. You can use Docker to easily install both of them. Here's how:
7+
8+
```sh
9+
docker-compose -f docker-compose.dev.yml up -d --no-deps redis mongodb worker
10+
```
11+
12+
13+
This command will start Redis and MongoDB containers using the docker-compose.dev.yml configuration file.
14+
15+
2. Use dummy data
16+
to restore working set data, use the following command
17+
```sh
18+
docker exec -i mongoback sh -c 'mongorestore --archive' < db.dump
19+
```
20+
21+
This command will export the data from the MongoDB container into a db.dump file.
22+
23+
3. Start the development server
24+
25+
Finally, to start the development server, run the following command:
26+
27+
```bash
28+
npm run start:dev
29+
```
30+
31+
This command will start the development server for your project.
32+
33+
Congratulations! You have now successfully installed Redis and MongoDB, loaded dummy data, and started the development server for your project. You can now start working on your project and building out its features.
34+
35+
---
36+
## File processing service
37+
[Microservice for file processing](https://github.com/shanurrahman/molecule_bull_microservice)
38+
Bulk user uploads are handled by a worker process linked above.
39+
40+
```sh
41+
docker-compose -f docker-compose.dev.yml up -d --no-deps worker
42+
```
43+
44+
## Frontend application
45+
1. switch to cdk-drag-drop branch
46+
2. `npm start` for development or `npm run build` for production deployment
47+
48+
use credentials -
9449
```
50+
username: shanur.cse.nitap@gmail.com
51+
password: password123
52+
```
53+
to login into the app
54+
55+
56+
57+
58+
9559

60+
---
9661
`docker system prune` -> Delete prev images
9762
`docker-compose up -d --build --no-deps main` -> build and restart main server
9863
`docker-compose up -d --build --no-deps worker` -> Build and restart worker

dist/config/config.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,5 +53,10 @@ declare const _default: {
5353
REDIS_URL: string;
5454
REDIS_PORT: string;
5555
};
56+
oauth: {
57+
google: {
58+
clientId: string;
59+
};
60+
};
5661
};
5762
export default _default;

dist/config/config.js

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/config/config.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/lead/dto/create-email-template.dto.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/lead/dto/create-email-template.dto.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/lead/lead.service.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/lead/lead.service.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/main.js

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/main.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)