Skip to content

Repository files navigation

πŸ›‘οΈ FraudShield

A Production-Grade Microservices Platform for Real-Time Financial Fraud Detection

Java Spring Boot Spring Cloud License


🧭 Overview

FraudShield is a microservices-based fraud detection and case management platform built with Java and Spring Cloud. It monitors financial transactions in real time, scores them for fraud risk, escalates suspicious activity into case workflows, and notifies relevant parties β€” all through independent, scalable services communicating via a service registry and API gateway.

Designed as a full-stack microservices reference architecture β€” covering service discovery, JWT authentication, inter-service communication, fraud scoring, case lifecycle management, and notifications.


πŸ“Œ Table of Contents


πŸ—οΈ Architecture

                            β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                            β”‚       Service-Registry        β”‚
                            β”‚    Netflix Eureka  :8761      β”‚
                            β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                         β”‚  (all services register here)
             β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
             β”‚                           β”‚                              β”‚
     β”Œβ”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”       β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”       β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
     β”‚  API-Gateway   β”‚       β”‚    Auth-Service      β”‚       β”‚ Transaction-Service  β”‚
     β”‚  Spring Cloud  β”‚       β”‚   JWT  :8081          β”‚       β”‚   CRUD + Events :8082β”‚
     β”‚  Gateway :8080 β”‚       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
     β””β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜                                                 β”‚
             β”‚ (routes all                                               β”‚ (triggers fraud eval)
             β”‚  client traffic)                                          β–Ό
             β”‚                                            β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
             β”‚                                            β”‚  Fraud-Detection-Service  β”‚
             β”‚                                            β”‚  Risk Scoring     :8083   β”‚
             β”‚                                            β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
             β”‚                                                        β”‚ (on high risk)
             β”‚                                                        β–Ό
             β”‚                                            β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
             β”‚                                            β”‚   Fraud-Case-Service      β”‚
             β”‚                                            β”‚   Case Management  :8084  β”‚
             β”‚                                            β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
             β”‚                                                        β”‚
             β”‚                                                        β–Ό
             β”‚                                            β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
             └───────────────────────────────────────────▢  Notification-Service     β”‚
                                                          β”‚  Email / SMS Alerts :8085 β”‚
                                                          β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

🧩 Services

Service Port Description
Service-Registry 8761 Netflix Eureka server β€” dynamic service registration & discovery
API-Gateway 8080 Single entry point β€” routes, filters, and load-balances all traffic
Auth-Service 8081 User registration, login, and JWT token issuance & validation
Transaction-Service 8082 Creates, stores, and manages financial transactions
Fraud-Detection-Service 8083 Evaluates transactions and produces a fraud risk score
Fraud-Case-Service 8084 Opens and manages cases for flagged/suspicious transactions
Notification-Service 8085 Sends email/SMS alerts for fraud events and case updates

πŸ› οΈ Tech Stack

Core

Technology Role
Java 17+ Language
Spring Boot 3.x Microservice framework
Spring Cloud 2023.x Cloud-native patterns (discovery, gateway, config)
Spring Cloud Netflix Eureka Service registry & discovery
Spring Cloud Gateway API gateway with filters
Spring Cloud OpenFeign Declarative inter-service REST calls
Spring Security + JWT Authentication and authorization
Spring Data JPA Database ORM layer

Data & Messaging

Technology Role
MySQL / PostgreSQL Relational persistence per service
Hibernate JPA implementation

Tooling

Technology Role
Maven Build and dependency management
Lombok Reduces boilerplate (getters, builders)
Docker (optional) Containerized deployment

πŸš€ Getting Started

Prerequisites

  • Java 17 or higher
  • Maven 3.8+
  • MySQL or PostgreSQL
  • Git

Clone the Repository

git clone https://github.com/Sathish292004/FraudShield.git
cd FraudShield

▢️ Service Startup Order

⚠️ Order matters. Microservices must start in this sequence:

1️⃣  Service-Registry      (must be first β€” all others register here)
2️⃣  Auth-Service          (needed for token validation in gateway)
3️⃣  API-Gateway           (starts routing after services are up)
4️⃣  Transaction-Service
5️⃣  Fraud-Detection-Service
6️⃣  Fraud-Case-Service
7️⃣  Notification-Service

Start Each Service

# Terminal 1 β€” Registry first
cd Service-Registry && mvn spring-boot:run

# Terminal 2
cd Auth-Service && mvn spring-boot:run

# Terminal 3
cd API-Gateway && mvn spring-boot:run

# Terminal 4
cd Transaction-Service && mvn spring-boot:run

# Terminal 5
cd Fraud-Detection-Service && mvn spring-boot:run

# Terminal 6
cd Fraud-Case-Service && mvn spring-boot:run

# Terminal 7
cd Notification-Service && mvn spring-boot:run

Verify All Services Are Up

Open the Eureka dashboard at http://localhost:8761 β€” all services should appear as UP.


βš™οΈ Environment Configuration

Each service has its own application.yml. Below are the key shared settings:

# Eureka client (in every service EXCEPT Service-Registry)
eureka:
  client:
    service-url:
      defaultZone: http://localhost:8761/eureka/
  instance:
    prefer-ip-address: true

# Database (per service β€” use separate DB schemas)
spring:
  datasource:
    url: jdbc:mysql://localhost:3306/fraudshield_<service_name>
    username: root
    password: yourpassword
  jpa:
    hibernate:
      ddl-auto: update

Database Initialization

CREATE DATABASE fraudshield_auth;
CREATE DATABASE fraudshield_transactions;
CREATE DATABASE fraudshield_fraud_detection;
CREATE DATABASE fraudshield_fraud_cases;
CREATE DATABASE fraudshield_notifications;

🌐 API Overview

All requests go through the API-Gateway at http://localhost:8080.

Auth-Service

Method Endpoint Description
POST /api/auth/register Register a new user
POST /api/auth/login Login and receive JWT token
GET /api/auth/validate Validate an existing token

Transaction-Service

Method Endpoint Description
POST /api/transactions Submit a new transaction
GET /api/transactions List all transactions
GET /api/transactions/{id} Get transaction by ID
GET /api/transactions/account/{id} Get by account
GET /api/transactions/status/{status} Filter by status

Fraud-Detection-Service

Method Endpoint Description
POST /api/fraud/evaluate Score a transaction for fraud risk
GET /api/fraud/history/{transactionId} Get evaluation history

Fraud-Case-Service

Method Endpoint Description
POST /api/cases Open a new fraud case
GET /api/cases List all cases
GET /api/cases/{id} Get case details
PATCH /api/cases/{id}/status Update case status
POST /api/cases/{id}/resolve Resolve a case

Notification-Service

Method Endpoint Description
POST /api/notifications/send Send a notification
GET /api/notifications/{userId} Get user notifications

πŸ“ Project Structure

FraudShield/
β”‚
β”œβ”€β”€ Service-Registry/           # Netflix Eureka Server
β”‚   β”œβ”€β”€ src/main/java/
β”‚   β”‚   └── ServiceRegistryApplication.java
β”‚   └── src/main/resources/
β”‚       └── application.yml
β”‚
β”œβ”€β”€ API-Gateway/                # Spring Cloud Gateway
β”‚   β”œβ”€β”€ src/main/java/
β”‚   β”‚   └── ApiGatewayApplication.java
β”‚   └── src/main/resources/
β”‚       └── application.yml
β”‚
β”œβ”€β”€ Auth-Service/               # JWT Auth
β”‚   β”œβ”€β”€ src/main/java/
β”‚   β”‚   β”œβ”€β”€ controller/
β”‚   β”‚   β”œβ”€β”€ service/
β”‚   β”‚   β”œβ”€β”€ model/
β”‚   β”‚   └── security/
β”‚   └── src/main/resources/
β”‚
β”œβ”€β”€ Transaction-Service/        # Transaction CRUD + events
β”‚   β”œβ”€β”€ src/main/java/
β”‚   β”‚   β”œβ”€β”€ controller/
β”‚   β”‚   β”œβ”€β”€ service/
β”‚   β”‚   β”œβ”€β”€ repository/
β”‚   β”‚   β”œβ”€β”€ model/
β”‚   β”‚   β”œβ”€β”€ dto/
β”‚   β”‚   └── client/
β”‚   └── src/main/resources/
β”‚
β”œβ”€β”€ Fraud-Detection-Service/    # Risk scoring engine
β”‚   β”œβ”€β”€ src/main/java/
β”‚   β”‚   β”œβ”€β”€ controller/
β”‚   β”‚   β”œβ”€β”€ service/
β”‚   β”‚   β”œβ”€β”€ model/
β”‚   β”‚   └── rules/
β”‚   └── src/main/resources/
β”‚
β”œβ”€β”€ Fraud-Case-Service/         # Case lifecycle management
β”‚   β”œβ”€β”€ src/main/java/
β”‚   β”‚   β”œβ”€β”€ controller/
β”‚   β”‚   β”œβ”€β”€ service/
β”‚   β”‚   β”œβ”€β”€ repository/
β”‚   β”‚   └── model/
β”‚   └── src/main/resources/
β”‚
β”œβ”€β”€ Notification-Service/       # Alert dispatch
β”‚   β”œβ”€β”€ src/main/java/
β”‚   β”‚   β”œβ”€β”€ controller/
β”‚   β”‚   β”œβ”€β”€ service/
β”‚   β”‚   └── model/
β”‚   └── src/main/resources/
β”‚
β”œβ”€β”€ .gitignore
└── LICENSE

πŸ”„ Key Flows

1. Transaction Submission & Fraud Evaluation

Client
  │──POST /api/transactions──▢ API-Gateway
                                    │──▢ [JWT filter validates token via Auth-Service]
                                    │──▢ Transaction-Service
                                              β”‚ saves transaction (PENDING)
                                              │──▢ Fraud-Detection-Service
                                                        β”‚ evaluates risk score
                                                        β”‚ if score > threshold:
                                                        │──▢ Fraud-Case-Service (open case)
                                                        │──▢ Notification-Service (send alert)
                                                        β”‚ update transaction β†’ FLAGGED / APPROVED

2. User Authentication Flow

Client
  │──POST /api/auth/login──▢ API-Gateway
                                  │──▢ Auth-Service
                                          β”‚ validates credentials
                                          β”‚ returns JWT token
  Client stores JWT and attaches to subsequent requests as Bearer token

πŸ” Security

  • All endpoints (except /api/auth/**) require a valid JWT Bearer token
  • The API-Gateway validates tokens before forwarding requests
  • Each service independently verifies claims where needed
  • Passwords are stored with BCrypt hashing

πŸ“„ License

Copyright (c) 2026 Sathish Kumar B

Educational Use Only License

This project is provided for educational and learning purposes only.
You may NOT copy, modify, redistribute, or use this code for commercial purposes
without prior written permission from the copyright owner.

See the LICENSE file for full terms.

πŸ‘€ Author

Sathish Kumar B


πŸ’‘ For service-specific documentation, see the README.md inside each service folder.

About

πŸ›‘οΈ Spring Boot microservices backend for FraudShield β€” API Gateway, Auth, Transaction, Fraud Detection, Fraud Case, Notification services and a Eureka Service Registry for real-time digital payment fraud detection.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages