How rahul80010/billing-saas-backend works
MOHURI is a multi-tenant billing and business-management API for retail, restaurant, and hotel operations. A merchant request enters through the Express server and a domain route, then a controller performs the work against MongoDB-backed models; authentication protects many routes. Core workflows include catalog and billing, reporting, customer stock orders, restaurant and hotel operations, and media/AI features. The excerpts establish several controller-to-model and service calls; unsampled controller behavior is represented only where the source index or mounted routes identifies the subsystem.
Main entry points: server.js Express API · billController.js Billing and invoices · Product.js Product records · stockSharingController.js Customer stock orders
Components 31
API and identity
- Express API
server.js - Authentication routes
routes/authRoutes.js - Authentication
controllers/authController.js - Token protection
middleware/authMiddleware.js - Admin controls
controllers/adminController.js
Catalog and billing
- Catalog routes
routes/productRoutes.js - Products and variants
controllers/productController.js - Billing routes
routes/billRoutes.js - Billing and invoices
controllers/billController.js - Customer and CRM
controllers/crmController.js
Business operations
- Customer stock orders
controllers/stockSharingController.js - Restaurant operations
controllers/restaurantController.js - Hotel booking routes
routes/hotelBookingRoutes.js - Hotel bookings
controllers/hotelBookingController.js
Insights and media
- Sales and expense reports
controllers/reportController.js - Product image gallery
controllers/galleryController.js - AI assistance
controllers/aiController.js
Persistence and services
- Product records
models/Product.js - Variant records
models/ProductVariant.js - Bill records
models/Bill.js - Invoice PDFs
services/pdfService.js - WhatsApp messaging
services/whatsappService.js - Customer records
models/Customer.js - Stock orders
models/StockOrder.js - Booking records
models/HotelBooking.js - Image search
services/productImageSearchService.js - Image storage
services/storageService.js - Live updates
services/socketService.js - MongoDB connection
config/db.js - User records
models/User.js
Other components
- Merchant
Connections 38
- Merchant → Express API: sends requests
server.js - Express API → Authentication routes: mounts routes
server.js - Express API → Catalog routes: mounts routes
server.js - Express API → Billing routes: mounts routes
server.js - Express API → Hotel booking routes: mounts routes
server.js - Express API → MongoDB connection: connects to
server.js - Express API → Live updates: initializes
server.js - Authentication routes → Authentication: dispatches to
routes/authRoutes.js - Authentication routes → Token protection: protects routes
routes/authRoutes.js - Token protection → User records: loads user
middleware/authMiddleware.js - Authentication → User records: uses records
controllers/authController.js - Catalog routes → Products and variants: dispatches to
- Products and variants → Product records: uses records
- Products and variants → Variant records: uses records
- Billing routes → Billing and invoices: dispatches to
routes/billRoutes.js - Billing and invoices → Bill records: reads and writes
controllers/billController.js - Billing and invoices → Product records: uses products
controllers/billController.js - Billing and invoices → Variant records: uses variants
controllers/billController.js - Billing and invoices → Invoice PDFs: generates invoices
controllers/billController.js - Billing and invoices → WhatsApp messaging: sends messages
controllers/billController.js - Customer and CRM → Customer records: uses records
- Sales and expense reports → Bill records: reads sales
controllers/reportController.js - Sales and expense reports → Product records: reads products
controllers/reportController.js - Sales and expense reports → Customer records: reads customers
controllers/reportController.js - Customer stock orders → Stock orders: creates orders
controllers/stockSharingController.js - Customer stock orders → Product records: checks products
controllers/stockSharingController.js - Customer stock orders → Variant records: checks variants
controllers/stockSharingController.js - Customer stock orders → Customer records: saves customers
controllers/stockSharingController.js - Hotel booking routes → Hotel bookings: dispatches to
routes/hotelBookingRoutes.js - Hotel bookings → Booking records: reads and writes
controllers/hotelBookingController.js - Hotel bookings → Live updates: emits updates
controllers/hotelBookingController.js - Hotel bookings → Product records: uses products
controllers/hotelBookingController.js - Product image gallery → Image search: searches images
controllers/galleryController.js - Product image gallery → Image storage: uploads assets
controllers/galleryController.js - Product image gallery → Product records: searches products
controllers/galleryController.js - AI assistance → Product records: uses products
controllers/aiController.js - AI assistance → Bill records: uses bills
controllers/aiController.js - Sales and expense reports → AI assistance: requests insights