Skip to content

A simple banking application with few banking features which provide high throughput and low latency performance built using spring boot , java 17 and deployed on AWS.

Notifications You must be signed in to change notification settings

Eomaxl/BankingApplication

Repository files navigation

🏦 Modern Banking System

A comprehensive, production-ready banking system built with Spring Boot, following modern software engineering principles and designed for AWS cloud deployment.

πŸš€ Features

Core Banking Operations

  • Customer Management: Complete customer onboarding and profile management
  • Account Management: Multiple account types (Savings, Checking, Business, Investment)
  • Transaction Processing: Deposits, withdrawals, and transfers with full audit trail
  • Balance Management: Real-time balance tracking with concurrent access protection
  • Transaction History: Comprehensive transaction reporting and filtering

Technical Excellence

  • SOLID Principles: Clean, maintainable, and extensible code architecture
  • Design Patterns: Factory, Strategy, Observer, Facade, and Repository patterns
  • Concurrency: Thread-safe operations with pessimistic locking and deadlock prevention
  • Security: Spring Security with JWT authentication and authorization
  • Validation: Comprehensive input validation and error handling
  • Testing: Unit, integration, and concurrent testing with 90%+ coverage

Modern Architecture

  • Domain-Driven Design: Clear domain boundaries and business logic separation
  • CQRS Ready: Separate read/write operations for scalability
  • Event Sourcing: Complete transaction audit trail
  • Microservices Ready: Modular design for easy service extraction
  • API-First: RESTful APIs with OpenAPI documentation

πŸ› οΈ Technology Stack

Backend

  • Java 17: Latest LTS version with modern language features
  • Spring Boot 3.2.1: Latest Spring Boot with native compilation support
  • Spring Data JPA: Database abstraction with Hibernate
  • Spring Security: Authentication and authorization
  • PostgreSQL: Production database with ACID compliance
  • H2: In-memory database for testing
  • Maven: Dependency management and build automation

Testing

  • JUnit 5: Modern testing framework
  • Mockito: Mocking framework for unit tests
  • TestContainers: Integration testing with real databases
  • AssertJ: Fluent assertions for better test readability

Documentation & API

  • OpenAPI 3.0: API documentation with Swagger UI
  • MapStruct: Type-safe bean mapping
  • Lombok: Boilerplate code reduction

DevOps & Cloud

  • Docker: Containerization with multi-stage builds
  • AWS ECS: Container orchestration with Fargate
  • AWS RDS: Managed PostgreSQL database
  • AWS ALB: Load balancing and SSL termination
  • CloudFormation: Infrastructure as Code
  • GitHub Actions: CI/CD pipeline

πŸ“‹ Prerequisites

  • Java 17 or higher
  • Maven 3.6+
  • Docker (for containerization)
  • AWS CLI (for deployment)
  • PostgreSQL (for production)

πŸš€ Quick Start

Local Development

  1. Clone the repository

    git clone https://github.com/your-org/banking-system.git
    cd banking-system
  2. Run with Docker Compose

    docker-compose up -d
  3. Or run locally

    mvn spring-boot:run
  4. Access the application

Testing

# Run all tests
mvn test

# Run specific test categories
mvn test -Dtest="*ServiceTest"
mvn test -Dtest="*RepositoryTest"
mvn test -Dtest="*ControllerTest"

# Run with coverage
mvn test jacoco:report

πŸ—οΈ Architecture

Domain Model

Person ←→ AccountHolder ←→ Account ←→ Transaction
   ↓           ↓              ↓
   └─────── Bank β†β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Layer Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚           REST Controllers          β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚             Services                β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚           Repositories              β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚            Database                 β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Key Components

  • PersonService: Customer information management
  • AccountService: Account operations with thread safety
  • TransactionService: Transaction processing and audit
  • BankingFacadeService: High-level business operations
  • Security: JWT-based authentication and authorization

πŸ”’ Security Features

  • Authentication: JWT-based stateless authentication
  • Authorization: Role-based access control
  • Input Validation: Comprehensive request validation
  • SQL Injection Prevention: Parameterized queries
  • XSS Protection: Safe data handling
  • HTTPS: SSL/TLS encryption in production
  • Audit Trail: Complete transaction logging

πŸ“Š API Documentation

The API is fully documented using OpenAPI 3.0 specification:

  • Interactive Documentation: /swagger-ui.html
  • OpenAPI Spec: /v3/api-docs

Key Endpoints

POST   /api/v1/banking/onboard-customer    # Customer onboarding
GET    /api/v1/accounts/{accountNumber}     # Get account details
POST   /api/v1/accounts/{accountNumber}/deposit    # Deposit money
POST   /api/v1/accounts/{accountNumber}/withdraw   # Withdraw money
POST   /api/v1/transfers                    # Transfer money
GET    /api/v1/accounts/{accountNumber}/transactions # Transaction history

πŸš€ AWS Deployment

Prerequisites

  • AWS CLI configured
  • Docker installed
  • Appropriate AWS permissions

Deployment Steps

  1. Deploy Infrastructure

    chmod +x scripts/deploy.sh
    ./scripts/deploy.sh dev us-east-1
  2. Access Application

    • The script will output the Application Load Balancer URL
    • API Documentation: http://{ALB-URL}/swagger-ui.html

Infrastructure Components

  • VPC: Isolated network with public/private subnets
  • ECS Fargate: Serverless container hosting
  • RDS PostgreSQL: Managed database with encryption
  • Application Load Balancer: High availability and SSL termination
  • Auto Scaling: Automatic scaling based on CPU/Memory
  • CloudWatch: Monitoring and alerting
  • S3: Document storage
  • SQS/SNS: Async processing and notifications

πŸ§ͺ Testing Strategy

Test Categories

  • Unit Tests: Service and component testing with mocking
  • Integration Tests: End-to-end business flow testing
  • Repository Tests: Data access layer testing
  • Controller Tests: REST API testing with MockMvc
  • Concurrent Tests: Thread safety and deadlock prevention

Test Coverage

  • Services: 95%+ coverage
  • Controllers: 90%+ coverage
  • Repositories: 85%+ coverage
  • Overall: 90%+ coverage

πŸ“ˆ Performance & Scalability

Concurrency Features

  • Thread-Safe Operations: Pessimistic locking for balance updates
  • Deadlock Prevention: Consistent lock ordering in transfers
  • Connection Pooling: Optimized database connections
  • Async Processing: Non-blocking operations where possible

Scalability Features

  • Horizontal Scaling: Stateless design for easy scaling
  • Database Optimization: Indexed queries and batch processing
  • Caching Ready: Service layer prepared for Redis integration
  • Load Balancing: Multiple instance support

πŸ”§ Configuration

Environment Profiles

  • default: Local development with H2
  • docker: Docker Compose with PostgreSQL
  • aws: Production deployment on AWS

Key Configuration Properties

spring:
  profiles:
    active: ${SPRING_PROFILES_ACTIVE:default}
  datasource:
    url: ${DATABASE_URL}
    username: ${DATABASE_USERNAME}
    password: ${DATABASE_PASSWORD}

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Development Guidelines

  • Follow SOLID principles
  • Write comprehensive tests
  • Use conventional commits
  • Update documentation
  • Ensure security best practices

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ†˜ Support

  • Documentation: Check the /docs folder for detailed guides
  • Issues: Report bugs and feature requests via GitHub Issues
  • Discussions: Join community discussions in GitHub Discussions

About

A simple banking application with few banking features which provide high throughput and low latency performance built using spring boot , java 17 and deployed on AWS.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published