StoreProject is a comprehensive, multi-tiered retail management platform designed to scale from single kiosks to multi-national supermarket chains, primarily focusing on the African context (specifically Cameroon). It features an offline-capable POS architecture, robust role-based access control (RBAC), multi-branch tracking, inventory management, and extensive financial and operational reporting.
The architecture is built on .NET 8.0 and currently operates as a Modular Monolith using ASP.NET Core Web API, Entity Framework Core (MySQL), and Razor Pages for the user interface.
The project is structured into four primary C# projects:
- Purpose: Contains the shared contracts, Enums, DTOs, and Domain Entities.
- Key Components:
- Entities: Extremely robust data model encompassing
Branch,Customer,Employee,Invoice,PurchaseOrder,Sale,StockMovement,Item,User,CashierShift, and loyalty/campaign modules. - DTOs: Data Transfer Objects used to transport data cleanly between the API and UI layers without exposing internal entity states.
- Interfaces: Defines service contracts that are implemented in DbServices or API application layers.
- Entities: Extremely robust data model encompassing
- Purpose: Encapsulates all data persistence logic and infrastructure integrations.
- Key Components:
- Context (
StoreDbContext): The central EF Core context managing the mappings between C# entities and the underlying MySQL tables. - Repositories & UnitOfWork: Implements the Repository and Unit of Work patterns to provide a clean abstraction over EF Core, ensuring transactional integrity.
- Seeding: Automatically seeds essential foundational data (like Admin users and basic roles/permissions) on initialization.
- Context (
- Purpose: The RESTful API that handles business logic, security, and data aggregation.
- Key Components:
- Program.cs: Configures the HTTP pipeline, rate-limiting (strict limits on
/auth, broader limits elsewhere), JWT Bearer authentication, and Swagger with JWT support. - Controllers: Grouped by domain (e.g.,
AuthController,InvoicesController,InventoryOperationsController,CashManagementController,LoyaltyController,StockTransfersController). - Middleware: Global exception handling, correlation ID tracking, audit logging, and security header injection.
- Authorization: Policies evaluate
permclaims to gate operations (e.g.,InventoryRead,PricingWrite).
- Program.cs: Configures the HTTP pipeline, rate-limiting (strict limits on
- Purpose: A server-rendered Razor Pages application that acts as the back-office and POS terminal.
- Key Components:
- Program.cs: Configures Session state, Anti-forgery tokens, and registers
HttpClientfactories to communicate with theStore.API. - Pages: Mirrors the API domains (e.g.,
Pos.cshtml,BranchAdmin.cshtml,Dashboard.cshtml,StockTransfers.cshtml,RoleMatrix.cshtml). - Design System: Incorporates an Azure-inspired design paradigm (defined in
docs/ui-ui_design.md) featuring blade navigation, dense data tables, command bars, and a Fluent-based styling token set.
- Program.cs: Configures Session state, Anti-forgery tokens, and registers
The platform is designed to handle the end-to-end retail lifecycle:
- Identity & Access Management: Managed via JWT, Users, Roles, and granular Privileges. It tracks users across branches (
UserBranchRole). - Inventory & Warehouse: Handles batches, expiries, stock transfers between branches, goods receipt, wastage (
WastageEntry), and reorder suggestions. - Pricing & Promotions: Rules engine for bundle pricing, customer segment pricing, and manager-overridden discounts.
- Cash Management: Supports cashier shifts, Z-reports, cash variance tracking, and multiple tender types (including Mobile Money integrations).
- Loyalty & Customer Engagement: Manages customer profiles, loyalty points (
CustomerLoyaltyAccount,LoyaltyTransaction), and campaigns. - Procurement: End-to-end purchase orders and supplier management (
PurchaseOrder,Supplier).
- Modular Monolith: Organized clearly into domains to allow future separation into microservices (e.g., Inventory, Payments) if scaling demands it.
- Security-First Approach: Implementation of strict CORS, Rate Limiting,
HttpOnlySameSite=Strictcookies in UI, Anti-forgery, and Audit Logging middleware. - Offline-First Readiness: The API and data model are structured to support idempotency and sync operations for POS terminals facing connectivity issues (crucial for the African market context).
- Resilient Communication: The UI communicates exclusively via an
IApiClientServicelayer, ensuring a clean separation between frontend display and backend data operations.
The codebase is very mature, well-structured, and explicitly aligned with its Software Requirements Specification (SRS). It heavily leverages ASP.NET Core 8 features (like minimal configuration in Program.cs, advanced policy-based authorization, and rate limiting) and provides a highly scalable foundation for a multi-branch retail network.