A production-style modular monolithic financial management backend system built using Java 21, Spring Boot, Spring Security, JWT Authentication, Redis Cache, Scheduler Automation, Rate Limiting, and MySQL/PostgreSQL persistence.
ApnaBudget is a modern personal finance management platform designed to simplify financial tracking, budget management, savings planning, and financial analytics.
The platform helps users:
- Track income and expenses
- Manage monthly budgets
- Monitor spending patterns
- Create and manage savings goals
- Analyze financial trends
- Receive automated budget alerts
- Visualize real-time financial insights
- Maintain better financial discipline
The backend architecture powers a complete financial ecosystem with:
- Secure JWT authentication
- Real-time financial calculations
- Dynamic analytics aggregation
- Budget monitoring engine
- Goal reservation system
- Background automation
- Redis caching
- Notification processing
- Production-style modular architecture
ApnaBudget is designed not only as a CRUD-based application, but as a scalable financial management system demonstrating real-world backend engineering concepts.
- Production URL: https://apna-budget.vercel.app/
The backend architecture follows a modular monolithic architecture where all business modules exist inside a single deployable backend application while maintaining clean separation of concerns.
ApnaBudget is designed as a:
Modular Monolithic Backend Application
This means:
- All modules are deployed together as one backend application.
- Each module is internally separated using layered architecture.
- Business domains are isolated into independent services.
- Shared authentication, scheduler, analytics, and caching systems are used across modules.
The backend follows:
- Layered Architecture
- Modular Domain Separation
- Stateless JWT Authentication
- Read-Optimized Analytics Design
- Scheduler-Based Automation
- Async Notification Processing
- Strategy Pattern Based Notification System
- Redis-Based Caching Layer
- Financial Aggregation Architecture
ApnaBudget is a modern financial management backend system built using Spring Boot. The system is designed to help users manage personal finances efficiently through transaction tracking, budget monitoring, goal allocation, financial analytics, automated alerts, and intelligent background processing.
The backend architecture follows a layered and modular design using:
- Spring Boot
- Spring Security
- JWT Authentication
- Spring Data JPA
- MySQL
- Redis Cache
- Scheduler & Background Jobs
- Strategy Pattern
- Dockerized Infrastructure
The system is designed with production-style backend principles such as:
- Clean layered architecture
- Separation of concerns
- Background automation
- Caching
- JWT-based stateless authentication
- Financial analytics aggregation
- Notification extensibility
- Domain-driven module separation
- User Registration
- Secure Login System
- JWT-Based Authentication
- Stateless Authentication
- Protected APIs
- Spring Security Integration
- Password Encryption
- Custom Authentication Provider
- Bucket4j Rate Limiting
- IP-Based Request Protection
- Add Income Transactions
- Add Expense Transactions
- Transaction History Tracking
- Category-Based Transactions
- Payment Type Support
- Real-Time Balance Updates
- Weekly Transaction Analysis
- Latest Transactions Feed
- Create Monthly Budgets
- Category-Specific Budgets
- Default Budget Support
- Budget Consumption Tracking
- Automatic Budget Condition Detection
- Warning Budget Detection
- Exceeded Budget Detection
- Real-Time Budget Updates
- Budget Alert System
- Create Financial Goals
- Allocate Money To Goals
- Withdraw Money From Goals
- Reserved Balance System
- Goal Progress Tracking
- Goal Expiry Monitoring
- Automatic Goal Balance Restoration
- Goal-Based Financial Planning
- Total Balance Analytics
- Available Balance Tracking
- Reserved Goal Balance Tracking
- Income vs Expense Analysis
- Weekly Financial Comparison
- Spending Trend Analysis
- Category-Wise Expense Analysis
- Budget Utilization Analysis
- Goal Progress Analytics
- Financial Insight Generation
- Dashboard Summary System
- Email Notification Support
- Budget Alert Emails
- Strategy Pattern Notification Architecture
- Async Notification Processing
- Gmail Integration
- Scheduler-Based Goal Monitoring
- Automatic Goal Expiry Processing
- Budget Monitoring Scheduler
- Automated Notification Triggering
- Async Financial Processing
- Dashboard Analytics Caching
- Wallet Information Caching
- Reduced Database Load
- Faster API Responses
- Analytics Optimization
- Dockerized Redis
- Production Deployment
- RESTful APIs
- Scalable Backend Design
- Redis Integration
- Production-Ready Architecture
User
โ
React Frontend
โ
REST APIs
โ
Spring Security Layer
โ
Spring Boot Backend
โโโ Authentication Module
โโโ Transaction Module
โโโ Budget Module
โโโ Goal Module
โโโ Dashboard Analytics Engine
โโโ Wallet Analytics Module
โโโ Notification System
โโโ Scheduler (Background Jobs)
โโโ Redis Cache Layer
โ
MySQL Database
Controller Layer
โ
Service Layer
โ
Repository Layer
โ
Database
Responsibilities:
- Handle HTTP requests
- Validate incoming DTOs
- Return API responses
- Route requests to services
Responsibilities:
- Business logic
- Financial calculations
- Analytics generation
- Transaction management
- Scheduler processing
- Notification triggering
Responsibilities:
- Database interaction
- JPA queries
- Data retrieval
- Aggregation queries
- Pagination
- Filtering
User
โ
/register
โ
Spring Security Filter Chain
โ
Controller
โ
Service Layer
โ
Password Encoding
โ
Save User in Database
โ
Success Response
User
โ
/login
โ
RateLimiterFilter
โ
Spring Security Filter Chain
โ
Authentication Manager
โ
Custom Authentication Provider
โ
UserDetailsService
โ
Database Validation
โ
JWT Generation
โ
Return JWT Token
Frontend Request + JWT
โ
RateLimiterFilter
โ
JWT Validation Filter
โ
Token Validation
โ
SecurityContext Authentication
โ
Controller Execution
ApnaBudget uses:
- Bucket4j
- Token Bucket Algorithm
- IP-Based Request Limiting
- Prevents API abuse
- Prevents brute-force attacks
- Protects public APIs
- Configurable token refill strategy
- Independent bucket per IP address
10 Requests / 2 Seconds
The system maintains:
The actual usable balance available to the user.
Funds allocated to goals are reserved and removed from available balance.
Represents:
Available Balance + Goal Reserved Balance
This architecture allows:
- Accurate financial tracking
- Goal reservation
- Real-world financial simulation
- Safer spending analysis
Add Income Transaction
โ
Save Transaction
โ
Increase Student Available Balance
โ
Update Dashboard Analytics
Add Expense Transaction
โ
Save Transaction
โ
Decrease Student Available Balance
โ
Update Budget Current Amount
โ
Recalculate Budget Condition
โ
Update Dashboard Analytics
Budget consumption below warning threshold.
Budget nearing target limit.
Budget target exceeded.
(CurrentAmount ร 100) / TargetAmount
The system automatically:
- Tracks expenses
- Updates budget current amount
- Detects warning conditions
- Detects exceeded budgets
- Triggers notification system
Allocate Balance
โ
Check Available Balance
โ
Deduct Student Balance
โ
Increase Goal Current Amount
โ
Persist Changes
Withdraw Goal Balance
โ
Decrease Goal Current Amount
โ
Return Amount To Available Balance
โ
Persist Changes
The application contains automated background processing.
Responsibilities:
- Check expired goals
- Restore reserved balance
- Update student balance
- Mark goal state
Responsibilities:
- Detect exceeded budgets
- Detect warning budgets
- Trigger notification system
The application uses:
Strategy Pattern
for extensible notification handling.
Notification Context
โ
Notification Strategy
โ
Email Strategy
SMS Strategy
Push Strategy
- Gmail Notification Service
- Async Notification Processing
- Automated Budget Alert Emails
Redis is used for:
- Dashboard analytics caching
- Wallet analytics caching
- Frequently accessed financial data
- Performance optimization
Redis significantly reduces:
- Database load
- Analytics recomputation
- Repeated aggregation queries
and improves:
- API response time
- Scalability
- User experience
The application uses Dockerized infrastructure for:
- Redis containerization
- Consistent deployment
- Environment portability
- Easier production setup
Stores:
- User information
- Authentication details
- Available balance
Stores:
- Income transactions
- Expense transactions
- Payment type
- Transaction category
- Transaction timestamp
Stores:
- Budget target amount
- Current consumed amount
- Budget condition
- Budget duration
- Associated category
Stores:
- Goal target amount
- Current allocated amount
- Goal duration
- Goal progress
Stores:
- Category name
- Category type
- Default categories
- User-defined categories
The analytics engine calculates:
- Weekly spending trends
- Income vs expense comparison
- Percentage difference analysis
- Category-based spending analysis
- Budget utilization
- Goal progress analysis
- Financial insights
The application compares:
Current Week vs Previous Week
to generate:
- Spending increase insights
- Spending reduction insights
- Financial trend observations
- Stateless authentication
- Secure token validation
- Protected API access
- SecurityContext integration
- Password hashing
- Encoded credential storage
- Secure authentication flow
- Bucket4j token bucket algorithm
- API abuse prevention
- Brute-force attack protection
- Per-IP request limiting
The backend includes:
- Redis caching
- Aggregation queries
- Efficient financial calculations
- Scheduler-based automation
- Read-only analytics processing
- Layered modular architecture
- Background async processing
| Pattern | Usage |
|---|---|
| Strategy Pattern | Notification System |
| Layered Architecture | Backend Structure |
| DTO Pattern | Request/Response Separation |
| Scheduler Pattern | Background Automation |
| Repository Pattern | Database Abstraction |
This project demonstrates:
- Enterprise-style backend architecture
- Financial domain modeling
- Spring Security lifecycle
- JWT authentication
- Background job processing
- Caching strategies
- Modular system design
- Analytics aggregation systems
- Notification extensibility
- Clean service separation
- Rate limiting architecture
- Production-grade security flow
- Horizontal backend scaling
- Load balancer integration
- Distributed Redis caching
- Kubernetes orchestration
- API Gateway integration
- Multi-environment deployment pipelines
- Advanced Redis caching strategies
- Query optimization & indexing
- Asynchronous event-driven processing
- Backend response optimization
- Batch processing for analytics
- Database connection pooling optimization
- Refresh Token Authentication
- Role-Based Access Control (RBAC)
- OAuth2 & Google Authentication
- Advanced API security hardening
- CSRF/XSS protection improvements
- Device/session management
- Suspicious login detection
- Distributed rate limiting using Redis
- Request fingerprinting
- API abuse monitoring
- AOP-based centralized logging
- AOP-based performance monitoring
- AOP-based exception handling
- Event-driven notification architecture
- Microservices migration strategy
- Distributed scheduler support
- CQRS-based analytics separation
- Centralized logging system
- Prometheus metrics integration
- Grafana monitoring dashboards
- Real-time backend health monitoring
- Distributed tracing
- Request lifecycle tracking
- AI-powered spending prediction
- Smart financial recommendations
- Financial anomaly detection
- Expense forecasting
- Intelligent savings suggestions
- Monthly financial health scoring
- SMS notifications
- Push notifications
- WebSocket real-time alerts
- Multi-channel notification system
- Notification preference management
- PDF financial report exports
- Excel report generation
- Advanced financial dashboards
- Custom analytics reports
- Historical financial trend analysis
- CI/CD pipeline integration
- Docker Compose orchestration
- Blue-Green deployment strategy
- Automated backup systems
- Cloud-native deployment
- Infrastructure monitoring
- Java 21+
- MySQL
- Redis
- Maven
- Docker
git clone <repository-url>Update:
application.propertieswith:
spring.datasource.url=
spring.datasource.username=
spring.datasource.password=spring.data.redis.host=
spring.data.redis.port=spring.mail.username=
spring.mail.password=mvn spring-boot:runApnaBudget is not just a CRUD application.
The backend includes:
- Financial analytics engine
- Scheduler automation
- Strategy pattern notification system
- Goal reservation architecture
- Budget monitoring engine
- JWT-based security
- Redis caching
- Docker infrastructure
- Rate limiting architecture
- Modular enterprise architecture
ApnaBudget Backend is designed as a scalable financial management system that combines:
- Modern backend architecture
- Financial analytics
- Automation
- Caching
- Asynchronous processing
- Secure authentication
- Extensible notification systems
- Rate limiting protection
- Production-grade backend engineering
The project demonstrates practical implementation of production-level backend engineering concepts using the Spring ecosystem.