DefenceDB is a database-driven procurement and budget allocation system built with MySQL and a Flask web interface. It manages ministry officials, departments, vendors, products, procurement requests, approvals, and budget logs in one integrated workflow.
The objective of this project is to provide a structured platform for:
- managing defense procurement data centrally,
- tracking departmental budgets and spending,
- enforcing approval workflows and stock checks,
- generating analytical insights from operational data.
- Master Data Management
- Ministry officials
- Departments
- Vendors
- Products
- Procurement Workflow
- Create requests
- Approve / reject requests
- Cancel approved requests with budget/stock reversal
- Budget & Audit Tracking
- Real-time department budget updates
- Budget log entries for financial traceability
- Analytics & SQL Demonstrations
- Joins, aggregates, and nested subqueries
- Department KPIs, vendor performance, and high-value approvals
- CSV Export
- Export tabular outputs from major modules
- Backend: Python, Flask
- Database: MySQL
- Frontend: HTML + Bootstrap
- DB Logic: SQL DDL/DML, functions, procedures, triggers
Main entities in the schema:
MINISTRYDEPARTMENTVENDORPRODUCTPROCUREMENT_REQUESTBUDGET_LOG
DefenceDB/
├── DefenseDB-DDL.sql
├── DefenseDB-DML.sql
├── Triggers-Functions-Procedures-DefenseDB.sql
├── requirements.txt
├── flask_app/
│ ├── __init__.py
│ ├── app.py
│ ├── db.py
│ └── templates/
└── images/
- Python 3.10+ (recommended)
- MySQL Server 8+
- MySQL client (
mysql) available in terminal
pip install -r requirements.txtRun these from the repository root.
DefenseDB-DDL.sqldrops/recreatesdefense_db.
mysql -u <username> -p < DefenseDB-DDL.sql
mysql -u <username> -p < DefenseDB-DML.sql
mysql -u <username> -p < Triggers-Functions-Procedures-DefenseDB.sqlSet database connection variables before starting Flask:
export DB_HOST=localhost
export DB_PORT=3306
export DB_USER=<username>
export DB_PASSWORD=<password>
export DB_NAME=defense_db
export SECRET_KEY=change-meflask --app flask_app run --debugOr:
python -m flask --app flask_app run --debugVisit:
http://127.0.0.1:5000
Available modules:
/(Dashboard)/ministry/departments/vendors/products/requests/logs/analytics
DefenseDB-DDL.sql: schema creation and constraintsDefenseDB-DML.sql: sample data populationTriggers-Functions-Procedures-DefenseDB.sql: advanced DB logic and workflow support









