Skip to content

About

Spring Boot CRUD REST API demonstrating layered architecture and database integration.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

Banking Microservices Reference Architecture

A production-style reference implementation of a Java/Spring Boot microservices system, modeled on patterns used in real banking and wealth-management platforms (client onboarding, document workflows, approval flows, and secure API access).

Why this project

Most public Spring Boot demos stop at a single CRUD service. This repo is meant to show how those services actually fit together in a regulated, enterprise environment — service boundaries, async messaging, security, and observability — the way they're built in banking systems rather than in tutorials.

Architecture

┌─────────────┐     ┌──────────────────┐     ┌─────────────────┐
│  API Gateway │────▶│  Auth Service     │────▶│  User/Profile    │
│  (Spring     │     │  (JWT/OAuth2)     │     │  Service         │
│   Cloud GW)  │     └──────────────────┘     └─────────────────┘
└──────┬───────┘
       │
       ▼
┌─────────────────┐     ┌──────────────────┐
│ Onboarding       │────▶│  Kafka            │
│ Service          │     │  (event bus)      │
└─────────────────┘     └────────┬─────────┘
                                  ▼
                         ┌──────────────────┐
                         │  Document /       │
                         │  Approval Service  │
                         └──────────────────┘

Design decisions worth noting:

  • Kafka over synchronous REST for onboarding events — decouples the onboarding, document, and approval services so a slow downstream consumer (e.g. document generation) never blocks the onboarding flow. Chosen over RabbitMQ for built-in event replay/audit trail, which matters for regulatory traceability.
  • JWT/OAuth2 at the gateway, not per-service — centralizes token validation, reduces duplicate auth logic across services, and simplifies key rotation.
  • Database-per-service — each service owns its schema (Oracle/PostgreSQL) to avoid tight coupling; cross-service data needs are handled via events, not shared tables.

Tech stack

Layer Technology
Backend Java 17, Spring Boot 3, Spring Cloud Gateway
Messaging Apache Kafka
Security Spring Security, JWT, OAuth2
Persistence Spring Data JPA/Hibernate, PostgreSQL/Oracle
Testing JUnit 5, Mockito, Testcontainers
API Docs OpenAPI/Swagger
Build/CI Maven, GitHub Actions

Trade-offs and what I'd do differently at scale

  • At small scale, database-per-service adds operational overhead (multiple schemas to manage). At larger scale it pays off by letting services deploy independently — the right call once you have more than ~5 services.
  • Synchronous REST between gateway and auth service is a single point of latency; a cached token-validation layer (e.g. local JWKS caching) would reduce gateway load in high-throughput scenarios.

Running locally

docker-compose up -d        # starts Kafka, Postgres, Zookeeper
mvn clean install
mvn spring-boot:run -pl auth-service
mvn spring-boot:run -pl onboarding-service

What's implemented vs. planned

Implemented:

  • JWT/OAuth2 authentication flow
  • Kafka producer/consumer for onboarding events
  • REST APIs for onboarding, document, and approval services
  • Unit and integration tests (Testcontainers for Kafka/Postgres)

Planned:

  • Distributed tracing (OpenTelemetry)
  • Circuit breaker pattern (Resilience4j) for downstream service calls
  • Kubernetes deployment manifests

Built by Santhosh Kumar K — Senior Java Backend Engineer / Technical Lead, 9+ years in banking & financial services (CIBC, Standard Chartered, Credit One Bank).

About

Spring Boot CRUD REST API demonstrating layered architecture and database integration.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors