S
Sheba ISP ERPDOCS
Architecture

Modular Monolith Architecture

Domain boundaries, inter-app dependencies, and service contracts across the 13 backend apps.

Modular Monolith Architecture & Boundaries

IMPLEMENTED

The backend is constructed as a structured modular monolith divided into 13 cohesive Django applications within backend/apps/.


1. Domain Map & Responsibilities

ModulePrimary ResponsibilityData OwnershipPublic Interfaces
apps.coreTenancy, global settings, SaaS control plane, distributed lockingTenant, TenantDomain, AuditLog, SaaSPackage, DatabaseBackupTenantResolutionMiddleware, distributed_lock
apps.authenticationIdentity, staff membership, RBAC roles/permissions, reseller marginsStaffProfile, Role, Permission, StaffMembership, ResellerIsTenantMember, HasPermissionScope, CurrentUserView
apps.customersSubscriber CRM, connection credentials, lifecycle statesCustomerCustomerViewSet, CustomerQueryApiView
apps.billingBroadband packages, monthly invoices, auto-recharge rulesPackage, Invoice, Recharge, Offer, ResellerPricingInvoiceViewSet, PackageViewSet, RechargeViewSet
apps.financeSingle source of financial truth: double-entry ledger & idempotencyBillingAccount, InvoiceLine, PaymentAllocation, LedgerEntry, Adjustment, IdempotencyKeyBillingAccountViewSet, LedgerEntryViewSet
apps.paymentsGateway integrations, SMS webhook ingestion, transaction logsPaymentGateway, PaymentTransaction, PaymentAttempt, InboundPaymentEvent, SmsLogSmsWebhookView, InboundPaymentEventViewSet
apps.networkRouterOS v7 MikroTik automation, OLT chassis diagnostics, user sessionsPOPBranch, Router, OLT, ONU, UserSessionMikroTikService, OLTClient, RouterViewSet, OLTViewSet
apps.supportNOC helpdesk, incident tickets, technician reply threadsTicket, TicketReplyTicketViewSet
apps.hrEmployee records, attendance, leaves, payroll accountingEmployee, Attendance, LeaveRequest, AdvanceSalary, PayrollRecordEmployeeViewSet, PayrollRecordViewSet
apps.storeHardware catalog, fiber drop cables, SFP transceivers, stock entriesItemCategory, StoreItem, StockTransactionStoreItemViewSet, StockTransactionViewSet
apps.tasksField maintenance work orders, technician dispatchTaskTaskViewSet
apps.callcenterCall center logs, automated bill payment voice reminder broadcastsCallLog, VoiceSetting, VoiceTemplateCallLogViewSet, VoiceSettingViewSet
apps.reportsHigh-performance aggregated analytics, revenue trends, KPIs(Read-only analytical projections over core models)DashboardAnalyticsView

2. Dependency Direction Rules

Rendering diagram...

Architectural Guardrails:

  1. No Circular Imports: Lower-level foundational modules (core, authentication) must never import from higher-level modules (reports, support, network).
  2. Finance as Financial Sink: billing and payments emit events or create ledger entries in finance; finance does not depend on specific gateway APIs.
  3. Network Isolation: Direct network socket calls are confined to apps.network.services.mikrotik and apps.network.services.olt.

On this page