Loan App Game

The APP

  • Frontend: No frontend
  • Backend: http://localhost:80/api
  • Database
    • Hostname: mysql
    • Port: 3306
    • Username: root
    • Password:
    • Database: loan_app

Default tech stack

  • PHP 8.1.4
  • Laravel Framework 9.19.0
  • MySQL 8.0

My Tech Stack

  • PHPStorm
  • MySql
  • Laravel
  • Some spatie packages

Instructions to run the app

  • Composer install
  • Copy the .env.example to .env and fill the values
  • php artisan key:generate && php artisan migrate:fresh --seed
  • Use the postman collection to test the api

Clone the project

git clone https://github.com/nitinkaware/loan-app

Go to the project directory

cd loan-app

Install dependencies

composer install

Start the server with Sail - (make sure you have docker installed) OR Laravel Valet (Valet Preferences)

Run tests

php artisan test

Run migrations and seed the database

php artisan migrate:fresh --seed

API Reference

Register a user

POST /api/register
Parameter Type Description
email string Required.
name string Required.
password string Required and must match with password_confirmation
password_confirmation string Required

Login

This api is same for both users and admins.

POST /api/login
Parameter Type Description
email string Required
password string Required
device_name string Required

Request a new loan [AUTH REQUIRED]

POST /api/loan-requests
Parameter Type Description
amount_required float Required
terms_in_week integer Required

Approve a loan [ADMIN AUTH REQUIRED]

No request payload required.

POST /api/loan-requests/approve/{loan}

Make a repayment [AUTH REQUIRED]

POST /api/loan-repayments/repayment/{repayment}
Parameter Type Description
amount_paid float Required

View all my all loans [AUTH REQUIRED]

GET /api/loans
Parameter Type Description
cursor string Optional