Pharmacy management system project
batches, expiry dates, bills and an ER diagram
Medicines, suppliers, purchases with batch and expiry, sales bills, low-stock and near-expiry alerts, with logins for the owner and the pharmacist. Generate a working version, then make it yours.
What the project does
Generated from the prompt below, so yours can differ: read it before you present it.
Medicines
Brand and generic name, category, strength and a reorder level, searchable by either name.Purchases by batch
Each purchase from a supplier adds a batch with its number, expiry date, quantity and cost.Sales bills
Add items, quantities and a discount; the bill takes stock from the batch that expires first and prints a total.Expiry rules
An expired batch cannot be sold, and batches expiring within 60 days are listed for return or clearance.Stock alerts
Medicines at or under their reorder level, grouped by supplier for the next order.Reports
Sales per day and month, top medicines, and the value of stock on hand.Who uses it
- Owner
- Manages medicines, suppliers and prices, sees every report.
- Pharmacist
- Makes sales bills and records purchases; cannot change prices or delete records.
ER diagram
Seven entities. Stock is held per batch, not per medicine: a medicine's stock is the sum of its unexpired batches. That one decision explains most of the design.
medicine
| id | uuid | PK |
| brand_name | text | |
| generic_name | text | |
| category | text | |
| strength | text | |
| reorder_level | int |
supplier
| id | uuid | PK |
| name | text | |
| phone | text | |
| licence_no | text |
purchase
| id | uuid | PK |
| supplier_id | uuid | FK |
| invoice_no | text | |
| purchased_on | date | |
| total | numeric |
batch
| id | uuid | PK |
| medicine_id | uuid | FK |
| purchase_id | uuid | FK |
| batch_no | text | |
| expires_on | date | |
| quantity | int | |
| cost | numeric | |
| mrp | numeric |
sale
| id | uuid | PK |
| bill_no | text | UK |
| customer_name | text | |
| sold_on | date | |
| discount | numeric | |
| total | numeric |
sale_item
| id | uuid | PK |
| sale_id | uuid | FK |
| batch_id | uuid | FK |
| quantity | int | |
| price | numeric |
user
| id | uuid | PK |
| name | text | |
| role | text |
Relationships
- supplier supplies purchase (one to many)
- purchase brings in batch (one to many)
- medicine is stocked as batch (one to many)
- sale contains sale_item (one to many)
- batch is sold in sale_item (one to many)
- user makes sale (one to many)
Mermaid source
Paste it into mermaid.live, draw.io (Arrange, Insert, Advanced, Mermaid) or any Markdown editor that draws Mermaid to get the diagram for your report.
erDiagram
SUPPLIER ||--o{ PURCHASE : "supplies"
PURCHASE ||--o{ BATCH : "brings in"
MEDICINE ||--o{ BATCH : "is stocked as"
SALE ||--o{ SALE_ITEM : "contains"
BATCH ||--o{ SALE_ITEM : "is sold in"
USER ||--o{ SALE : "makes"
MEDICINE {
uuid id PK
text brand_name
text generic_name
text category
text strength
int reorder_level
}
SUPPLIER {
uuid id PK
text name
text phone
text licence_no
}
PURCHASE {
uuid id PK
uuid supplier_id FK
text invoice_no
date purchased_on
numeric total
}
BATCH {
uuid id PK
uuid medicine_id FK
uuid purchase_id FK
text batch_no
date expires_on
int quantity
numeric cost
numeric mrp
}
SALE {
uuid id PK
text bill_no UK
text customer_name
date sold_on
numeric discount
numeric total
}
SALE_ITEM {
uuid id PK
uuid sale_id FK
uuid batch_id FK
int quantity
numeric price
}
USER {
uuid id PK
text name
text role
}Generate yours and get the code
This builds on Refinar's inventory starting point, which already has products, suppliers and a stock ledger with full history. Batches, expiry and sales bills come from the prompt. Running a real medical store? See the pharmacy management system page instead.
The button opens Refinar with the project described in the first message, ready to edit. About a minute later there is a running app with sign-in, the pages above and a PostgreSQL database, in a live preview you can click through and change by asking.
It is real code: Next.js and React in TypeScript, PostgreSQL with the Drizzle ORM, and Better Auth for sign-in. When you press Go live, the GitHub repository moves to your own GitHub account and the database to your own Neon account, so you can read it, run it and present it. Building uses credits and going live needs a Refinar plan; the details are on the pricing page.
If your syllabus asks for PHP and MySQL, Java or Python, ask your guide before you start: the generated code will not be in those languages. The ER diagram and the checklist on this page work for any stack.
The prompt it starts with
A pharmacy management system for a final-year project, in English: medicines with brand name, generic name, category, strength and reorder level; suppliers; purchases from a supplier with batch number, expiry date, quantity and cost per batch; sales bills with customer name, items, quantity, price, discount and total, taking stock from the batch that expires first; expired batches cannot be sold; alerts for low stock and batches expiring within 60 days; daily and monthly sales reports. Roles: owner, who does everything, and pharmacist, who makes bills and records purchases.
Report and viva checklist
Report checklist
- Abstract: the problem, who uses the system and what it does, in one paragraph.
- Existing system and its problems, then the proposed system.
- Objectives and scope, including what is out of scope.
- Requirements: functional and non-functional, per role.
- Technology used and why: Next.js, TypeScript, PostgreSQL, Drizzle ORM.
- ER diagram and table design, normalised to third normal form.
- DFD level 0 and level 1, and a use case diagram.
- Module description with a screenshot of each screen.
- Testing: test cases with input, expected result and actual result.
- Conclusion, limitations and future scope.
- References, and a statement of the tools you used, AI included.
Make the report about this project
- Explain first expiry, first out, and show the query that picks the batch for a sale.
- Show how a sale reduces batch quantity inside one database transaction, so stock never goes negative.
- List the alerts and the exact rule behind each one.
- Test cases: selling an expired batch, selling more than in stock, a pharmacist trying to change a price.
Viva questions to prepare
- Why does sale_item point at a batch and not at a medicine?
- How do you compute current stock of one medicine? Write the query.
- What happens if two bills sell the last strip at the same moment?
- How would you handle a customer returning a medicine?
- What is a primary key and a foreign key? Point to one of each in your tables.
- Which normal form are your tables in, and what would break if they were not?
- How does sign-in work, and how are passwords stored?
- How does the app stop one user from seeing another user's data?
- Why PostgreSQL, and not MySQL or MongoDB?
- What did you change or add yourself, and why?
Build it, understand it, then submit it
Many universities allow tools, AI included, as long as you say so and can explain every part of what you submit. Read your university's rules and ask your guide before you start, and name Refinar in the tools section of your report.
Treat the generated app as a starting point, not a submission. Read every table and every page, change something yourself, add one feature that is your own, and write the test cases by hand. If you cannot say why a table has a foreign key, an examiner will find out in a minute.
Submitting work you did not do and do not understand as your own is academic misconduct, whoever or whatever wrote it. These pages are here to help you build a project you can defend.
Take it further
- Returns to supplier for expired batches, with a credit note.
- Prescription upload for medicines that need one.
- Barcode search at the counter.
- Tax lines on the bill, as your country's rules require.
Questions
What modules does a pharmacy management system project have?
Medicines, suppliers, purchases with batches, sales billing, stock and expiry alerts, and reports, with an owner login and a staff login.
Why track batches?
Two boxes of the same medicine can expire on different dates. Tracking batches is how the app sells the older one first and refuses an expired one.
Can it check drug interactions?
No. That needs a licensed medical database and is beyond a student project. Keep the scope to stock, sales and expiry, and say so in your report.
Is it free?
Building uses credits from a Refinar plan, and getting the code into your own GitHub account goes through Go live, which needs a plan. The details are on the pricing page.
More project ideas
- Hospital management systemPatients, doctors, appointments, prescriptions, wards and bills, with a login per role.
- Library management systemCatalogue, copies, issue and return with due dates, fines and reservations.
- Student management systemStudents, courses, attendance, marks and results, fees and a student login.
- Hostel management systemRooms and beds, allocation, fees, out-passes, visitors and complaints.
- E-commerce websiteStorefront, cart, checkout, orders with status, customer accounts and a stock admin.
- Event management systemEvents with ticket types, registration, QR check-in at the door and feedback.