vuongwphamj / nest-micro-services

This is microservice with NestJs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NAB NestJs Micro-Services

This is a template code for Micro Services base on NestJs framework

About the Project

ICommerce is online shopping application.

Project is a e-commerce service includes:

  • Core Service
  • Product Service
  • Customer Service
  • ...

Index

Installation

NodeJs

Use NodeJs version v12.18.3 or uper version.

node --version
v12.18.3

Use the package manager Yarn version 1.22.4 or uper version.

yarn --version
1.22.4

Docker and Docker Compose

Use Docker version 20.10.5 and Docker Compose version 1.28.5

docker --version
Docker version 20.10.5, build 55c4c88

docker-compose --version
docker-compose version 1.28.5, build c4eb3a1f

MySQL

Use MySQL, docker image latest version

Architecture

The Architecture design in here.

Source Code Structure

root
|-- docs
    |-- images
    |-- ARCHITECTURE.md
|-- docker-compose
    |-- docker-compose.yaml
|-- migrations
    |-- init.sql
|-- nab-core-service
    |-- ...
|-- nab-customer-service
    |-- ...
|-- nab-product-service
    |-- ...
  • The nab-core-service is core base.
  • The nab-customer-service is customer service.
  • The nab-product-service is product service.

Run Project

cd docker-compose
docker-compose up

Project will automatic run base on docker enviroments

DB Admin Page

Admin Page

Note: Run project first.

Server: mysql-db:3306
Username: root
Password: admin
Database: nab-customer-service || nab-product-service

Workflows

Use Case - Sequence Diagram

Note: Run project first.

Follow Searching/Viewing list products

curl --location --request POST 'localhost:3000/products/search' \
--header 'Authorization: 8ea031c8-3d2e-4996-85dc-d3dff57token' \
--header 'Content-Type: application/json' \
--data-raw '{
    "name": "Joy",
    "orderBy": "price",
    "orderType": "DESC",
    "limit": 10,
    "page": 0
}'

Follow Viewing detail products

curl --location --request GET 'localhost:3000/products/product_3f210ca5-ae38-4e5f-8353-f86eaba1b98c' \
--header 'Authorization: 8ea031c8-3d2e-4996-85dc-d3dff57token'

Notes

The Authentication/Authorization are not implemented, these trust mock data (Link).

P.S

Thanks for watching.

About

This is microservice with NestJs


Languages

Language:TypeScript 90.9%Language:JavaScript 6.4%Language:Dockerfile 2.6%