How xpnsn/banking-app works
Main components
a. External Actors:
• User (web or mobile client)
• Admin user
b. Infrastructure Services:
• API‐Gateway (Spring Cloud Gateway or Zuul)
• Eureka Server (service registry)
c. Microservices:
• Security Service (authentication, authorization, JWT issuance)
• Accounts Service (account CRUD, balance operations)
• Transactions Service (recording credits/debits, transfers)
• Notifications Service (email/SMS alerts)
d. Data Stores:
• One database per microservice (e.g., PostgreSQL/MySQL instances)
e. (Optional) Shared Components:
Relationships & data flow
a. Client → API‐Gateway: all incoming HTTP(S) requests pass through the gateway.
b. API‐Gateway ↔ Eureka: the gateway queries Eureka to discover the addresses of the downstream microservices.
c. API‐Gateway → Security Service: login/registration flows are forwarded to the Security Service.
d. Security Service → Database: persists user credentials & roles.
e. API‐Gateway → Accounts & Transactions Services: after validating JWT, routes incoming account/transaction API calls.
f. Accounts & Transactions Services → Security Service: use Feign clients + interceptor to validate tokens and fetch user details (via internal calls).
g. Accounts Service → Database (A): stores account entities, statuses, types.
h. Transactions Service → Database (T): stores transaction records, statuses.
i. Accounts ↔ Transactions: Transactions Service may call Accounts Service (Feign) to retrieve account details or check balances before posting transactions.
j. Notifications Service: invoked either synchronously by other services after a transaction/account event, or asynchronously via an event broker (if extended). It pushes out notifications to users.
k. Notifications Service → Database (N): logs sent notifications (if required).
Architectural patterns & principles
• Microservices decomposition: each bounded context (security, accounts, transactions, notifications) lives in its own Spring Boot project.
• Service discovery: Eureka server for dynamic registration/resolution.
• API gateway: single entry point, cross‐cutting concerns (authentication filter, request routing).
• Feign HTTP clients + interceptors: for inter-service calls with token propagation.
• Per-service data persistence: loose coupling, data autonomy.
• Centralized exception handling and DTO mapping: consistent API contracts.