Skip to content

Latest commit

 

History

History
134 lines (99 loc) · 4.47 KB

File metadata and controls

134 lines (99 loc) · 4.47 KB

Banking Application - Microservices Demo

A banking application built with a microservices architecture demonstrating modern development practices including containerization, orchestration, and observability.

Project Overview

This system consists of:

Frontend: Next.js application with TypeScript Backend: Java Spring Boot microservices Database: PostgreSQL with service-specific schemas Orchestration: Kubernetes deployment Observability: OpenTelemetry with Jaeger, Prometheus, and Grafana

Repository Structure

├── backend/
│   ├── user-service/        # User authentication and profile management
│   ├── accounts-service/    # Bank account and balance management
│   ├── transactions-service/ # Financial transaction processing
│   └── api-gateway/        # Request routing and authentication
├── frontend/               # Next.js web application
├── infrastructure/         # Kubernetes manifests and configs
├── docker/                # Dockerfiles for all services
└── plan.md                # Detailed implementation plan with phases

Architecture Key Points

Authentication Flow: JWT tokens generated by user-service, validated by all other services Database Design: Single PostgreSQL instance with separate schemas per service (user_service, accounts_service, transactions_service) Service Communication: REST APIs with JSON, all routed through API Gateway Transaction Safety: Atomic operations with rollback mechanisms in transactions-service Observability: OpenTelemetry instrumentation across all Java services

Development Commands

Local Development Setup

# Start all services in development mode
docker-compose up -d

# Build individual service (from service directory)
./mvnw clean package

# Run individual service locally
./mvnw spring-boot:run

Kubernetes Deployment

Local Development:

# Deploy with localhost configuration
kubectl apply -k kubernetes/base/

Production Deployment:

# Deploy with production configuration
kubectl apply -k kubernetes/overlays/speedscale/

Note: For production, edit kubernetes/overlays/speedscale/frontend-config-patch.yaml to set your actual API domain instead of https://your-api-domain.com.

Frontend Development

# Start Next.js development server
cd frontend && npm run dev

# Build for production
npm run build

# Run tests
npm test

Database Operations

# Connect to PostgreSQL
psql -h localhost -U postgres -d banking_app

# Run migrations (from service directory)
./mvnw flyway:migrate

Testing

# Run backend unit tests
./mvnw test

# Run integration tests
./mvnw verify -P integration-tests

# Run frontend tests
cd frontend && npm test

# Run E2E tests
npm run test:e2e

Implementation Status

Currently in Phase 1.1 (Repository Structure) - see plan.md for detailed phase breakdown and testing criteria. Each phase has specific implementation tasks and testing requirements that must be completed before proceeding to the next phase.

Key Implementation Notes

  • All services must implement JWT validation middleware except user-service (which generates tokens)
  • Transaction operations require account ownership validation and sufficient balance checks
  • Each service needs OpenTelemetry instrumentation for distributed tracing
  • Database schemas are logically separated but physically in the same PostgreSQL instance
  • API Gateway handles routing, rate limiting, and global authentication checks
  • All services should include comprehensive unit and integration tests with >80% coverage

Security Considerations

  • JWT tokens stored in HttpOnly cookies on frontend
  • Database connections use connection pooling with proper credentials
  • All services run as non-root users in containers
  • API endpoints require authentication except for user registration/login
  • Input validation required on all endpoints to prevent injection attacks

Getting Started

  1. Prerequisites: Docker, Docker Compose, Node.js, Java 11+, Maven
  2. Clone the repository
  3. Review the implementation plan: See plan.md for detailed phases
  4. Set up local environment: Follow Phase 1 tasks in the plan
  5. Start development: Use the development commands above

Project Structure

This is a monorepo containing all microservices and the frontend application. Each service is designed to be independently deployable while maintaining consistency in tooling and patterns.