/bankAPI

bankAPI is a simple banking API that allows users to create accounts and manage their finances within a family setting.

Primary LanguageJavaScriptMIT LicenseMIT

bankAPI

This API repository is meant to be coupled with the bank webpage, which can be found in : FamBank Github or FamBank Webpage
Note that the API used for the webpage is hosted privately on Render

bankAPI is a simple banking API that allows users to create accounts and manage their finances within a family setting.
It provides functionality for adding users to accounts, creating accounts, and performing transactions.
The API is built using Node.js, Express.js, and MongoDB for data storage. Additionally, it utilizes the OpenAI API as a virtual assistant to provide helpful prompts and responses.

Features

User registration and login functionality
Account creation and management
Transaction processing and balance updates
Secure authentication using JWT (JSON Web Tokens)
Integration with MongoDB for data persistence
Natural language processing using the OpenAI API
Scheduled events using node-cron

Prerequisites

Before running the API, make sure you install the dependencies required (given node.js is installed in your machine) using :
npm install
In addition, your openai API Key and MongoDB info are to be added in passwords.js (or just change the variables used)
To start the server, simply run node app.js in the terminal

API Endpoints

POST /api/signup: User registration endpoint. Creates a new user account.
POST /api/login: User login endpoint. Authenticates the user and returns an access token.
POST /api/createAccount: Account creation endpoint. Creates a new bank account.
GET /api/getAllAccounts: Account retrieval endpoint. Returns all accounts associated with the authenticated user.
GET /api/getAccountDetails/:id Account details retrieval endpoint. Returns detailed information about a specific account.
POST /api/billPayment/:type/:id Pays a particular bill and deducts amount from user's balance. Includes a feature for automatic monthly payment.
POST /api/addDebit/:id Deducts a particular amount from user's balance. Includes a feature for automatic monthly payment.
POST /api/allowance/:id Assigns allowance (or instant transfer) to another specified user in the bank account. Includes a feature for automatic monthly transfer.
GET /api/chatbot/:id OpenAI prompt execution endpoint. Sends a prompt to the OpenAI API and returns the generated response.

Security

bankAPI ensures secure communication between the client and server using JWT (JSON Web Tokens) for authentication. Make sure to include the access token in the Authorization header for protected endpoints.

Credits

bankAPI is fully developed by myself Akvn @akvnn

License

bankAPI is under the MIT License.
Feel free to modify and customize the API according to your requirements.