DFCU Loans API
This document describes how to set up and test run the outstanding loans API.
- To see and test how the API works, please visit the docs page after starting the application
Tech Stack
This API is built using the following languages and tools
- Backend: PHP >= 8.1 (Laravel Framework >= 10.2)
- Database: MySQL
- Package Managers: npm >= 6.14 with NodeJS >= 14.21, composer >= 2.0
- Frontend: Javascript & CSS (Tailwind CSS >= 3.1)
Setup and running the project
Tasks and the respective commands
- Clone the repository
git clone git@github.com:allandereal/dfcu-loans-api.git
- Move into the
dfcu-loans-api
directory
cd dfcu-loans-api
- Install composer dependencies
composer install
- Install javascript dependencies with
npm
npm install
- Copy the
.env
file from the.env.example file
cp .env.example .env
- Generate the application key
php artisan key generate
- Run migrations (update the database settings in the
.env
file first by setting the database, username and password)
php artisan migrate
- Seed the database if you want to generate test data
php artisan db:seed
- Start the development server at http://127.0.0.1:8000
php artisan serve
Running Tests
Copy .env.testing
file from .env
and update database parameters to the testing database
cp .env.example .env.testing
Run php artisan test
User Interfaces
http://127.0.0.1:8000/dashboard
1. API performance DashboardYou are required to be authenticated to view this dashboard.
You can use the following credentials generated by the php artisan db:seed
command
email: admin@api.dfcubank.com
, password: password
Test account numbers and their responses (this works after running `php artisan db:seed``)
1000000001 => Returns outstanding loans 1000000002 => Return no outstanding loan
http://127.0.0.1:8000/docs
2. API DocumentationTo test run the API, you will need an access token that can be generated on the admin dashboard
Simulating the API
A command that takes sample account numbers and runs them through the API endpoint.
A text file containing the API endpoint simulation results is saved in the public folder in the format
loans-api-simulation-*.txt
on completion.
Please use the command php artisan loan:simulate
to execute this.
Screenshots
Admin dashboard
API Docs
Developers
- Allan Ahumuza
Github: @allandereal
Email: ahullan@gmail.com