Banka is a light-weight core banking application that powers banking operations like account creation, customer deposit and withdrawals. This app is meant to support a single bank, where users can signup and create bank accounts online, but must visit the branch to withdraw or deposit money.
Features
- User signup.
- User signin.
- User can create a bank account.
- User can view account details.
- User can view account transaction history.
- User can view a specific account transaction.
- Admin can view a specific user account.
- Admin/Staff can view all bank accounts.
- Admin/Staff can view a specific bank account.
- Admin/Staff can activate or deactivate a bank account.
- Admin/Staff can view all active bank accounts.
- Admin/Staff can view all dormant bank accounts.
- Staff can credit an account.
- Staff can debit an account.
- Admin/Staff can delete a bank account.
UI Templates for this application can be accessed via this link
- Node.js - A runtime environment based off of Chromes's V8 Engine for writing Javascript server-side applications.
- Express.js - Web application framework based on Node.js.
- ESLint - A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript.
- Airbnb style guide was followed.
- PostgreSQL - Relational Database Management System.
- Swagger - Document your code and keep a live and reusable OpenAPI (Swagger) specification.
- Mocha - A JavaScript test framework.
- Chai - A test assertion library for JavaScript.
- Supertest - A module that provides high-level abstraction for HTTP testing.
- The API for this application is documented using Swagger
- The API endpoints are hosted on Heroku - Banka
METHOD | DESCRIPTION | ENDPOINT |
---|---|---|
POST | Sign Up | api/v1/auth/signup |
POST | Sign In | api/v1/auth/signin |
GET | Get a specific user account | api/v1/users/:id |
POST | Create a bank account | api/v1/accounts |
GET | Get all bank accounts | api/v1/accounts |
GET | Get a specific bank account | api/v1/accounts/:acccountNumber |
GET | Get an account's transaction history | api/v1/accounts/:accountNumber/transactions |
GET | Get a specific account's transaction | api/v1/transactions/:transactionId |
GET | Get all accounts owned by specific user | api/v1/user/:userEmail/accounts |
GET | Get a list of all active bank accounts | api/v1/accounts?status=active |
GET | Get a list of all dormant bank accounts | api/v1/accounts?status=dormant |
PATCH | Activate or Deactivate a bank account | api/v1/accounts/:acccountNumber |
POST | Credit a bank account | api/v1/transactions/:acccountNumber/credit |
POST | Debit a bank account | api/v1/transactions/:acccountNumber/debit |
DELETE | Delete a bank account | api/v1/accounts/:acccountNumber |
DESCRIPTION | REQUIRED FIELDS |
---|---|
Sign Up | firstName, lastName, email, password |
Sign In | email, password |
Create bank account | firstName, lastName, email, type, password |
Credit account | cashier, amount |
Debit | cashier, amount |
Activate/deactivate | status |
Before getting started, make sure to configure the database as follows:
-
Download and install PostgreSQL using this link.
-
In the project's root directory, create a
.env
file and add the following variables:SECRET=your_secret_key_here
DB_URL=postgresql://username:password@host:port/database
whereyour_secret_key_here
refers to a custom secret key for the application (you can choose a secured key).username
- username of the currently logged in user on your local machine.password
- password of the currently logged in user on your local machine.host
- database hostname, default is127.0.0.1
.port
- database port, default is5432
. -
After successfully configuring the database, run the following commands to create the database:
$ psql CREATE DATABASE banka
$ npm run migration:create
Optionally, you can seed the database by running:
$ npm run migration:seed
To drop the tables, run:
$ npm run migration:drop
You will need to have POSTMAN app installed on your computer.
- Launch POSTMAN
- Click the dropdown menu to the left of the URL bar and select POST as a method.
- To access the Sign In endpoint, at the end of Banka's URL attach the sign in endpoint to it as seen in step 4
- https://surebanka.herokuapp.com/api/v1/auth/signin
- Then paste the full URL in the URL bar.
- Click 'Body' tab below the URL, then select x-www-form-urlencoded radio button.
- Fill in the required fields correctly.
- Click the blue Send button to the right of the URL bar.
- And wait for a response.
- On the terminal of your computer, navigate into the cloned repo's folder
- Make sure you have Node installed. If not click npm and Node.js to download npm and node.
- Clone the repo
https://github.com/Shegsdev/Banka.git
on your local machine. - Run
$ npm install
to install all dependencies. - Configure database (See
Database setup
above). - Run
$ npm run dev
to power up the server. - The procedure for using POSTMAN here is the same as when accessing the endpoint remotely except that you make use of http://localhost:5000 as the full URL's prefix in place of the app's URL on heroku e.g To access Sign In endpoint you will have a full URL like http://localhost:5000/api/v1/auth/signin
You can locally run the test by running
npm run dev
and in separate terminal window,
run npm test
.
You can follow me on Twitter