A full-stack web application for managing personal loans, installments, payments, banks, users, and notifications. The system provides separate user and administrator workflows through a React interface backed by a FastAPI REST API and PostgreSQL database.
- Register and sign in using a username or email
- View and update profile information
- Add and manage loans
- Track installment schedules and payment progress
- Record installment payments
- Manage predefined and custom banks
- Receive and review notifications
- View and manage users
- Promote or remove administrators
- Review loans across the system
- Add supported banks
- Create and manage user notifications
- Inspect loan installments and payment status
- React 18
- Vite
- React Router
- TanStack Query
- Axios
- React Bootstrap
- React Toastify
- Python
- FastAPI
- SQLAlchemy
- Pydantic
- PostgreSQL
- JWT authentication
- Passlib / bcrypt
- APScheduler
loan-system/
├── Backend/
│ ├── main.py # FastAPI application and API routes
│ ├── crud.py # Database operations and business logic
│ ├── models.py # SQLAlchemy models
│ ├── schemas.py # Pydantic request/response schemas
│ ├── database.py # PostgreSQL connection and sessions
│ ├── tokens.py # JWT creation and authentication
│ ├── hashing.py # Password hashing and verification
│ ├── email_sender.py # Email notification support
│ ├── Triggers_In_Database.txt # PostgreSQL trigger definitions
│ └── README.md # Backend-specific documentation
├── src/
│ ├── components/ # React pages and reusable UI components
│ ├── connections/ # API client
│ ├── contexts/ # React contexts
│ ├── functions/ # Utility functions
│ ├── hooks/ # Data-fetching hooks
│ └── routes/ # Application routing
├── public/
├── package.json
└── vite.config.js
The application is built around the following entities:
- User — account, identity, profile, and administrator status
- Loan — amount, interest rate, duration, bank, and payment progress
- Debt — an individual installment associated with a loan
- Bank — a system-wide supported bank
- Custom Bank — a user-defined bank
- Notification — user and administrator messages, optionally linked to an installment
When a loan is created, its installment schedule is generated automatically from the loan amount, interest rate, start date, and number of installments.
Install the following tools before running the project:
- Node.js 18 or later
- npm
- Python 3.10 or later
- PostgreSQL
git clone https://github.com/Uranus313/loan-system.git
cd loan-systemCreate a PostgreSQL database:
CREATE DATABASE loan_system;The current project reads the database connection from Backend/database.py. Update SQLALCHEMY_DATABASE_URL for your local PostgreSQL credentials.
For a safer production-ready setup, move the database URL to an environment variable instead of committing credentials to source control.
Create Backend/config.env based on the following template:
SECRET_KEY=replace_with_a_secure_random_secret
ALGORITHM=HS256
ACCESS_TOKEN_EXPIRE_MINUTES=30
Email_Password=replace_with_email_app_passwordDo not commit real secrets or credentials.
From the Backend directory, create and activate a virtual environment:
cd Backend
python -m venv .venvOn Windows:
.venv\Scripts\activateOn macOS or Linux:
source .venv/bin/activateInstall the backend dependencies:
pip install -r Backend/requirements.txtAfter the tables have been created, execute the SQL statements in:
Backend/Triggers_In_Database.txt
These triggers preserve related data integrity when users or loans are deleted.
From the Backend directory:
uvicorn main:app --reloadThe API will be available at:
http://127.0.0.1:8000
Interactive API documentation:
http://127.0.0.1:8000/docs
Open a second terminal from the repository root:
npm install
npm run devThe Vite development server will display the frontend URL in the terminal, typically:
http://localhost:5173
The frontend API client currently expects the backend at http://127.0.0.1:8000/.
The backend exposes authenticated user and administrator endpoints.
POST /user/loginPOST /user/GET /user/PUT /user/DELETE /user/
GET /user/loansPOST /user/loansPUT /user/loansDELETE /user/loans/{loan_id}GET /user/debts/{debt_id}PUT /user/debts
GET /user/banksPOST /user/banksDELETE /user/banksGET /user/notificationsPOST /user/notificationsPUT /user/notifications
- User and administrator management
- System-wide loan inspection
- Bank management
- Notification management
- Installment inspection
For the complete request schemas and endpoint details, run the backend and open /docs.
The API uses bearer-token authentication:
- A user signs in through
POST /user/login. - The server issues a JWT access token.
- The frontend stores the token and sends it in subsequent requests:
Authorization: Bearer <access-token>Passwords are hashed with bcrypt before being stored.
npm run dev # Start the Vite development server
npm run build # Create a production build
npm run lint # Run ESLint
npm run preview # Preview the production build locallyuvicorn main:app --reloadThis repository is an academic team project. It contains the main user, loan, installment, bank, notification, and administrator workflows. Additional testing, migrations, deployment configuration, and security hardening are recommended before production use.