Skip to content

A spring-boot application to demonstrate basic functionality of a fake banking system. Exposes REST API's

Notifications You must be signed in to change notification settings

naeemark/fun-bank-service

Repository files navigation

Fun Bank Service

Publish Docker Image Develop Branch Coverage Quality Gate Status Docker

Demonstration of Requirements understanding, proposing a solution and implementation by using the latest tools and techniques.



Distribution


What is this repository for?

  • This app is built as assignment for FunMid.
  • Adds different libs to enhance the application quality and performance.
  • Using SWAGGER.IO for documentation and as a working REST-API client
  • CI/CD Demonstration using Github Actions
  • Docker containers are used for Build Deployment
  • The live environment is established on an EC2 instance to run dockerized build
  • Version 1.0.0

Problem Statement:

Problem Statement


Proposed Solution:

  • By keep the provided instructions in mind, I would prefer to use a Spring Boot application for the implementation of required functionality.
  • MySQL Database will be used for Dev, Test and Prod environments.
  • For testing, I would prefer to use JUnit and Mockito
  • There will be a Dockrized Build distribution
  • As we are mocking a banking system, there should be a locking system on JPA to avoid auto change in schema.
  • There shouldn't be a possibility to modify the database via JPA
  • There should be a separate database to be used for testing purposes along with pre-populated data if required.
  • For demonstration purpose, an API frontend should be provided...i.e Swagger

Entities

  • As per the given statement, there will be two entities
  • I would like to use database constraints to avoid deletion of account which is used as a reference in some transaction
  • For symbolic use of locks, I would have locking annotations in required repositories ERD Problem Schema

Deliverable Content

Functional Implementation

  • POST {baseURL}/api/accounts - creates a new account with a default balance of 100
  • GET {baseURL}/api/accounts/{accountId} - Returns an account with balance
  • POST {baseURL}/api/transaction - creates a new transaction between the provided accounts

Non-Functional Implementation

  • GET {baseURL}/api/health - Checks the health of the system,
  • GET {baseURL}/api/accounts - Returns List of all accounts (to have an idea of the updated balance for multiple accounts after a transaction)
  • GET {baseURL}/api/accounts - Returns List of all transactions

Development Cycle:

How do I get set up?

<< Docker Compose >>

To run the project locally using docker;

  • docker compose up --detach --wait

To tear down:

  • docker compose down --remove-orphans

Developer set up

To setup the project locally you need to clone this repo, from main branch or some latest TAG

Configuration

  • Please sync and resolve the maven dependencies
  • Run mvn clean install
  • To run tests mvn clean test
Build Docker Image
  • docker build -t fun-bank-service .
Run Docker Image
Run Docker Image From Docker hub
Stop Docker Container
  • Run docker kill {container-id}

Pre-reqs

  • JDK 1.8
  • Spring Boot
  • Docker
  • MySQL
  • Junit
  • Mockito
  • Swagger
  • IntelliJ IDEA

Tools Included

  • Jacoco
  • Sonar
  • Swagger
  • JPA
  • Hibernate
  • Github Actions
  • EC2 Instance for deployment

Auth

  • No auth system is included in this solution

External Tools:

Deployment

  • When a pull request is merged in master, Github Action starts and following steps are done by automated CI/CD:

    • Creates Environment and Runs all tests
    • Complete a SonarQube analysis and pushes the results to Live Project
    • Makes a deployment to Github packages (Mock)
    • Creates the Docker Image and pushes to Docker Repository
  • As a next step, it is deployed manually in an ec2 instance.

Contribution guidelines

  • Forks are always appreciated

About

A spring-boot application to demonstrate basic functionality of a fake banking system. Exposes REST API's

Resources

Stars

Watchers

Forks

Packages

No packages published