Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

61 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ’Š Drug Management System (DMS)

A full-stack web application for managing drug inventories, orders, and users across multiple roles β€” Admin, Institute, and Pharmacy. Built using React + Vite on the frontend and Node.js + Express on the backend, with PostgreSQL as the database.


πŸ“š Table of Contents


Features

  • Role-based Access: Admin, Institute, and Pharmacy with distinct dashboards and permissions.
  • Drug Inventory Management: Add, edit, and track drugs with batch, expiry, and stock details.
  • Order Management: Place, approve, and track orders between institutes and pharmacies.
  • Analytics Dashboards: Visualize inventory, orders, and user activity.
  • User Management: Register, edit, and manage institutes and pharmacies.
  • Authentication & Authorization: Secure login with protected routes.
  • Responsive UI: Clean and modern interface with mobile responsiveness.

Project Structure


DMS/
β”œβ”€β”€ client/             # Frontend (React + Vite)
β”‚   └── src/
β”‚       β”œβ”€β”€ components/       # Reusable components
β”‚       β”‚   └── pages/        # Dashboards for Admin, Institute, Pharmacy
β”‚       β”œβ”€β”€ context/          # User context, route protection
β”‚       β”œβ”€β”€ constants/        # Static drug data, enums
β”‚       └── utils/            # Helper functions
β”‚
β”œβ”€β”€ server/             # Backend (Node.js + Express)
β”‚   β”œβ”€β”€ controllers/         # Business logic
β”‚   β”œβ”€β”€ routes/              # API routes
β”‚   β”œβ”€β”€ models/              # DB Models
β”‚   └── middlewares/         # Auth, role checks
β”‚
β”œβ”€β”€ db/
β”‚   └── schema.sql       # PostgreSQL schema
β”‚
└── docker-compose.yml
 

Tech Stack

  • Frontend: React, Vite, TailwindCSS
  • Backend: Node.js, Express
  • Database: PostgreSQL
  • Containerization: Docker, Docker Compose

Database Schema

  • users: Stores all user types (admin, institute, pharmacy) with role, status, and contact info.
  • drugs: Drug inventory with type, batch, expiry, stock, and price.
  • orders: Main order records linking senders and recipients.
  • order_items: Drugs in each order with quantity, price, and status.

➑️ For full schema, check db/schema.sql


Setup & Installation

Prerequisites

  • Node.js (v16+)
  • npm
  • PostgreSQL
  • Docker (optional)

1. Clone the Repository


git clone https://github.com/shuvam773/DMS.git 
cd DMS

2. Install Dependencies


cd client
npm install

cd ../server
npm install

4. Environment Variables Create a .env file in the server/ directory with the following variables:

Set up your PostgreSQL database environment


PORT=8080 
JWT_SECRET=your_jwt_secret_here 

DB_HOST=localhost 
DB_USER=postgres 
DB_PORT=5432 
DB_PASSWORD=your_db_password_here 
DB_NAME=dms

OPENROUTER_API_KEY=your_openrouter_api_key

5. Download and install postgreSQL

Initialize Database Schema


psql -U "your_username" -d "your_db_name" -f db/schema.sql

Usage

Start Backend


cd server
npm run dev

Start Frontend


cd client
npm run dev

Development

  • Frontend: Work in client/src/components/pages/
  • Backend: Modify logic in server/controllers/ and routes in server/routes/
  • Database: Update db/schema.sql and models in server/models/

Docker Support

To run the full stack with Docker:


docker-compose up --build
 

This spins up:

  • Frontend
  • Backend
  • PostgreSQL database

All services are defined in docker-compose.yml.


Contributing

Contributions are welcome!
Feel free to open an issue or submit a pull request.


Contact

For questions or support, please open an issue on the GitHub repository.


About

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages