provider-microservice-generator
v1.0.1
Published
Tool for building initial microservice.
Readme
Provider Microservice Generator
Installation
$ pnpm install -g provider-microservice-generatorCreate Microservice
$ create-microservice <your-service-name>Setup
$ pnpm install
$ cp .env-example.env .env fileThen modify .env credentials
Compile and run the project
$ pnpm run start:devMicroservice Description
This package allows you to create initial modules that is needed when creating microservice for different providers
Miscroservice Flow
Folder Structure
Below are the different folders within the microservice package and their usage
| Folder | Module | Description | | ------ | ------------- | ------------------------------------------------- | | Common | constants | Contants accross the microservice. | | Common | helpers | Utility functions accross the microservice. | | Common | https | Wallet Endpoints in connecting different clients. | | Common | interface | Defines the structure of the variable or object. | | Config | cache | config for redis cache | | Config | database | config for database connection | | Module | Casino Tokens | Module for casino details | | Module | Game | Module for Games | | Module | Player | Module for Player | | Module | Player | Module for Player | | Module | Session | Module for Session | | Module | Shared | Module for that can be used by different modules | | Module | Transaction | Module for Transaction | | Module | Wallet | Module for Wallet |
Transaction Endpoints
- Balance - Use in retrieving player's balance from wallet.
- Bet - Use to deduct amount from wallet.
- Win - Use to add amount from wallet.
- Rollback - Use to add amount from wallet.
Transaction Endpoint Validations
- Each endpoints may have different validations based on the provider documentation but this package can help you in designing initial structure and just modify other services based on the provider documentation.
Validations, services within the Provider Module includes basic example only. Additional changes may apply based on the provider's documentation.
| Microservice | Validations | | -------------- | ---------------------------------------------------------------------------------------------------- | | Balance | Validation of Client ID. | | Balance | Validation of Session, Player, Game and Casino details from DB or Cache (based on its availability). | | Balance | Provider Validation: Player, Game and Currency | | Balance | Wallet Validation: Get balance | | Bet | Validation of Client ID. | | Bet | Validation of Session, Player, Game and Casino details from DB or Cache (based on its availability). | | Bet | Provider Validation: Player, Game and Currency | | Bet | Transactional Validation: Repeated & Duplicate Transaction | | Bet | Wallet Validation: Get balance | | Bet | Transactional Validation: Invalid amount for balance (Bet > Win) | | Bet | Wallet Validation: Update balance | | Win & Rollback | Validation of Client ID. | | Win & Rollback | Validation of Session, Player, Game and Casino details from DB or Cache (based on its availability). | | Win & Rollback | Provider Validation: Player, Game and Currency | | Win & Rollback | Transactional Validation: Repeated, Invalid Reference Transaction & Duplicate Transaction | | Win & Rollback | Wallet Validation: Get balance | | Win & Rollback | Transactional Validation: Invalid amount for balance (Bet > Win) | | Win & Rollback | Wallet Validation: Update balance |
Connections
- MySQL DB - Major source of all data.
- Redis - Temporary source of data for faster transactions.
- SQS - Queing for updating transactions (Not Yet Available).
- DynamoDB - Use to cater Multi Region (Not Yet Available).
Logs
- Provider Logs - These logs are the request and response logs within the provider module.
- Incall Logs - These logs are the request coming from the client to the microservice.
- Outcall Logs - These logs are the request coming from the microservice to the client.
- File Logs - Coming Soon (Not Yet Available).
Versions
Node: 20.18.0 Nest: 11.0.4 Pnpm: 9.14.4
