https://github.com/coderatio/ok-assessment
An assessment to build microservices with Nest.js, MongoDB and Typescript
https://github.com/coderatio/ok-assessment
Last synced: about 2 months ago
JSON representation
An assessment to build microservices with Nest.js, MongoDB and Typescript
- Host: GitHub
- URL: https://github.com/coderatio/ok-assessment
- Owner: coderatio
- Created: 2023-02-28T06:17:50.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-03-01T15:59:44.000Z (over 3 years ago)
- Last Synced: 2025-02-24T02:31:01.392Z (over 1 year ago)
- Language: TypeScript
- Homepage:
- Size: 344 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Microservices Take Home Assessment
The project has three microservices.
- User Service
- Authentication Service
- Payment Service
# Structure
```lua
.
├── User Service (Nest.js)/
│ ├── src/
│ │ ├── common
│ │ ├── filters
│ │ ├── guards
│ │ ├── payment
│ │ ├── schemas
│ │ ├── users
│ │ └── wallets
│ ├── Dockerfile
│ ├── .env
│ └── package.json
├── Auth Service (Nest.js)/
│ ├── src/
│ │ ├── auth
│ │ ├── common
│ │ └── filters
│ ├── Dockerfile
│ ├── .env
│ └── package.json
├── Payment Service (Nest.js)/
│ ├── src/
│ │ ├── common
│ │ ├── filters
│ │ ├── guards
│ │ ├── payment
│ │ ├── schemas
│ │ └── wallets
│ ├── Dockerfile
│ ├── .env
│ └── package.json
├── .gitignore
├── docker-compose.yaml
├── package.json
└── README.md
```
All the services are using `nest.js` so all dependencies are expected to be installed.
# Technologies Used
- Node.js
- Nest.js
- Typescript
- Mongo
- Docker
- RxJs
## User Service
This service is responsible for managing users. The following endpoints are available
- ### `POST /users`
- ### `POST /wallets` - communicates with payment service
- ### `GET /users/:id`
- ### `GET /payments/:id` - communicates with payment service
- ### `GET /wallets/:id`- communicates with payment service
## Authentication Service
This service is responsible for authenticating registered users. It's used by both `user` and `payment` services.
It has the following routes.
- ### `POST /login`
- ### `RPC ({ role: 'auth', cmd: 'check' })` - Verifies JWT token
# Payment Service
The payment service is responsible for generating wallets and processing all forms of payments. The service has the following endpoints
- ### `POST /wallets/fund`
- ### `POST /initiate`
- ### `POST /payment/refund`
- ### `GET /paymets/verify/:id`
- ### `RPC ({ role: 'wallets', cmd: 'create' })`
- ### `RPC ({ role: 'wallets', cmd: 'get' })`
- ### `RPC ({ role: 'payments', cmd: 'get' })`