A fault-tolerant, distributed-ready financial validation system built using Java + Spring Boot that validates bank accounts or VPAs through external payment providers.
The project demonstrates how real financial backend systems handle asynchronous processing, distributed safety, provider integrations, and failure recovery — designed to operate correctly even when scaled across multiple backend instances.
| Feature | Description |
|---|---|
| Architecture | Asynchronous, distributed-safe validation pipeline |
| Backend | Java + Spring Boot |
| Security | JWT Authentication + HMAC Webhook Validation |
| Processing | Background Worker Processing (multi-instance safe) |
| Integration | External Payment Provider APIs |
| Reliability | Circuit Breaker (Resilience4j) + Retry + Scheduler Recovery |
| Rate Limiting | Distributed Rate Limiting via Redis + Bucket4j |
| Database | MySQL |
| Deployment | Docker Compose + AWS (EC2) |
- Project Demo
- System Architecture
- Validation Lifecycle
- Request Processing Flow
- Distributed System Capabilities
- Failure Handling
- Security
- UI Screenshots
- Tech Stack
- Local Setup with Docker
- Backend Concepts Demonstrated
- Current Gaps & Future Improvements
🎥 Watch the System Demo
The demo shows:
- User login
- Validation request submission
- Async worker processing
- Provider API integration
- Webhook callback handling
- Final validation result in UI
UI
↓
Spring Boot API (Multiple Instances)
↓
Validation Service
↓
Database (Shared)
↓
Background Workers (Distributed)
↓
External Provider API
↓
Webhook Handler
↓
Event Processor
↓
Database
↓
UI Polling Result
The system processes validations asynchronously, ensuring the UI remains responsive while external validations are completed. It is designed to operate consistently across multiple horizontally scaled backend instances.
Each validation request moves through defined states.
INITIATED
↓
PROCESSING
↓
COMPLETED / FAILED / PROVIDER_CALL_TIMEOUT
This state-driven design prevents duplicate processing and supports safe retries — even when multiple backend instances are running concurrently.
User Request
↓
Spring Boot Controller
↓
Validation Service
↓
Persist Validation Request
↓
Background Worker Picks Task
↓
Provider API Call
↓
Provider Sends Webhook
↓
Event Processor Updates Result
↓
Database Updated
↓
UI Polling Returns Final Status
This architecture ensures non-blocking request processing and distributed-safe execution.
This system is built to run correctly across multiple backend instances (e.g., 5+ Docker containers) without race conditions.
- No race conditions during validation processing, state transitions, or retry handling
- Single processing guaranteed per validation request
- Safe concurrent access to shared database resources
- Each backend instance can independently accept API requests and process background jobs
- System remains consistent under scale
- Uses Bucket4j + Redis (cloud-managed)
- Rate limits enforced uniformly across all instances — no instance can bypass throttling rules
External provider integrations can fail or respond slowly.
The system includes automatic recovery mechanisms.
Protects the system from cascading failures when external providers are degraded:
Provider Call Fails Repeatedly
↓
Circuit Breaker OPENS
↓
Calls halted during cooldown
↓
Circuit Breaker recovers → Resumes calls
If a webhook is delayed or not received:
Polling Scheduler
↓
Detect missing callback
↓
Fetch status from provider
↓
Update database
If a provider call fails:
Reconciliation Scheduler
↓
Retry pending validations
↓
Update final status
- Prevents duplicate validation requests from being processed
- Ensures safe retries without financial side effects — critical for correctness
These mechanisms together ensure eventual consistency and graceful degradation under failure conditions.
- Spring Security
- JWT Authentication
- HMAC Signature Verification
- Ensures callbacks originate from trusted providers only
- Versioned APIs (
/v1/validate) for backward compatibility - Centralized global exception handling for consistent error responses
- Java 17
- Spring Boot
- Spring Security
- JPA / Hibernate
- Resilience4j (Circuit Breaker)
- Bucket4j (Rate Limiting)
- MySQL (persistence)
- Redis (distributed rate limiting — cloud-managed)
- External Payment Provider APIs
- Webhook callbacks (HMAC-verified)
- Background workers (multi-instance safe)
- Scheduler-based recovery jobs
- Docker + Docker Compose
- AWS EC2
You can run the full stack locally using Docker Compose. Follow these steps to get it running cleanly on your machine.
git clone <your-repo-url>
cd validation-serviceCopy the example environment file and fill in your values:
cp .env.example .envUpdate .env with your provider API keys, JWT secret, and Redis credentials.
docker compose up -d --build--buildcompiles the Java.jarand builds React assets fresh-druns containers in detached (background) mode
docker psYou should see the following containers up:
| Container | Port |
|---|---|
| Nginx (reverse proxy) | 80 |
| Spring Boot backend | 8080 |
| React frontend | — |
| MySQL | 3306 |
docker compose logs -f backend-appWatch until you see Tomcat start on port 8080 and Flyway confirm database migrations are complete. Press Ctrl + C to exit.
docker compose down
⚠️ Important: Never rundocker compose down -vunless you intentionally want to wipe the database. The-vflag deletes volumes (including all MySQL data).
If your machine runs out of memory:
sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
free -hThis project demonstrates several real-world backend and distributed systems engineering patterns:
- Asynchronous, non-blocking request processing
- Distributed-safe design (multi-instance, no race conditions)
- Horizontal scalability
- Idempotent validation handling
- Circuit breaker pattern (Resilience4j)
- Distributed rate limiting (Redis + Bucket4j)
- Webhook-driven architecture with HMAC security
- Scheduler-based failure recovery
- Event-driven validation lifecycle
- Secure API design (JWT + HMAC)
- API versioning
- Containerized deployment (Docker Compose)
- Cloud deployment (AWS EC2)
- HTTPS (currently HTTP due to free-tier constraints)
- Monitoring & alerting (Prometheus, Grafana)
- Distributed tracing
- Message queues (Kafka / RabbitMQ) for fully decoupled processing
- Introduce message queues for decoupled, resilient processing
- Add full observability stack (metrics + distributed tracing)
- Enable HTTPS with production-grade TLS
- Auto-scaling infrastructure
Venkatesh
Backend Developer



