Final year university research project that combines gold price forecasting with a complete pawn shop operations platform.
This repository is a full submission archive: application source code, database exports, notebooks, proposal files, analysis sheets, and supporting research materials are all included.
This project was designed to solve two connected business problems:
- predicting gold market movement from historical price data,
- and using those insights inside a real operational system for pawn shop management.
Instead of stopping at a notebook-only forecasting experiment, the research was implemented as a working full-stack platform. The final system integrates:
- a React + Vite frontend for the user interface,
- a Node.js + Express backend for business operations and authentication,
- a Flask prediction API serving a serialized Prophet model,
- and a MySQL database for customer, pawn item, interest, exchange-rate, cashbook, and chart data.
The result is a hybrid decision-support and transaction-management system where staff can estimate pawn values, issue loans, track active and redeemed items, record interest payments, maintain a cashbook, and visualize actual vs predicted gold prices in one workflow.
- Forecast future gold prices from historical daily USD-denominated market data.
- Convert forecast output into practical valuation support for pawning decisions.
- Reduce manual errors in customer management, loan issuance, interest tracking, and cashbook operations.
- Create a single platform that links research intelligence and business execution.
- Forecast-driven decision support with 3-month, 6-month, and 12-month gold price prediction views.
- Full pawn item lifecycle management covering active, redeemed, and expired states.
- Customer registration and retrieval with JWT-protected operations.
- Automated interest workflow that updates balances, extends due dates, and records payments.
- Cashbook tracking for debit and credit transactions.
- USD/LKR support using exchange-rate synchronization.
- Actual vs predicted visualization through dashboard charts backed by MySQL.
- Daily cron automation for expired item updates, FX synchronization, and predicted value insertion.
- Archive-complete research repo including notebooks, proposal files, Excel analysis, plots, and SQL exports.
flowchart LR
U[User / Staff] --> F[React + Vite Frontend]
F -->|JWT-secured REST| N[Node.js + Express API]
F -->|Prediction requests| P[Flask API + Prophet Model]
F -->|Market / FX lookups| X[External Gold and Exchange APIs]
N --> D[(MySQL: pawn_testdb)]
N --> C[Daily Cron Jobs]
C -->|mark expired items| D
C -->|update balances| D
C -->|store daily prediction| P
C -->|sync USD/LKR rate| X
P -->|forecast output| D
D -->|chart, customer, pawn, interest, cashbook data| F
- A dedicated Flask API in
FullProject/Python_APIloadsprophet_model.pkl. - The
/predictendpoint accepts a target date and returns a forecastedyhatvalue. - The dashboard requests future dates for:
- 3 months
- 6 months
- 12 months
- Predicted values are also inserted into MySQL by the Node cron workflow for continuity in the operational dataset.
- User sign-up and login with JWT authentication.
- Customer creation, lookup, and update workflows.
- Pawn item creation with:
- customer linkage,
- item details,
- karat/cartage,
- weight,
- actual price,
- loan price,
- due date generation,
- and automatic initial cashbook debit.
- Interest payment recording with balance updates and redemption handling.
- Dashboard and operational views for monitoring records and trends.
The backend cron process in FullProject/back_end/cornjobs/cornjobs.js performs daily background tasks:
- marks pawn items as Expired when due dates pass,
- inserts the latest USD to LKR exchange rate into the database,
- requests the day forecast from the Flask API and stores it in
GoldDataset, - updates
NeedPayAmountvalues and related interest balances.
This repository contains both the deployed inference path and the supporting research experiments.
- Model used in runtime: Prophet
- Serving method: Flask API
- Serialized model file:
FullProject/Python_API/prophet_model.pkl
Repository-backed notebook and SQL data show:
- 1,191 daily records
- date range:
2020-01-01to2024-07-31 - target variable: gold price in USD
The database also contains:
golddatasetfor historical and appended predicted valuespredicteddatafor paired actual vs predicted chart data
FullProject/ColabNoteBook/prophet.ipynbFullProject/ColabNoteBook/GoldXGBOOST.ipynbOtherThings/Project_G/pythonProject/prophet.pyOtherThings/Project_G/pythonProject/LSTM_model.pyOtherThings/Project_G/pythonProject/random_forest.pyOtherThings/Project_G/pythonProject/l_model.pyOtherThings/Project_G/pythonProject/cluster.py
The archived XGBoost notebook records:
- RMSE:
228.05 - MAE:
163.85
That notebook is part of the research comparison workflow. The live application, however, is wired to the Prophet model through the Flask API.
- A user creates an account and signs in through the web interface.
- Customer information is registered or retrieved using a customer ID.
- Staff estimate pawn value using live market context, item weight, karat level, and loan period.
- A pawn item record is created with an automatically calculated due date and an initial cashbook debit.
- Interest payments can be recorded against a pawn item.
- The system updates the remaining balance, due date, redemption state, and cashbook credit.
- Dashboard views present exchange rates, forecast cards, actual vs predicted charts, and financial activity.
- Scheduled backend jobs keep expiration status, exchange-rate data, and predicted price data moving forward daily.
| Layer | Implementation |
|---|---|
| Frontend | React 18, Vite, Tailwind CSS, DaisyUI, ApexCharts, Framer Motion |
| Backend API | Node.js, Express, bcrypt, JWT, MySQL2, CORS, body-parser |
| ML / Forecasting API | Flask, pandas, numpy, Prophet, scikit-learn |
| Database | MySQL |
| Auth | JWT Bearer token verification middleware |
| Automation | node-cron |
| Research Assets | Colab/Jupyter notebooks, Python experiments, Excel sheets, PDFs, plots |
The main domain database is pawn_testdb.
| Table | Purpose |
|---|---|
users |
application users and authentication-linked identity records |
customers |
pawn shop customer master data |
pawnitems |
pawned item records, status, loan values, due dates, cartage, balances |
interest |
interest payments, balances, and payment history |
cashbook |
operational debit and credit transaction logging |
golddataset |
historical and appended predicted gold prices |
predicteddata |
actual vs predicted series used by charts |
usdRate |
latest USD to LKR exchange-rate storage |
Fastest reproducibility options:
- complete dump:
FullProject/back_end/Dump20250214.sql - individual table exports:
FullProject/Database
GOLD_PRICE_PREDICT-SYSTEM/
├── README.md
├── FullProject/
│ ├── front_end/ # React + Vite web application
│ ├── back_end/ # Node.js + Express business API
│ │ ├── controller/
│ │ ├── route/
│ │ ├── middleware/
│ │ ├── cornjobs/
│ │ └── Dump20250214.sql
│ ├── Python_API/ # Flask prediction API + Prophet model
│ │ ├── main.py
│ │ ├── prophet_model.pkl
│ │ └── requirements.txt
│ ├── Database/ # Individual MySQL table exports
│ └── ColabNoteBook/ # Research notebooks
├── OtherThings/ # Proposal docs, analysis files, plots, prototype experiments
│ ├── Project_G/pythonProject/
│ ├── Project Analize Data/
│ └── other_files/
| Method | Endpoint | Purpose |
|---|---|---|
POST |
/api/v1/user/signup |
register user |
POST |
/api/v1/user/login |
authenticate and issue JWT |
GET |
/api/v1/user/get-user |
get current authenticated user |
POST |
/api/v1/customer/create-customer |
create customer |
GET |
/api/v1/customer/find-by-id-customer/:CustomerID |
fetch customer by ID |
PUT |
/api/v1/customer/update-by-id-customer/:customerId |
update customer |
POST |
/api/v1/pawn/create-pawn-item |
create pawn record |
GET |
/api/v1/pawn/get-all-pawn-item |
list pawn items with customer join |
GET |
/api/v1/pawn/get-pawn-item-by-id/:pawnItemId |
fetch one pawn item |
POST |
/api/v1/interest/save-interest |
save interest payment and update balance |
GET |
/api/v1/interest/get-interest |
list interest records |
POST |
/api/v1/cashbook/create-cashbook |
add manual cashbook record |
GET |
/api/v1/cashbook/get-all-cashbook |
list cashbook entries |
GET |
/api/v1/chart/get-chart-data |
return actual vs predicted chart series |
GET |
/api/v1/exchange/rate |
return latest USD/LKR rate |
| Method | Endpoint | Purpose |
|---|---|---|
POST |
/predict |
return Prophet forecast for the requested date |
- Node.js and npm
- Python 3
- MySQL
Create the database:
CREATE DATABASE pawn_testdb;Then import either the full dump or the individual tables.
mysql -u root -p pawn_testdb < FullProject/back_end/Dump20250214.sqlUse the SQL files inside FullProject/Database if you prefer table-by-table restoration.
Create a .env file inside FullProject/back_end:
PORT=3000
DB_HOST=localhost
DB_USER=root
DB_PASSWORD=your_mysql_password
DB_NAME=pawn_testdb
JWT_SECRET=replace_with_a_secure_secretcd FullProject/Python_API
pip install -r requirements.txt
python main.pyDefault runtime:
- Flask API:
http://127.0.0.1:5000
cd FullProject/back_end
npm install
npm run devExpected runtime:
- Node API:
http://localhost:3000
Keep this process running if you want the built-in daily cron automation to execute.
cd FullProject/front_end
npm install
npm run devDefault Vite runtime:
- Frontend:
http://localhost:5173
The current frontend is hardwired to:
http://localhost:3000/api/v1/for the Node backendhttp://127.0.0.1:5000/predictfor the Flask forecasting API
So for the project to run without refactoring, keep:
- Node on port
3000 - Flask on port
5000
If you change ports or hosts, update:
FullProject/front_end/src/config/api.jsx- the frontend components that call Flask or backend endpoints directly
This repository contains more than just runtime code. It includes the wider academic workflow:
- Colab notebooks for Prophet and XGBoost model experimentation
- Python prototype scripts for additional forecasting / analytical approaches
- SQL exports for reproducible database setup
- Excel and PDF analysis files for research interpretation
- proposal documents and supporting submission materials
- plot images and screenshots documenting output and experimentation
That makes this repository suitable not only for source review, but also for:
- project demonstration,
- viva / presentation support,
- academic evidence tracking,
- and future extension work.
This project is strong as a research-backed prototype and academic system integration exercise. It already demonstrates:
- real model deployment instead of offline-only analysis,
- business process automation,
- dashboard reporting,
- and practical database-driven operations.
For production hardening, the main next steps would be:
- move third-party API keys and service URLs fully into environment variables,
- centralize all frontend HTTP configuration instead of mixing direct URLs across components,
- add formal automated tests,
- refine cron-based financial update rules,
- and improve error handling and validation around operational finance flows.
- It does not treat prediction as an isolated ML experiment.
- It embeds forecasting into an actual business workflow.
- It preserves the complete research trail from proposal to prototype to operational platform.
- It earned an academic evaluation of 82/100, reflecting both technical implementation and research quality.
The Gold Market Price Prediction System + Pawning Shop Management System is a complete final-year research implementation that bridges machine learning, financial operations, and full-stack software engineering. It demonstrates how predictive analytics can be turned into a usable operational product for real decision-making, not just a standalone experiment.