Skip to content

InvoZone/fintech

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FinTech Card Management & Fraud Detection Microservices

Overview

This project consists of two Spring Boot microservices:

  • Transaction Service: Manages cards, accounts, and transactions for a card management system.
  • Fraud Detection Service: Flags potentially fraudulent transactions based on configurable limits and frequency.

Prerequisites

  • Docker & Docker Compose (see your version with docker --version and docker compose version)
  • (Optional) Java 21 (JDK) and Maven (only needed if you want to build/test outside Docker)

Quick Start: Running with Docker Compose

1. Start All Services with Docker Compose

docker compose up --build
  • This will:
    • Start a PostgreSQL 14.18 container with two databases: card_transaction and card_fraud_detection
    • Build the JARs for both services inside the containers using Maven (multi-stage Docker build)
    • Run the transaction and fraudDetection services as separate containers with the correct JDK (Temurin 21)

You do NOT need to run Maven manually to build the JARs. Docker will do it for you.

2. Access the APIs

3. Stopping and Cleaning Up

  • To stop all containers:
    docker compose down
    
  • To remove all data (including databases and all data inside):
    docker compose down -v
    

Configuration (Docker Environment)

  • All configuration is handled via environment variables in docker-compose.yml and picked up by the services via ${ENV_VAR:default} syntax in application.properties.
  • You do NOT need to manually create databases or users. The init.sql script and Docker Compose handle this.

Key Environment Variables

  • SPRING_DATASOURCE_URL, SPRING_DATASOURCE_USERNAME, SPRING_DATASOURCE_PASSWORD: Set by Docker Compose for each service.
  • FRAUD_DETECTION_URL: Used by the transaction service to call the fraudDetection service.
  • SERVER_PORT: Used by fraudDetection to set its port (default 8081).

Fraud Detection Parameters

  • Can be set in fraudDetection/src/main/resources/application.properties before first run, or updated in the parameters table in the fraudDetection database:
    • fraud.limit (max transaction amount)
    • fraud.time-interval (ISO-8601 duration, e.g., PT30M for 30 minutes)
    • fraud.transaction-frequency-limit (max transactions per interval)

Logs

  • Transaction logs: transaction/logs/transaction.log
  • FraudDetection logs: fraudDetection/logs/fraudDetection.log

Unit Testing

  • To run unit tests (outside Docker):
    ./mvnw test
    
  • For integration tests, ensure the database is up and the required data (card/account) is present.

Troubleshooting

  • Database "card_fraud_detection" does not exist:
    Make sure you have not removed the init.sql mount in the postgres service in docker-compose.yml. If you change the DB setup, run docker compose down -v to reset the data volume (Warning: This will delete all the previous data in databases).

  • Port conflicts:
    Ensure 8080 (transaction) and 8081 (fraudDetection) are available.

  • Environment variables:
    All sensitive and environment-specific configs are injected via Docker Compose.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published