A production-grade, multi-role business operating system for Ayurvedic pharmaceutical manufacturing, distribution, compliance, and social impact.
Live Demo β’ API Docs β’ Architecture β’ Deploy Guide
- Why Makswel?
- Features
- Tech Stack
- Architecture
- Dashboard Screenshots
- Role-Based Access Control
- API Endpoints
- Database Schema
- Getting Started
- Deployment
- Environment Variables
- Project Structure
Makswel Pharmaceuticals needed a unified digital operating system that spans the entire lifecycle of an Ayurvedic manufacturing business β from raw herb sourcing and batch production to B2B distribution, regulatory compliance, and community impact.
This isn't just an ecommerce site. It's a modular monolith covering:
| Domain | What It Handles |
|---|---|
| π Manufacturing | Formula master, batch production, QC/QA, raw material sourcing |
| π¦ Inventory | Multi-warehouse stock, lot tracking, expiry management, movements |
| π° Commerce | B2B wholesale, D2C ordering, dealer portals, price lists |
| π Compliance | AYUSH licensing, audit trails, document workflows, renewals |
| π§ͺ Research | Publications, peer review, literature repository |
| π Social Impact | Events, scholarships, fundraisers, impact reporting |
| π€ CRM | Lead management, support tickets, customer engagement |
| π₯ HR & Training | Employee management, training courses, enrollment tracking |
| π Analytics | Revenue analytics, product performance, margin analysis |
| πΌ Accounts | Payments, ledger, journal entries, reconciliation |
- Passport.js local authentication with bcrypt password hashing
- Google OAuth 2.0 integration for seamless sign-in
- Redis-backed sessions for production-grade session management
- Role-Based Access Control (RBAC) with 8 distinct roles
- Route protection β each dashboard is role-gated at both UI and API level
- Batch creation and lifecycle management (planned β in-progress β QC β completed)
- Raw material sourcing with vendor GSTIN tracking
- Quality control checks per batch (heavy metals, microbial load, moisture)
- Material consumption logging with wastage tracking
- Batch document attachments
- Multi-warehouse support with location tracking
- Stock items by type (raw materials, packaging, finished goods)
- Stock movement history (in, out, transfer, adjustment)
- Reorder level alerts
- Lot-level expiry tracking
- 20 Ayurvedic/Herbal products with therapeutic classifications
- Wholesale/MRP dual pricing with margin analysis
- CSV export for price lists
- Order lifecycle: pending β confirmed β shipped β delivered
- Dealer and customer portals
- Manufacturing license management with expiry tracking
- Compliance task scheduling and assignment
- Full audit log capturing all state-changing operations
- AYUSH batch record traceability
- Therapeutic area distribution charts
- Category breakdown analysis
- Revenue and margin analytics
- Product performance dashboards
- Lead management with status pipeline
- Support ticket system with priority and category
- Customer engagement tracking
- Training course management
- Employee enrollment and progress tracking
- Course status management
- Research project tracking
- Publication management with journal metadata
- Peer review workflow
- Event management and scheduling
- Scholarship program administration
- Fundraiser tracking with goal progress
- Beneficiary management
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β FRONTEND β
β React 19 Β· TypeScript Β· Vite 6 Β· Tailwind CSS 4 β
β React Router Β· Recharts Β· Lucide Icons β
β React Hook Form Β· Zod Β· TanStack Query patterns β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β BACKEND β
β Express 5 Β· TypeScript Β· tsx runtime β
β Passport.js (Local + Google OAuth) Β· express-session β
β bcryptjs Β· cookie-parser Β· CORS β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β DATABASE β
β PostgreSQL 17 (primary) Β· Redis 7.2 (sessions/cache) β
β 30+ database tables Β· UUID primary keys β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β INFRASTRUCTURE β
β Docker Β· Nginx reverse proxy Β· systemd services β
β VPS deployment Β· SSL/TLS ready β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββ
β Client (Browser) β
β React SPA + Vite β
ββββββββββββ¬ββββββββββββ
β
ββββββββββββΌββββββββββββ
β Nginx (443/80) β
β SSL Termination β
ββββββββββββ¬ββββββββββββ
β
ββββββββββββΌββββββββββββ
β Express.js (3001) β
β API + SSR Fallback β
β Passport.js Auth β
ββββ¬βββββββ¬βββββββ¬ββββββ
β β β
ββββββββββββΌβ ββββΌββββ ββΌβββββββββββ
βPostgreSQL β βRedis β β Static β
β (5432) β β(6379)β β Files β
β 30+ tables β βSessionsβ β (dist/) β
βββββββββββββ ββββββββ βββββββββββββ
ββββββββββββ βββββββββββββ ββββββββββββ ββββββββββββ
β Sourcing βββββΆβ Manufac- βββββΆβ QC / βββββΆβInventory β
β (Raw) β β turing β β QA β β Stock β
ββββββββββββ βββββββββββββ ββββββββββββ ββββββ¬ββββββ
β
ββββββββββββ ββββββββββββ ββββββΌββββββ
β Accounts ββββββ Invoicingββββββ Orders β
β & Ledger β β β β β
ββββββββββββ ββββββββββββ ββββββββββββ
| Login | Register |
|---|---|
![]() |
![]() |
| Overview | User Management | Audit Log |
|---|---|---|
![]() |
![]() |
![]() |
| Products | Orders | Manufacturing |
|---|---|---|
![]() |
![]() |
![]() |
| Inventory | Compliance | CRM |
|---|---|---|
![]() |
![]() |
![]() |
| Support | Accounts | Training |
|---|---|---|
![]() |
![]() |
![]() |
| Research | Events | Scholarships | Roles |
|---|---|---|---|
![]() |
![]() |
![]() |
![]() |
| Manufacturing Overview |
|---|
![]() |
| Dealer Overview | Products | Orders |
|---|---|---|
![]() |
![]() |
![]() |
| Customer Overview | Products |
|---|---|
![]() |
![]() |
| QC Overview |
|---|
![]() |
| Accounts Overview |
|---|
![]() |
| Support Overview |
|---|
![]() |
| HR Overview |
|---|
![]() |
Makswel implements 8 distinct roles with fine-grained route and API protection:
| Role | Description | Accessible Modules |
|---|---|---|
| admin | Full system access | All modules |
| manufacturer | Manufacturing operations | Manufacturing, Compliance, Products |
| dealer | Wholesale partner portal | Dealer Portal, Products, Prices, Orders |
| customer | Retail buyer portal | Customer Portal, Products, Prices, Orders |
| qc_inspector | Quality control staff | Compliance, QC checks, Batch verification |
| accountant | Financial operations | Accounts, Payments, Ledger, Journal |
| support | Customer support team | CRM, Support Tickets, Lead Management |
| hr_manager | Human resources | HR Dashboard, Training, Enrollments |
1. User logs in β Passport.js validates credentials
2. Session created β Stored in Redis with user ID + role
3. Frontend checks role β ProtectedRoute component gates UI
4. API checks role β Middleware verifies session role on each request
5. Sidebar adapts β Only visible nav items for current role
Route Protection Example:
<ProtectedRoute roles={['admin', 'manufacturer']}>
<ManufacturerDashboard />
</ProtectedRoute>API Protection Pattern:
router.get('/api/manufacturing/batches', async (req: any, res) => {
if (!req.session?.userId) return res.status(401).json({ error: 'Unauthorized' })
// Role-specific logic...
})| Method | Endpoint | Description |
|---|---|---|
| POST | /api/auth/register |
Register new dealer/customer |
| POST | /api/auth/login |
Email + password login |
| POST | /api/auth/logout |
Destroy session |
| GET | /api/auth/me |
Get current user |
| GET | /api/auth/google |
Google OAuth redirect |
| GET | /api/auth/google/callback |
Google OAuth callback |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/products |
List all products with variants |
| GET | /api/orders |
List orders (filtered by role) |
| POST | /api/orders |
Create new order |
| GET | /api/stats |
Dashboard statistics |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/admin/users |
List all users |
| PATCH | /api/admin/users/:id |
Update user (role, status) |
| DELETE | /api/admin/users/:id |
Delete user |
| GET | /api/admin/audit-log |
Full audit trail |
| GET | /api/roles |
List all roles |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/manufacturing/batches |
List manufacturing batches |
| POST | /api/manufacturing/batches |
Create batch |
| PATCH | /api/manufacturing/batches/:id/status |
Update batch status |
| GET | /api/manufacturing/qc/:batchId |
QC checks for batch |
| POST | /api/manufacturing/qc |
Submit QC result |
| GET | /api/manufacturing/raw-materials |
List raw materials |
| POST | /api/manufacturing/raw-materials |
Add raw material |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/inventory/warehouses |
List warehouses |
| POST | /api/inventory/warehouses |
Create warehouse |
| GET | /api/inventory/stock |
List stock items |
| POST | /api/inventory/stock |
Add stock item |
| GET | /api/inventory/stock/:warehouseId |
Stock by warehouse |
| GET | /api/inventory/movements |
Stock movement history |
| POST | /api/inventory/movements |
Record stock movement |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/crm/leads |
List CRM leads |
| POST | /api/crm/leads |
Create lead |
| PATCH | /api/crm/leads/:id |
Update lead |
| PATCH | /api/crm/leads/:id/status |
Change lead status |
| GET | /api/support/tickets |
List support tickets |
| POST | /api/support/tickets |
Create ticket |
| PATCH | /api/support/tickets/:id |
Update ticket |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/compliance/licenses |
List licenses |
| POST | /api/compliance/licenses |
Add license |
| GET | /api/compliance/tasks |
List compliance tasks |
| POST | /api/compliance/tasks |
Create task |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/accounts/payments |
Payment history |
| GET | /api/accounts/ledger |
Account ledger |
| GET | /api/accounts/journal |
Journal entries |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/training/courses |
List courses |
| POST | /api/training/courses |
Create course |
| PATCH | /api/training/courses/:id |
Update course |
| GET | /api/training/enrollments |
List enrollments |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/research/projects |
List research projects |
| POST | /api/research/projects |
Create project |
| GET | /api/research/publications |
List publications |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/events |
List events |
| POST | /api/events |
Create event |
| GET | /api/scholarships |
List scholarships |
| POST | /api/scholarships |
Create scholarship |
IDENTITY & ACCESS
βββ users (id, email, password_hash, name, role, company, gstin, ...)
βββ roles (id, name, permissions)
PRODUCTS & COMMERCE
βββ products (id, sku, name, category, formulation, ingredients, ...)
βββ product_variants (id, product_id, pack_size, wholesale_price, mrp_price, ...)
βββ orders (id, user_id, status, total_amount, ...)
βββ order_items (id, order_id, product_id, quantity, unit_price, ...)
MANUFACTURING
βββ batches (id, product_id, batch_no, status, planned_qty, ...)
βββ batch_material_consumption (id, batch_id, ingredient_id, qty_used, ...)
βββ batch_quality_checks (id, batch_id, test_type, result, passed, ...)
βββ raw_materials (id, name, botanical_name, vendor_gstin, ...)
INVENTORY
βββ warehouses (id, name, location, ...)
βββ stock_items (id, warehouse_id, item_type, qty_on_hand, ...)
βββ stock_movements (id, stock_item_id, movement_type, qty, ...)
βββ inventory_lots (id, stock_item_id, lot_no, expiry_date, ...)
CRM & SUPPORT
βββ crm_leads (id, name, source, status, assigned_to, ...)
βββ support_tickets (id, created_by, subject, priority, status, ...)
COMPLIANCE
βββ compliance_licenses (id, license_type, license_no, expiry_date, ...)
βββ compliance_tasks (id, task_type, due_date, status, ...)
βββ audit_logs (id, actor_user_id, action, entity_type, ...)
TRAINING & HR
βββ training_courses (id, title, category, status, ...)
βββ training_enrollments (id, course_id, user_id, progress, ...)
βββ employees (id, user_id, designation, department, ...)
RESEARCH
βββ research_projects (id, title, synopsis, status, ...)
βββ research_publications (id, title, journal_name, doi, ...)
SOCIAL IMPACT
βββ events (id, name, event_type, start_date, ...)
βββ scholarships (id, name, eligibility, total_amount, ...)
ACCOUNTS
βββ accounts_payments (id, invoice_id, amount, method, status, ...)
βββ accounts_ledger (id, account_id, debit, credit, ...)
βββ accounts_journal (id, entry_date, narration, ...)
- Node.js 20+
- PostgreSQL 17
- Redis 7+
# Clone the repository
git clone https://github.com/yashas-13/maxwell.git
cd maxwell
# Install dependencies
npm install
# Set up environment
cp .env.example .env
# Edit .env with your credentials
# Set up database
psql -U postgres -c "CREATE USER makswell WITH PASSWORD 'yourpassword';"
psql -U postgres -c "CREATE DATABASE makswell OWNER makswell;"
# Start development
npm run devEmail: cyberjeet13@gmail.com
Password: admin123
| Command | Description |
|---|---|
npm run dev |
Start frontend (Vite) + backend (Express) concurrently |
npm run dev:client |
Frontend only on :5173 |
npm run dev:server |
Backend only on :3001 |
npm run build |
Build production bundle |
npm start |
Start production server |
# 1. Install Node.js, PostgreSQL, Redis
curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
sudo apt install -y nodejs postgresql redis-server nginx
# 2. Clone and build
git clone https://github.com/yashas-13/maxwell.git /var/www/makswell
cd /var/www/makswell
npm install
npm run build
# 3. Configure systemd service
sudo tee /etc/systemd/system/makswell.service <<EOF
[Unit]
Description=Makswell Pharmaceuticals SaaS
After=network.target postgresql.service redis.service
[Service]
Type=simple
User=www-data
WorkingDirectory=/var/www/makswell
ExecStart=/usr/bin/node --import tsx server/index.ts
Restart=always
Environment=NODE_ENV=production
Environment=PORT=3001
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl enable makswell
sudo systemctl start makswell
# 4. Configure Nginx
sudo tee /etc/nginx/sites-available/makswell <<EOF
server {
listen 80;
server_name makswell.tech;
location / {
proxy_pass http://127.0.0.1:3001;
proxy_http_version 1.1;
proxy_set_header Upgrade \$http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host \$host;
proxy_set_header X-Real-IP \$remote_addr;
proxy_cache_bypass \$http_upgrade;
}
}
EOF
sudo ln -s /etc/nginx/sites-available/makswell /etc/nginx/sites-enabled/
sudo nginx -t && sudo systemctl reload nginx
# 5. Enable SSL
sudo certbot --nginx -d makswell.tech| Variable | Description | Required |
|---|---|---|
DATABASE_URL |
PostgreSQL connection string | β |
REDIS_URL |
Redis connection string | β |
SESSION_SECRET |
Express session signing key | β |
GOOGLE_CLIENT_ID |
Google OAuth client ID | Optional |
GOOGLE_CLIENT_SECRET |
Google OAuth client secret | Optional |
GOOGLE_CALLBACK_URL |
OAuth callback URL | Optional |
PORT |
Server port (default: 3001) | Optional |
NODE_ENV |
development or production |
Optional |
makswel-saas/
βββ server/ # Backend (Express.js + TypeScript)
β βββ index.ts # Server entry, middleware, auth config
β βββ db.ts # PostgreSQL connection pool
β βββ routes/
β βββ manufacturing.ts # All 60+ API route handlers
βββ src/ # Frontend (React + TypeScript)
β βββ App.tsx # Router config + role-based routes
β βββ main.tsx # App entry point
β βββ context/
β β βββ AuthContext.tsx # Auth state, login, register, RBAC types
β βββ components/
β β βββ Sidebar.tsx # Role-adaptive navigation sidebar
β β βββ ProtectedRoute.tsx # Route guard component
β βββ pages/
β β βββ Login.tsx # Email/password + Google OAuth login
β β βββ Register.tsx # Dealer/Customer registration
β β βββ Dashboard.tsx # Main dashboard with stats
β β βββ ProductCatalog.tsx # 20 Ayurvedic products with search
β β βββ PriceList.tsx # Wholesale/MRP pricing + CSV export
β β βββ Orders.tsx # Order management by role
β β βββ Dealers.tsx # Dealer directory (admin)
β β βββ Analytics.tsx # Revenue & product analytics
β β βββ admin/
β β β βββ AdminDashboard.tsx
β β β βββ AdminUsers.tsx
β β β βββ AdminAudit.tsx
β β βββ manufacturer/
β β β βββ ManufacturerDashboard.tsx
β β βββ dealer/
β β β βββ DealerDashboard.tsx
β β βββ customer/
β β β βββ CustomerDashboard.tsx
β β βββ compliance/
β β β βββ ComplianceDashboard.tsx
β β βββ crm/
β β β βββ CRMDashboard.tsx
β β βββ accounts/
β β β βββ AccountsDashboard.tsx
β β βββ hr/
β β β βββ HRDashboard.tsx
β β βββ research/
β β β βββ ResearchDashboard.tsx
β β βββ ngo/
β β βββ NGODashboard.tsx
β βββ lib/
β βββ utils.ts
βββ screenshots/ # 72 dashboard screenshots
βββ dist/ # Production build output
βββ .env # Environment secrets (gitignored)
βββ .env.example # Template for environment variables
βββ package.json
βββ tsconfig.json
βββ vite.config.ts
βββ tailwind.config.ts
βββ README.md
Makswel's catalog includes 20 proprietary Ayurvedic medicines across therapeutic categories:
| Product | Category | Form | Therapeutic Area |
|---|---|---|---|
| Livozone | Liver Care | Capsule | Yakrut Vikaara |
| Asmane | Respiratory | Tablet | Shwasa Roga |
| Garmax | Musculoskeletal | Capsule | Sandhigata Vata |
| Ashwagandha Plus | Adaptogen | Capsule | Rasayana |
| Triphala Churna | Digestive | Powder | Vata Balancing |
| Punarnava Mandur | Blood Purifier | Tablet | Raktashodhaka |
| Chandraprabha Vati | Urinary | Tablet | Mutravaha Srotas |
| Sutshekhar Ras | Digestive | Tablet | Amlapitta |
| Arogyavardhini Vati | Hepatic | Tablet | Yakrut Roga |
| Mahamanjisthadi Kvath | Blood | Liquid | Raktapitta |
| Dashamula Kashayam | Anti-inflammatory | Liquid | Vata disorders |
| Bhumyamalaki Syrup | Hepatoprotective | Syrup | Udara Roga |
| Kaishore Guggulu | Anti-inflammatory | Tablet | Amavata |
| Triphala Guggulu | Digestive | Tablet | Obesity |
| Gokshuradi Guggulu | Urinary | Tablet | Mutra Roga |
| Yogaraj Guggulu | Musculoskeletal | Tablet | Sandhivata |
| PanchTikta Ghruta | Skin | Liquid | Kushtha |
| Mahatikta Ghruta | Skin/Pitta | Liquid | Yonivyapad |
| Khadiradi Vati | Throat/Dental | Lozenge | Mukha Roga |
| Laxmivilas Ras | Respiratory | Tablet | Kasa Shwasa |
This is a proprietary platform for Makswel Pharmaceuticals. For internal development:
- Create a feature branch
- Make changes with TypeScript strict mode
- Ensure all role-based routes are properly protected
- Test with all 8 user roles
- Submit PR with description
Proprietary β Makswel Pharmaceuticals. All rights reserved.
Built with π for Ayurvedic Manufacturing Excellence
From raw herb sourcing to patient impact β one platform, every workflow.



























