Skip to main content

📦 12 Modules Architecture - MStore Mobile

🎯 Overview

MStore Mobile menggunakan 12 modul utama yang terorganisir dalam 2 layer:
  1. /core → Data layer (services, repositories, models)
  2. /features → Presentation layer (UI, pages, widgets, Bloc)

📋 12 Modul Lengkap (EXACT Structure)

⚠️ IMPORTANT: Numbered Folders

Untuk memastikan EXACT 12 modules, setiap folder diberi prefix nomor:
  • /core/01_core/ hingga /core/12_global/
  • /features/01_core/ hingga /features/12_global/
Ini memastikan tidak ada folder tambahan dan struktur tetap konsisten.

1️⃣ Core Module - Authentication & System

Scope: auth, roles, system, tenant, registry

/core/01_core/

/features/core/


2️⃣ Finance Module

Scope: invoice, payment, AR/AP, ledger, reconciliations

/core/finance/

/features/finance/


3️⃣ Inventory Module

Scope: product, stock, goods receipt, adjustments

/core/inventory/

/features/inventory/


4️⃣ Procurement Module

Scope: PO, supplier, RFQ, approvals

/core/procurement/

/features/procurement/


5️⃣ Sales/POS Module

Scope: SO, POS, receipts, pricing, discounts

/core/sales/

/features/sales/


6️⃣ HR Module

Scope: employee, payroll, attendance, leave

/core/hr/

/features/hr/


7️⃣ Marketing & CRM Module

Scope: campaign, leads, CRM automation, segmentation

/core/crm/

/features/crm/


8️⃣ Customer Service Module

Scope: ticketing, SLA, chat integration

/core/cs/

/features/cs/


9️⃣ Audit & Compliance Module

Scope: audit logs, SoD engine, report export

/core/audit/

/features/audit/


🔟 Analytics/BI Module

Scope: dashboards, KPI, forecast, exports

/core/analytics/

/features/analytics/


1️⃣1️⃣ Holding/Multi-Entity Module

Scope: entity registry, consolidation, intercompany tx

/core/holding/

/features/holding/


1️⃣2️⃣ Global/Security Module

Scope: IAM, SSO, OPA/Policy, ESG & legal notices

/core/global/

/features/global/


📊 Current vs Target Structure

Current Structure Issues:

❌ Mixed naming: cashier_pos, operations, ops → should be sales
❌ Scattered modules: dashboard, dashboard_kpi → should be in analytics
❌ Missing modules: procurement, holding, global
❌ Inconsistent structure between /core and /features

Target Structure (12 Modules):

1. core - auth, roles, system, tenant, registry
2. finance - invoice, payment, AR/AP, ledger, reconciliations
3. inventory - product, stock, goods receipt, adjustments
4. procurement - PO, supplier, RFQ, approvals
5. sales - SO, POS, receipts, pricing, discounts
6. hr - employee, payroll, attendance, leave
7. crm - campaign, leads, CRM automation, segmentation
8. cs - ticketing, SLA, chat integration
9. audit - audit logs, SoD engine, report export
10. analytics - dashboards, KPI, forecast, exports
11. holding - entity registry, consolidation, intercompany tx
12. global - IAM, SSO, OPA/Policy, ESG & legal notices

🔄 Migration Plan

Phase 1: Rename & Consolidate

Phase 2: Create Missing Modules

Phase 3: Standardize Structure

Setiap modul harus follow pattern:

📝 Naming Conventions

Core Layer

  • Services: {entity}_service.dart (e.g., invoice_service.dart)
  • Repositories: {entity}_repository.dart (e.g., invoice_repository.dart)
  • Models: {entity}_models.dart (e.g., invoice_models.dart)

Features Layer

  • Bloc: {feature}_bloc.dart, {feature}_event.dart, {feature}_state.dart
  • Pages: {feature}_{action}_page.dart (e.g., invoice_list_page.dart)
  • Widgets: {feature}_{component}.dart (e.g., invoice_card.dart)

🎯 Benefits

1. Clear Separation of Concerns

  • /core → Business logic & data
  • /features → UI & presentation

2. Scalable Architecture

  • Easy to add new features per module
  • Independent development per team

3. Consistent Structure

  • Same pattern across all 12 modules
  • Easy onboarding for new developers

4. Aligned with Backend

  • Matches backend domain structure
  • Easier API integration


📌 Status

  • Documentation: Complete
  • 🔄 Implementation: In Progress
  • Migration: Pending
Last Updated: 2025-11-06