The Healio Backend is an enterprise-ready healthcare e-commerce engine designed for speed, security, and scalability. It serves as the "System Core" for the Healio Nexus, handling mission-critical health data, complex order fulfillment, and multi-role access control.
Tip
For interactive API exploration, refer to our Postman Testing Guide.
Healio uses a modular, role-based architecture to ensure relational integrity and high availability.
| Layer | technology | Rationale |
|---|---|---|
| Logic | Express.js (v5) |
Fast, minimalist, and robust request handling. |
| Database | PostgreSQL |
Relational consistency for healthcare inventories. |
| ORM | Prisma |
Type-safe migrations and intuitive data modeling. |
| Auth | Better-Auth |
Modern, secure authentication with multi-provider support. |
| Mailer | Nodemailer |
Reliable transactional email delivery for system alerts. |
| Validation | Zod |
Schema-driven data validation for zero-compromise security. |
- Granular Permissions: Fine-grained access control for
ADMIN,SELLER, andCUSTOMER. - Session Intelligence: Secure session management with automated refresh protocols.
- Identity Link: Cross-node identity verification via Better-Auth.
- Audited Listings: Real-time stock tracking with manufacturer and category auditing.
- Flash Sale Logic: Specialized pricing overrides for synchronized sales events.
- Category Hierarchy: Recursive category management for complex medicine taxonomies.
- Transaction Integrity: ACID-compliant order processing via PostgreSQL transactions.
- Lifecycle Tracking: Precise order status management (Placed → Processing → Shipped → Delivered).
- Revenue Analytics: Real-time aggregation of fiscal data for Admin Command Center.
Note
View the Interactive ERD for a detailed relational overview.
erDiagram
USER ||--o{ MEDICINE : manages
USER ||--o{ ORDER : places
USER ||--o{ REVIEW : writes
CATEGORY ||--o{ MEDICINE : contains
MEDICINE ||--o{ REVIEW : receives
MEDICINE ||--o{ ORDER_ITEM : included_in
ORDER ||--o{ ORDER_ITEM : contains
src/
├── app.ts # Core application configuration
├── server.ts # Main entry point & port binding
├── config/ # Environment & System constants
├── controllers/ # Request processing & signal logic
├── middlewares/ # Security & Validation guards
├── modules/ # Feature-specific business logic
├── lib/ # Shared libraries (Prisma Node, Auth Node)
└── scripts/ # Seeding & Maintenance automation
- Node.js 18+ & npm/pnpm
- PostgreSQL Instance (Local or Cloud)
npm install # Install dependencies
cp .env.example .env # Configure environmental variables
npx prisma migrate dev # Sync database schema
npm run dev # Start development engineTo initialize the system with an administrative account:
# Ensure ALLOW_ADMIN_SIGNUP=true in .env
npm run seed:adminDeveloped with 💎 Precision & ❤️ Care by Habibur Rahman Zihad
Licensed under the ISC License. All rights reserved.