Skip to content

Fizza-Mukhtar/PharmaSentinel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ’Š PharmaSentinel

Blockchain-Based Pharmaceutical Supply Chain Management System

Python Django React PostgreSQL JWT Bootstrap


πŸ“Œ About The Project

PharmaSentinel is a secure, blockchain-based web application designed to detect and prevent counterfeit medicines in the pharmaceutical supply chain.

Fake and substandard medicines pose a serious global health risk. Traditional supply chain systems rely on centralized databases that can be easily manipulated. PharmaSentinel solves this by assigning each medicine batch its own private blockchain, where every transaction is permanently recorded using SHA-256 hashing and HMAC digital signatures β€” making all data tamper-proof and fully traceable.


✨ Key Features

  • πŸ” JWT-Based Role Authentication β€” Secure login for 6 roles: Manufacturer, Distributor, Wholesaler, Shopkeeper, Consumer, and Regulatory Authority
  • ⛓️ Custom Private Blockchain β€” Each medicine batch has its own blockchain with hash chaining and digital signatures
  • πŸ“¦ End-to-End Medicine Tracking β€” Full lifecycle traceability from manufacturer to consumer
  • πŸ” Counterfeit Detection β€” Automatic blockchain validation to detect tampering and duplicate transactions
  • πŸ“± QR Code / Batch ID Verification β€” Consumers can verify medicine authenticity without login
  • πŸ›οΈ Regulatory Admin Dashboard β€” Central control panel for monitoring supply chain compliance
  • πŸ“Š Logging & Monitoring β€” System activity tracking using Python's logging module

πŸ› οΈ Tech Stack

Layer Technology
Backend Python, Django, Django REST Framework
Frontend React JS, Bootstrap
Database PostgreSQL
Authentication JWT (JSON Web Tokens)
Blockchain Custom Private Blockchain Implementation
Cryptography SHA-256 Hashing, HMAC Digital Signatures
Monitoring Python Logging Module

πŸ—οΈ System Architecture

Consumer / Stakeholder
        ↓
   React JS Frontend
        ↓
Django REST Framework (APIs)
        ↓
   JWT Authentication
        ↓
  Business Logic Layer
     ↙          β†˜
PostgreSQL    Custom Blockchain
(User/Batch    (Transaction
   Data)         Records)

πŸ‘₯ User Roles

Role Permissions
Regulatory Authority Full system access, user management, compliance monitoring
Manufacturer Create medicine batches, initiate blockchain
Distributor Receive and transfer medicine batches
Wholesaler Receive and forward medicine batches
Shopkeeper Receive medicines, mark as sold
Consumer Verify medicine authenticity via Batch ID or QR Code

⛓️ How The Blockchain Works

Each medicine batch gets its own blockchain where every transaction is stored as a block:

Block Structure:
{
  "block_index"     : 1,
  "timestamp"       : "2025-01-01 10:00:00",
  "transaction_data": { batch_id, action, actor, location },
  "previous_hash"   : "abc123...",
  "hash"            : "def456...",
  "digital_signature": "hmac_signature"
}
  • SHA-256 generates a unique hash for every block
  • HMAC digital signatures verify data integrity
  • Any tampering breaks the hash chain and is immediately detected

πŸš€ Getting Started

Prerequisites

  • Python 3.8+
  • Node.js & npm
  • PostgreSQL

Installation

1. Clone the repository

git clone https://github.com/Fizza-Mukhtar/PharmaSentinel.git
cd PharmaSentinel

2. Backend Setup

cd backend
pip install -r requirements.txt

3. Configure Database

Create a .env file in the backend folder:

DATABASE_NAME=pharmasentinel
DATABASE_USER=your_db_user
DATABASE_PASSWORD=your_db_password
DATABASE_HOST=localhost
DATABASE_PORT=5432
SECRET_KEY=your_django_secret_key

4. Run Migrations

python manage.py makemigrations
python manage.py migrate

5. Start Backend Server

python manage.py runserver

6. Frontend Setup

cd frontend
npm install
npm start

The app will be running at http://localhost:3000


πŸ“ Project Structure

PharmaSentinel/
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ authentication/       # JWT auth & user roles
β”‚   β”œβ”€β”€ blockchain/           # Custom blockchain logic
β”‚   β”œβ”€β”€ medicines/            # Medicine batch management
β”‚   β”œβ”€β”€ supply_chain/         # Transfer & tracking APIs
β”‚   β”œβ”€β”€ dashboard/            # Regulatory admin panel
β”‚   └── manage.py
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/       # React components
β”‚   β”‚   β”œβ”€β”€ pages/            # Role-based pages
β”‚   β”‚   └── App.js
β”‚   └── package.json
└── README.md

πŸ”’ Security Features

  • All passwords are hashed using Django's built-in security
  • JWT tokens expire automatically for session safety
  • Blockchain hash chaining detects any data tampering
  • HMAC signatures verify block integrity
  • Role-based access ensures users can only perform authorized actions

πŸ“Έ Screenshots

1 5 drap

🎯 Future Enhancements

  • Integration with public blockchain (Ethereum)
  • AI-based anomaly detection in supply chain
  • SMS/Email alerts for suspicious activity
  • Multi-language support

πŸ‘©β€πŸ’» Author

Fizza Mukhtar
LinkedIn GitHub


πŸ“„ License

This project is for academic purposes.


"Ensuring every medicine that reaches a patient is genuine β€” because health cannot be compromised."

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors