iMiebaka / LBE

Money wallet app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Demo Credit for Lendsqr Backend Engineer Assessment

Table of Contents

About 🏦

Demo Credit is a consumable API platform that lets you create a financial future. On Demo Credit you can: create an account with zero charges, transfer funds, and withdraw funds with zero delays. The platform comes with high-level security, to make sure your funds are πŸ’― percent secured.

Checkout API documentation

Tools βš’οΈ

The platform is heavily based on the following tools:

Getting Started 🏁

These instructions will guide you on how to get this project up and running.

Prerequisites

To run this project in development, you need node install This project was done using v16.13.1 but any other LTS should do. Run the code below to check if Node is installed. it will return the version of Node installed.

node --version
npm --version

Installing

To get the code running locally, you need to clone it from the repo.

For SSH

git clone git@github.com:iMiebaka/LBE.git

For HTTP

git clone https://github.com/iMiebaka/LBE.git

Now the code has been pulled to your local machine, You'll have to move inside the project directory and install the dependencies.

cd LTS
npm i

Environment Variable Setup

Now the dependencies are installed, it's time to set up environment variables Inside the project folder is a file called:

.env.example

That file contains the sample data required by this project The env variables required are: the secret key and database configuration

Secret key

This is private to the server. It should be a lengthy combination of alpha-numeric characters to secure the platform. This should not be disclosed ☠️

Database

The database will take in the host, username, port, password and database name

See folder structure for more insight

Database πŸ›’οΈ

The database used is MySQL. And here is the relationship diagram. database_relationship_image

The database contains the following tables and fields.

hot_wire_transaction table πŸ“‹

This table gets all pending transactions during transfer and withdrawal

statement table πŸ“‹

This table gives descriptive information about completed transaction

users table πŸ“‹

This table contains valuable details about the user. These details are added when the account is created. i.e first name, last name, email, password and pin (Default to 1234)

wallet table πŸ“‹

This table is automatically generates when a user signs up on the platform. Details include: account number, amount (Default to 0.0), user reference

NB: Knex generates two tables extra alias tables to help with data migrations knex_migrations knex_migrations_lock

Next, we need to migrate the tables to the database. Use the command below. Make sure you set NODE_ENV

npm run dev-migrate

NB: This script is for development

Testing πŸ§ͺ

This project testing is broken into two stages: One is to test database connection, and the other test the user activities. The first test checks if the database connection is established. This is important because without it data persistence cannot work. The second test does the following: creates two tests user account, log in, funds the wallet, withdraw amounts, and transfer funds. This test depends on the success of the first test. To see the test in action run the command below:

npm test

Starting the Server 🌐

If your test works fine, you can now run the command. To get the code running locally, run the following script.

npm run dev

Author πŸ‘¨β€πŸ’»οΈ

Miebaka Iwarri

About

Money wallet app


Languages

Language:TypeScript 99.4%Language:JavaScript 0.5%Language:Shell 0.1%