1. What the Client Wants
This is not a normal WordPress site or a simple CRUD dashboard. It is a custom full-stack web application.
Track a medicine through its supply chain
The platform should keep a centralized record of a medicine from approved drug type and manufacturer licensing through medicine creation, pharmacy transfer, and final sale to a citizen. A citizen should be able to verify a medicine using its unique UUID.
One medicine, one identity
Every MedicineUnit gets a unique RFC 4122 v4 UUID and a record of ownership and transfers.
2. Users and Roles
Regulator / Super Admin
- Register drug types.
- Register manufacturers and pharmacies.
- Issue production licenses.
- Revoke licenses.
- Extend licenses.
- View and manage system records.
Medicine Producer
- View valid licenses.
- Create MedicineUnits only under a valid license.
- Receive a unique UUID for each unit.
- Transfer medicine units to registered pharmacies.
- View relevant medicine and transfer history.
Medicine Receiver / Seller
- Receive medicine from manufacturers.
- View medicines currently owned by the pharmacy.
- Transfer or sell a medicine to the final customer.
- View transfer history for relevant units.
Public Verification User
- No login required for verification.
- Enter a medicine UUID.
- See medicine identity, manufacturer, status, expiry, current owner, and sanitized provenance information.
- Read-only access.
3. Core Features
Drug Type Management
- Create and manage drug types.
- Store core drug information.
- Connect licenses to drug types.
Participant Management
- Register manufacturers.
- Register pharmacies.
- Maintain unique participant identities.
License Management
- Issue licenses.
- Revoke licenses.
- Extend license expiry dates.
- Track who issued the license.
Medicine Unit Creation
- Validate manufacturer authorization.
- Validate license status and expiry.
- Validate drug-license relationship.
- Generate a unique UUID.
Ownership Transfer
- Manufacturer → Pharmacy.
- Pharmacy → Citizen / final customer.
- Store every transfer as a historical event.
- Enforce current-owner rules.
Medicine Verification
- Public UUID search.
- Return medicine details.
- Show current status and expiry.
- Show sanitized transfer history.
Authentication & RBAC
- Secure user login.
- JWT-based authorization.
- Government, Manufacturer, and Pharmacy permissions.
- Ownership enforcement at API level.
Audit Trail
- Track important system events.
- Keep transfer records with timestamps.
- Make provenance traceable.
Performance Targets
- About 5,000 writes per day.
- Peak target around 2–5 requests/sec.
- Read API P95 < 3 sec.
- Write API P95 < 5 sec.
- Public verification P95 < 3 sec.
- Dashboard load P95 < 2 sec.
4. End-to-End Business Workflow
Example: Paracetamol 500mg
- Government registers Paracetamol 500mg as a DrugType.
- ABC Pharma is registered as a Manufacturer.
- Government issues ABC Pharma a valid production license for this drug.
- ABC Pharma creates a new MedicineUnit.
- The system generates a unique UUID for that unit.
- ABC Pharma transfers the unit to XYZ Pharmacy.
- The transfer is saved as a TransferRecord.
- XYZ Pharmacy becomes the current owner.
- XYZ Pharmacy sells/transfers the medicine to the final customer.
- A Citizen enters the UUID on the public verification page.
- The system returns the medicine identity, status, expiry, current owner and sanitized provenance history.
5. Key Business Rules
Medicine Creation Rules
- The manufacturer must be registered.
- The manufacturer must have a valid license.
- The license must not be revoked.
- The license must not be expired.
- The license must belong to the requested drug type.
- The medicine UUID must be unique.
Ownership Transfer Rules
- The caller must be the current owner.
- The medicine must be in a transferable state.
- The destination must meet the applicable participant rules.
- Every successful transfer creates a historical record.
- The current owner must update atomically with the transfer record.
License Status
A license can be Valid or Revoked, with issue and expiry dates.
Medicine Status
Expected statuses include Active Sold Expired Recalled
6. Proposed System Architecture
A clean three-tier application structure with a separate public verification flow.
7. Proposed Technology Stack
| Layer | Technology | Purpose |
|---|---|---|
| Frontend | React + TypeScript |
Government, Manufacturer, Pharmacy dashboards and public verification UI. |
| UI | CSS / UI component library |
Responsive admin dashboards, forms, tables, filters, alerts and public verification screens. |
| Backend | Node.js + TypeScript |
REST API, business rules, authentication, authorization, validation and audit logic. |
| API | REST API |
Core operations such as CreateDrugType, IssueLicense, RevokeLicense, ProlongLicense, CreateMedicineUnit, TransferOwnership and VerifyUnit. |
| Database | MySQL |
Central source of truth for participants, drugs, licenses, medicine units and transfer records. |
| Authentication | JWT-based auth |
Secure login and API authorization. |
| Authorization | RBAC |
Role-based permissions for Government, Manufacturer and Pharmacy. |
| Container | Docker |
Consistent local development and deployment environment. |
| Source Control | Git + GitHub |
Version control, collaboration, code review and project history. |
| Frontend Hosting | Vercel |
Simple deployment for the React frontend and staging environments. |
| Backend / Cloud | DigitalOcean |
Run the Node.js API and production application infrastructure. |
| Database Hosting | DigitalOcean Managed MySQL |
Managed relational database for production use. |
8. Proposed MySQL Data Model
The exact column design can be refined during technical specification, but these are the core relational entities.
| Table | What it stores | Important relationships |
|---|---|---|
participants |
Government, manufacturers, pharmacies and other participant identities. | Referenced by licenses and ownership/transfer records. |
drug_types |
Registered medicine/drug types. | Referenced by licenses and medicine units. |
licenses |
Manufacturer production licenses, status and dates. | Linked to a manufacturer and drug type. |
medicine_units |
Individual medicine package/unit records. | Linked to drug type, manufacturer/license and current owner. |
transfer_records |
Every ownership change with source, destination and timestamp. | Linked to a medicine unit and participants. |
Core relationship
DrugType → License → Manufacturer → MedicineUnit → CurrentOwner → TransferRecords
9. Core REST API
Government APIs
CreateDrugTypeIssueLicenseRevokeLicenseProlongLicense- Participant management endpoints.
Supply Chain APIs
CreateMedicineUnitTransferOwnership- Medicine detail and history endpoints.
- Ownership validation endpoints.
Public API
VerifyUnit- No login required.
- Read-only response.
- Sanitized provenance information.
- Rate limiting required.
10. Security Requirements
Transport Security
- HTTPS / TLS 1.2+.
- Secure cookies or token handling where applicable.
Authentication
- Password hashing.
- JWT authentication.
- Secure session/token handling.
Authorization
- API-level RBAC.
- Resource ownership checks.
- Protected government operations.
Abuse Protection
- Public verification rate limiting.
- Input validation.
- Request logging and monitoring.
Secrets
- Database credentials must not be committed to GitHub.
- Environment variables / managed secret storage.
Backups & Logs
- Database backups.
- Audit logs.
- Application error logs.
- Monitoring and alerts.
11. MVP Scope vs Phase 2
Build Now
- Government module.
- Manufacturer module.
- Pharmacy module.
- Drug type registration.
- Participant registration.
- License issue/revoke/extend.
- Medicine unit creation and UUID generation.
- Ownership transfer.
- Transfer history.
- Public medicine verification.
- Authentication and RBAC.
- Audit trail.
- Security and performance testing.
Not in Current MVP
- Doctor accounts.
- Electronic prescriptions.
- Prescription balance tracking.
- IoT temperature monitoring.
- GPS tracking.
- SAP / ERP integrations.
- Warehouse management integrations.
- Native Android/iOS apps.
- Multi-country regulatory workflows.
12. Recommended Development Steps
Lock the Requirements
Confirm unclear business rules, especially citizen ownership, expiry behavior, recall behavior, physical medicine identification, and regulatory expectations.
Project Setup
Set up GitHub, React, Node.js, TypeScript, MySQL, Docker, environment configuration and development standards.
Database
Design the MySQL schema, relationships, indexes, migrations, constraints and seed data.
Authentication & RBAC
Build secure login and API-level permissions for Government, Manufacturer and Pharmacy.
Core APIs
Implement drug, license, medicine unit, transfer and public verification operations.
Business Rules
Enforce license validation, current-owner checks, expiry rules, state transitions and audit records.
Dashboards
Build Government, Manufacturer and Pharmacy interfaces with tables, forms, filters and details pages.
Public Verification
Build the no-login UUID verification page and ensure the response exposes only allowed information.
Testing
Unit tests, API tests, role-permission tests, ownership tests, invalid-license tests and end-to-end flows.
Staging
Deploy frontend to Vercel and backend/database to the chosen staging environment. Run client demo and UAT.
Security & Performance
Test rate limiting, authentication, authorization, logs, backups, database integrity and performance targets.
Production Deployment
Move to the client-approved production infrastructure, configure HTTPS, monitoring, backups and release procedures.
13. Important Questions to Confirm with the Client
- Citizen ownership: Is the final citizen represented as a registered participant, or should the final sale be stored differently?
- Recall: How should a medicine become
recalled? The status exists, but the core API list does not clearly define a recall operation. - Expiry: Should medicine status automatically change to
expiredafter the expiry date, or should it be calculated at verification time? - Physical identity: Will the medicine UUID be printed as a plain code, QR code, barcode, or another identifier on the package?
- Regulatory scope: Is this a general supply-chain platform, or must the MVP meet specific US pharmaceutical/FDA/DSCSA compliance requirements?
- UI/UX: Does the client have wireframes/designs, or is the development team expected to design the dashboards and public verification screens?
- Deployment: Does the client require AWS/Azure, or will they approve DigitalOcean for the MVP/production environment?
14. What This Project Really Is
This project is best understood as a custom medical supply-chain management web application, not as a traditional website. Its main job is to control who can register drugs, issue or manage licenses, create medicine units, transfer ownership, preserve the chain of custody, and let the public verify a medicine by UUID.