Skip to content

Laurowd/Loan-Management-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LoanFlow - Loan Management API

STILL IN DEVELOPMENT!

LoanFlow is a full stack mini fintech MVP for loan simulation, hybrid approval, installment tracking, fake payments, and admin review. It started as a small Fastify API and evolved into a portfolio-ready project with a Vue.js frontend.

LoanFlow login preview

Stack

  • Fastify + TypeScript
  • PostgreSQL with postgres.js
  • JWT authentication
  • bcrypt password hashing
  • Vue 3 + Vite + Vue Router
  • Pinia
  • Axios

Features

  • User registration with income, CPF, credit score, and role.
  • Login with JWT and role-aware navigation.
  • Loan simulation with fixed 5% demo interest.
  • Hybrid approval rule:
    • amount up to R$ 5,000;
    • credit score of at least 650;
    • installment value up to 30% of monthly income.
  • Automatic approval or manual review queue.
  • User dashboard, loan list, loan details, and installment table.
  • Fake installment payment flow for demos.
  • Admin dashboard with pending, approved, rejected, and high-risk metrics.
  • Admin approve/reject flow with rejection reason.

Project Structure

.
├── src/                 # Fastify API
├── web/                 # Vue 3 frontend
├── docs/screenshots/    # Real UI previews
└── docs/superpowers/    # Product spec and implementation plan

Backend Setup

Create an environment file:

cp .env.example .env

Install dependencies and prepare the database:

npm install
npm run db:create
npm run dev

The API runs on http://localhost:3333 by default.

For hosted PostgreSQL providers that require SSL, set:

DATABASE_SSL=true

Frontend Setup

cd web
npm install
npm run dev

The frontend uses http://localhost:3333 as the default API URL. To override it:

VITE_API_URL=http://localhost:3333

Windows note: if npm install reports EBADF or EPERM inside a cloud-synced folder, clone the repository into a normal local folder such as C:\Dev\LoanFlow and run the install there.

Useful Scripts

Backend:

npm run dev
npm run build
npm test
npm run db:create

Frontend:

cd web
npm run dev
npm run build
npm run preview

API Routes

Method Route Description
GET / Health check
POST /users Register user/admin
POST /auth/login Login and receive JWT
GET /me Authenticated profile
POST /loans/simulate Simulate loan terms and decision
POST /loans Request a loan
GET /loans/my List authenticated user loans
GET /loans/:id Loan details and installments
POST /installments/:id/pay Fake installment payment
GET /admin/loans Admin loan queue
GET /admin/loans/:id Admin loan details
PATCH /admin/loans/:id/approve Approve pending loan
PATCH /admin/loans/:id/reject Reject pending loan

Frontend Routes

Route Description
/login Login
/register User/admin registration
/app User dashboard
/app/simulate Loan simulation
/app/loans User loan list
/app/loans/:id User loan details
/admin Admin dashboard
/admin/loans Admin review queue
/admin/loans/:id Admin review screen

Demo Flow

  1. Start PostgreSQL and configure .env.
  2. Run npm run db:create to reset the development schema.
  3. Create a user from the frontend register screen.
  4. Simulate a loan below the automatic approval threshold.
  5. Create another loan that exceeds the policy limits.
  6. Create or use an admin account and review the pending proposal.
  7. Open the approved loan details and trigger fake installment payments.

Status

MVP in development, built as a portfolio project to demonstrate backend architecture, authentication, business rules, and a Vue-based product interface.

About

Mini fintech full stack for loan simulation, hybrid approval, installment tracking, and admin review built with Fastify, PostgreSQL, Vue 3, and TypeScript.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors