- Live Frontend (Both are same):
- https://pharmacy.punit-chau20.workers.dev/ (CloudFlare)
- https://pharmacy-punit.netlify.app/ (Netlify)
- Backend: https://pharmacy-fastapi-backend.onrender.com/
- Screenshots (As of 05 March 2026)
The APIs are mainly classified into two categories: Inventory and Dashboard.
| Method | Endpoint | Description |
|---|---|---|
| GET | /inventory/overview | Inventory Overview |
| GET | /inventory/ | List Medicines |
| POST | /inventory/ | Add Medicine |
| PUT | /inventory/{medicine_id} | Update Medicine |
| Method | Endpoint | Description |
|---|---|---|
| POST | /dashboard/make-sale | Make Sale |
| GET | /dashboard/total-sales | Get Sales Summary |
| GET | /dashboard/items-sold | Get Items Sold |
| GET | /dashboard/recent-sales | Get Recent Sales |
| GET | /dashboard/low-stock | Get Low Stock |
| GET | /dashboard/purchase-orders | Get Purchase Orders |
Pharmacy-SwasthiQ/ │ ├── backend/ ├── frontend/ ├── LICENSE └── README.md
The backend is implemented using FastAPI for REST API development, SQLAlchemy for ORM-based database interaction, Pydantic for validation, and PostgreSQL as the database. The database URL is configured using environment variables for deployment.
Swagger UI for testing: https://pharmacy-fastapi-backend.onrender.com/docsbackend/
│
├── main.py
├── database.py
├── models.py
├── schemas.py
├── crud.py
├── requirements.txt
├── generate_inventory.sh
│
└── routers/
├── dashboard.py
└── inventory.py
- main.py – Entry point of the FastAPI application. Initializes the app and includes API routers.
- database.py – Handles database connection setup using SQLAlchemy with environment variable configuration.
- models.py – Defines database tables and ORM models.
- schemas.py – Contains Pydantic models for request validation and structured API responses.
- crud.py – Contains core business logic and database operations. The logic to check and update medicine status, reduce stock after sales, and maintain consistency is written here. All update operations are handled through controlled transactional sessions.
- routers/dashboard.py – Defines dashboard-related endpoints such as total sales, items sold, low stock, purchase summary, and recent sales.
- routers/inventory.py – Defines inventory-related endpoints to list, add, update, and manage medicines.
- generate_inventory.sh – Script to seed the database with sample medicine data for demonstration and testing.
The logic to determine and update medicine status such as Active, Low Stock, Expired, or Out of Stock is implemented in crud.py. This file contains the main business logic that recalculates medicine status based on quantity and expiry date and ensures consistent updates when inventory changes occur through API operations.
The frontend is developed using React and Vite. React Router DOM is used for routing and navigation. The frontend communicates with the backend using a configurable environment variable for the API base URL.
frontend/ │ ├── src/ │ ├── App.jsx │ ├── config.js │ ├── main.jsx │ ├── pages/ │ │ ├── Dashboard.jsx │ │ ├── Inventory.jsx │ │ ├── RecentSalesSection.jsx │ │ └── respective CSS files
- App.jsx – Contains main routing logic for the application.
- config.js – Stores backend base URL using the
VITE_API_URLenvironment variable. - Dashboard.jsx – Displays dashboard overview cards and provides toggle navigation between Sales and Inventory views.
- Inventory.jsx – Displays inventory overview and complete medicine list with status indicators and update functionality.
- RecentSalesSection.jsx – Displays recent sales data fetched from the backend.
- Each page has its respective CSS file for layout and styling consistency.