It's a simple food application on top of Nestjs & MongoDB. It can be used for learning purposes & will be extended bit by bit.
- Possible to register as a customer & restaurant user.
- Get verification link & verified by mail.
- JWT token and role-based authentications are available.
- Restaurant users can perform CRUD operations on the items.
- Restaurant user is also allowed to give discount on the item & total amount of order as well.
- Customer can perform CRUD operation on carts & also request for the orders.
- Customers are allowed to give ratings for restaurants.
- Users can search restaurants.
- Rate limiting of requests.
Name | version |
---|---|
NestJS | 10.2.10 |
MongoDB | 7.0.4 |
Mongo-express | latest |
Elasticsearch | 10.0.1 |
Kibana | 10.0.1 |
@nestjs/swagger | 7.1.16 |
# development (To start all the services)
$ docker-compose -f docker-compose.dev.yml --env-file env/.dev.env build --no-cache
$ docker-compose -f docker-compose.dev.yml --env-file env/.dev.env up
# development (To start any service)
$ docker-compose -f docker-compose.dev.yml --env-file env/.dev.env build --no-cache anyServiceName
$ docker-compose -f docker-compose.dev.yml --env-file env/.dev.env up anyServiceName
# production mode
# Export results in a file
$ docker exec mongoContainerName mongoexport --uri="mongodb://UN:PWD@mongoContainerName:27017/DBName" --collection=CollectionName --type=json --fields=field1,field2 --out=collectionName.json --jsonArray
# Copy the file from DB Container
$ docker cp DBcontainerName:/collectionName.json destinationFolderPath
More on - mongoexport
# Get inside the DB container
$ docker exec -it dbContainerName bash
# Use mongosh shell
$ mongosh -u username -p password dbName
More on - Mongosh shell doc
This command will only work during the initial configuration of the Elasticsearch security features.For More Info - Elasticsearch Doc. On the other hand, by using kibana password can be changed for the user. Go to Management > Stack Management > Security > Users
# Set password for ELK
$ docker exec -it ESContainerName bin/elasticsearch-reset-password -u elastic -i
$ docker exec -it ESContainerName bin/elasticsearch-reset-password -u kibana_system -i
PUT restaurants
{
"mappings": {
"properties": {
"id": {
"type": "keyword"
},
"name": {
"type": "text"
},
"address": {
"type": "text"
},
"opening_time": {
"type": "date",
"format": "HH:mm:ss"
},
"closing_time": {
"type": "date",
"format": "HH:mm:ss"
},
"current_status": {
"type": "text"
}
}
}
}
# Prepare restaurants data according to ES Mapping
$ docker exec food-dev npx ts-node streamData.js
# Insert data to ES
$ docker exec food-dev node_modules/elasticdump/bin/elasticdump --input=restaurant.json --output=http://esUN:esPW@esFood01:9200/ --type=data
To find Circular dependency (madge)
Graphviz (optional) - To see a graphical representation
$ npm install madge --save-dev
$ npx ts-node circular.js
- Swagger - http://localhost:4000/api/v1/
- Mongo-express - http://localhost:8082/admin/
- Kibana - http://localhost:5601/esboard
# unit tests
$ npm run test yourFolderPath/fileName.spec.ts
# e2e tests
$ npm run test:e2e test/fileName.e2e-spec.ts
# test coverage
- Checkout Medium - CD with Google Cloud Run, GitHub Actions, Artifact Registry, & WIF
- 📖 Checkout my stories - Medium
- 🔗 Connect with me - LinkedIn
- 📫 Contact Me - [email protected]