Skip to content

LukeKenyon/banking_api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Easy Banking API

A Python FastAPI-based REST API for banking operations with MongoDB integration from either a local instance in Docker Container or cloud MongoDB instance.

The project is used to learn Python and to test a Python chatbot console application for banking operations. using Python NLTK which is in a seperate repository. It is a work in progress and will be updated as the project progresses.

I assume that a Customer has a single customer account but could have multiple bank accounts. As all api endpoints are secured I created all customers using a script that creates the records directly in the database. I did this to avoid the need to create a user interface for the application.

Tranactions are processed by a simple transaction Endpoint that receives a transaction request and returns a transaction response.The transaction request contains the transaction type (deposit, withdrawal,transfer) , the account number, and the amount and if a transfer the to ACCOUNT ID. The transaction response contains the transaction ID, the transaction type, the account number, the amount, the transaction status, and the transaction date.

I built the project using VSCode and Docker. I used Python to create a virtual environement to install and manage the required packages.

The API also creates Device accounts which would be used to ensure that only the authorised device and customer can access the device, not yet implemented.

Table of Contents

Features

  • Customer account management
  • Address management
  • Transaction processing
  • Device authentication
  • JWT-based authentication with RSA keys
  • Email notifications (Dummy service)
  • Multi-account support
  • Secure password hashing (hashes and stores passwords in MongoDB)

Prerequisites

  • Python 3.7+
  • MongoDB
  • Poetry (optional), I used PIP in this project

Installation

  1. Clone the repository:
  2. Install dependencies using the requirements.txt file:
  3. Create the MongoDB instance using Docker or a cloud instance
  4. Create a .env file in the root directory

Project Structure

  • endpoints - contains the API endpoints used for the API
  • models - contains the Pydantic models used for the API
  • services - contains the services used for the API
  • utils - contains the utils used for the API
  • main.py - contains the main function used for the API

RSAKeyStore

This requires the creation of a folder named 'RSAKeyStore' in the root directory. This will contain the RSA keys used for the API. Both a public and private key will be required for the API to work. The public key will be used for the API to verify the JWT token and the private key will be used for the API to sign the JWT token. The public Key is made available to the client and the private key is kept secret. the keys must be in the .pem format and named 'public.pem' and 'private.pem' respectively. Many ways exist to create keys which is not covered in this README.

Environment Setup

Create a .env file in the root directory with:

MONGODB_URL = "your_mongodb_connection_string"

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages