/Banking-Service

A dummy bank created so that you can integrate the banking api service in your finance web apps.

Primary LanguageJavaScript

Banking Service - dummy bank application

The main goal of this web app is to provide a banking API service to users who want to integrate a dummy bank into their finance applications. Initially, this project was going to be only a backend service providing APIs, but then I decided to build the frontend too.
Frontend Link Backend Link

Technologies Used

React NodeJS Express.js MongoDB Mongoose MUI Vercel Docker

Table of contents

Features

  • User Authentication (Login, Register)
  • Add Money to Account
  • Transfer Money Between Accounts
  • View Transaction History
  • View user account balance
  • Responsive UI, mobile responsive UI
  • Notifications received when request from other app
  • Integrate payment service with BookNest (working on it)

Screenshots

Screenshot 2024-06-14 224220

Screenshot 2024-06-14 224925

Screenshot 2024-06-14 224938

Getting started

Prerequisites

  • Node.js
  • Ensure you have MongoDB Atlas set up. Obtain your connection string.

Installation

You can directly run container of this application using this docker image which is available publicly on dockerhub

  1. Clone the repo:
    git clone https://github.com/yourusername/banking-service.git
  2. Install NPM packages for backend:
    cd backend
    npm install
  3. Install NPM packages for frontend:
    cd backend
    npm install

Running the app

  1. Start the backend server
    cd backend
    npm start
  2. Start the frontend server
    cd frontend
    npm start

API Documentation

This section provides detailed documentation for the API endpoints available in this project. The API is divided into two main sections: /userAuth and /userMoney. The API documentation currently is sort of outdated, will change and add all the additional routes that were created. Some api routes response data was also changed. Will post the entire API documentation of the base path of the api link possibly.

/userAuth Endpoints

Register New User

  • Endpoint: /userAuth/register-new
  • Method: POST
  • Description: Creates a new user in the MongoDB database and returns the user object.
  • Request Body:
    {
      "username": "your_username",
      "password": "your_password"
    }
  • Response: The whole user object is returned

Login user

  • Endpoint: /userAuth/login
  • Method: POST
  • Description: Login for the user, required for using in the frontend.
  • Request Body:
    {
      "username": "your_username",
      "password": "your_password"
    }
  • Response: The whole user object is returned

'/userMoney' Endpoints

Get User Balance

  • Endpoint: /userMoney/balance/:username
  • Method: GET
  • Description: Retrieves the balance amount for the specified user.
  • URL Parameters: username (string): The username of the user.
  • Response:
    {
    "balance": 1000
    }

Add Money to User Account

  • Endpoint: /userMoney/addMoney
  • Method: POST
  • Description: Adds money to the user's account and returns the updated balance and transaction details.
  • Request Body:
    {
      "username": "your_username",
      "amount": 100,
      "description": "Deposit"
    }
  • Response:
    {
      "balance": 1100,
      "transaction": {
        "amount": 100,
        "description": "Deposit",
        "transactionType": "Debit"
      }
    }

Transfer Money from User Account

  • Endpoint: /userMoney/transferMoney
  • Method: POST
  • Description: Credits or debits money from the user's account and returns the updated balance and transaction details.
  • Request Body:
    {
      "username": "your_username",
      "amount": 50,
      "description": "Transfer"
    }
  • **Response:- **
    {
      "balance": 1050,
      "transaction": {
        "amount": 50,
        "description": "Transfer",
        "transactionType": "Credit"
      }
    }

Get Transaction History

  • Endpoint: /userMoney/transaction-history/:username
  • Method: GET
  • Description: Retrieves the transaction history for the specified user.
  • URL Parameters: username (string): The username of the user.
  • Response:
    {
      "transactions": [
        {
          "amount": 100,
          "description": "Deposit",
          "transactionType": "Debit",
          "date": "2024-06-12T12:34:56.789Z"
        },
        {
          "amount": 50,
          "description": "Transfer",
          "transactionType": "Credit",
          "date": "2024-06-12T12:45:56.789Z"
        }
      ]
    }