Giter Club home page Giter Club logo

fraud-detection's Introduction

Fraud Detection Service Application

Application to manage Fraud Transactions based on Spring Boot Rest Api. Provides a processing Transaction Files with Spring Batch and expose an Api to trigger job.

Technology choices

  • Lightweight Spring Boot service with embedded tomcat and use Spring Batch to proceeding transaction list files.
  • Rest Api is documented with Swagger and openApi, which provides nice UI with all documentation and ability to test services
  • Persistence based on Spring Data JPA and in-memory h2 database to simplify the deployment and avoid external dependencies. (not suitable for production, but easily replaceable by other relational database)
  • Unit and integration testing with JUnit and Mockito. Rest Api integration testing with spring-test.

Prerequisites

To be able to run application you need to have installed:

  • Spring webmvc/jpa data/hibernate
  • Maven
  • Java 17
  • h2
  • Docker
  • Swagger/OpenApi/Springfox
  • Mockito

Running modes

By default application will run in development mode (see application.properties):

  • Logs are printed only to console and root level for application packages - DEBUG
  • Application uses in-memory database

To run in production mode, application should be started with spring profile "server" activated (see application-server.properties):

  • Logs will be printed to file in the logs folder of the root directory
  • Logging root level for all packages - INFO

How to run application

Run the docker compose file

      docker-compose -f "docker-compose.yml" up --build -d

With maven:
Use spring boot plugin to start(it will build backend and frontend):
mvn spring-boot:run

For deployment on test/production without docker server:
Build jar package with maven:
mvn clean package
Run application with:
java -jar fraud-detection-0.0.1-SNAPSHOT.jar --spring.profiles.active=server

Testing of application functionality

Example of request to trigger the job for processing CSV file and return fraud list:

curl --location --request GET 'http://localhost:9595/job/CSV'

Example of request to trigger the job for processing JSON file and return fraud list:

curl --location --request GET 'http://localhost:9595/job/JSON'

Or you can use Swagger UI, which contains Rest Api documentation:
http://localhost:9595/swagger-ui/index.html

Limitations

  • Application uses in-memory relational database h2, so after restart all the data is reloaded.
  • On startup application creates tables in the database based on JPA-entities, which is not suitable for production.

TODO (for the next iterations)

  • Move to proper persistence storage: relational or NoSql database.
  • Use encrypted transport protocol(TLS) for Rest Api.
  • Improve authentication/authorization with proper user/roles management.
  • Add support for encrypted properties to avoid sensitive data provided in plain text.
  • Provide some service to upload and manage the Fraud file with different formats
  • Add a AMQP like Kafka to manage and detect fraud detection in real time.
  • Configure CI/CD server for build and deployment
  • Improve input validation for Rest Api. Define better error messages in property file.
  • Add pagination for GET all frauds api to be able to limit amount of returned items.
  • Add separate maven profile to run integration tests.

fraud-detection's People

Contributors

alirezazabetan avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.