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.
The platform is heavily based on the following tools:
These instructions will guide you on how to get this project up and running.
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
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
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
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 β οΈ
The database will take in the host, username, port, password and database name
See folder structure for more insight
The database used is MySQL. And here is the relationship diagram.
The database contains the following tables and fields.
This table gets all pending transactions during transfer and withdrawal
This table gives descriptive information about completed transaction
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)
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
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
If your test works fine, you can now run the command. To get the code running locally, run the following script.
npm run dev