Stacklo
This is a financial payment system that allows users buy crypto currecnies online using fiat currency and store safely in a wallet internally.
A microservices architecture was used for scalability, resilience, and maintainability.
-
Overall Architecture: Microservices
-
Core Services (Golang) Each service will be a separate Golang application, communicating via internal APIs (e.g., gRPC for high performance or REST).
-
Authentication & User Service: Purpose: Handles user registration, login, session management, user profiles (e.g., KYC status), and password management. Features: User signup/login, password hashing, JWT token generation/validation.
-
Wallet Service: Purpose: Manages user virtual wallets (NGN) and all fiat currency transactions. Features: Wallet creation on signup, NGN deposit/withdrawal, balance tracking, transaction history.
-
Crypto Service: Purpose: Manages user's cryptocurrency holdings (BTC, ETH) and handles crypto buy/sell operations. Features: Crypto wallet generation (if self-custodial, otherwise just balance tracking), buy/sell orders, crypto balance updates.
-
Transaction Service: Purpose: Orchestrates and records all financial transactions (fiat and crypto). This service ensures atomicity and consistency across wallet and crypto balances. Features: Transaction logging, status updates, idempotency checks.
-
Notification Service: Purpose: Sends real-time notifications to users for transactions, login alerts, etc. Features: Email, SMS, push notifications.
-
Payment Service: This focuses only on interacting with external payment providers (Paystack, crypto exchanges). This includes handling their specific API contracts, authentication, webhooks, and potential rate limits.
-
API Design External APIs (for Frontend): RESTful APIs (JSON over HTTP) are standard for client-server communication. Internal APIs (between services): gRPC for efficient, high-performance inter-service communication using Protocol Buffers.
+----------------+ | Client | +----------------+ | API Gateway | ----------------------------------------------------- | | | |
User Service Wallet Service Txn Service Payment Service | | | | | PostgreSQL PostgreSQL PostgreSQL PostgreSQL PostgreSQL | | | | | Redis Redis Redis Redis Redis (caching) _____ All services communicate via NATS ____/ | Monitoring & Logging (Prometheus + Grafana, Loki, Jaeger)