How adrianuscharlie/.net-api-services works
Project Type & Purpose
• The project is a full-stack back-end API built with .NET Core 8. It aggregates cashout and reversal transactions and works as an intermediary between client APIs and partner APIs.
• The system is designed to support partner-specific transaction requirements, JWT/B2B authentication, structured logging (Serilog), and Redis caching. It is containerized with Docker for deployment ease.
Analyzing the File Structure
• There are two primary source code directories under “src”:
– CashoutServices: Contains controllers (Cashout, Reversal), services (e.g., RedisServices, PartnerHandler, CashoutServices, KredigramServices), models, certificate management, and a Dockerfile.
– PartnerAPI: Contains similar elements (controllers, models, certificates, and Dockerfile) to handle partner-specific API operations.
• Additional files such as the solution files (*.sln), Docker Compose files, launchSettings, and appsettings indicate an infrastructure that supports both local development and containerized deployments.
• The “DB” folder holds the SQL file for the database schema, and there are explicit configuration files (appsettings.json, appsettings.Development.json) for environmental settings.
Key Components in the Architecture
a. CashoutServices API:
– Controllers for Cashout and Reversal transactions.
– Service layer for handling business logic (e.g., CashoutServices, Redis-based caching, and partner-specific processing).
– Certificate management for secure partner communication.
b. PartnerAPI Service:
– Provides endpoints and logic to interact with partner systems (e.g., additional controllers, certificate components).
c. Database:
– MySQL (or related SQL engine) is suggested by the cashoutservices.sql file for persisting transaction data.
d. External Services & Infrastructure:
– JWT/B2B authentication mechanism.
– Redis DB for caching tokens.
– Docker containerization and orchestration through Docker Compose.
– Logging and error handling, likely using structured logging (Serilog).
Diagramming the System
– Client/API Consumers: Illustrate external clients/partners interacting over HTTP.
– API Gateway/Entry Point: Represents the end points exposed by CashoutServices and PartnerAPI.
– CashoutServices Module: Highlight the controllers, services, and helper components (e.g., PartnerHandler, RedisServices).
– PartnerAPI Module: Similar breakdown as above but tailored for partner interactions.
– Database (MySQL): Indicate the database schema source from cashoutservices.sql.
– Redis Cache: Emphasize the use of Redis for B2B token caching.
– How client requests flow into the respective API endpoints.
– Interactions from CashoutServices to the database and external caching.
– Communication with PartnerAPI where CashoutServices aggregates responses from customized partner processing.
• Notes on authentication/authorization flow (JWT based) and error handling/reporting paths.