# youceftahir-dev/appalimgen architecture

> Architecture diagram of the GitHub repository youceftahir-dev/appalimgen, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/youceftahir-dev/appalimgen
- Repository: https://github.com/youceftahir-dev/appalimgen

## Overview

El Amine ERP is a Django business application for sales, purchasing, invoicing, inventory, customers and suppliers, expenses, and printing, with a versioned mobile API. The principal workflow is staff using the web application to manage inventory and commercial transactions, with transaction services updating domain records and supporting invoices or print payloads. The graph also preserves the documented API, security, reporting, and backup capabilities. Some subsystem links rely on README descriptions or SOURCE INDEX references; unsampled views and routes limit certainty about their exact runtime wiring.

Main entry points: [`apps/inventory/models.py`](https://github.com/youceftahir-dev/appalimgen/blob/main/apps/inventory/models.py) (Products and stock), [`gestio_stock/urls.py`](https://github.com/youceftahir-dev/appalimgen/blob/main/gestio_stock/urls.py) (ERP web app), [`apps/commerce/services.py`](https://github.com/youceftahir-dev/appalimgen/blob/main/apps/commerce/services.py) (Transaction services), [`apps/api/views.py`](https://github.com/youceftahir-dev/appalimgen/blob/main/apps/api/views.py) (REST API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web and identity"]
  node_webapp["ERP web app<br/>[urls.py]"]
  node_accounts["Accounts and roles<br/>[permissions.py]"]
end

subgraph group_stock["Inventory operations"]
  node_inventory_ui["Inventory workflows<br/>[views.py]"]
  node_inventory_data[("Products and stock<br/>[models.py]")]
  node_stock_services["Stock operations<br/>[services.py]"]
  node_geocoding["Client geocoding<br/>[geocoding.py]"]
  node_pricing["Product pricing<br/>[pricing.py]"]
end

subgraph group_trade["Commerce and expenses"]
  node_commerce_ui["Sales and purchases<br/>[views.py]"]
  node_commerce_data[("Commerce records<br/>[models.py]")]
  node_commerce_services["Transaction services<br/>[services.py]"]
  node_product_search["Product search<br/>[product_search.py]"]
  node_expenses["Expense management<br/>[views.py]"]
  node_expense_data[("Expense records<br/>[models.py]")]
end

subgraph group_platform["Platform services"]
  node_company_audit[("Company and audit data<br/>[models.py]")]
  node_security["Security services<br/>[security.py]"]
  node_dashboard["Dashboard and reports<br/>[dashboard.py]"]
  node_backup["Database backup<br/>[backup.py]"]
end

subgraph group_mobile["Mobile API and printing"]
  node_api["REST API<br/>[views.py]"]
  node_api_auth["JWT authentication<br/>[authentication.py]"]
  node_api_serializers["API serializers<br/>[serializers.py]"]
  node_api_schema["OpenAPI schema<br/>[schema.py]"]
  node_printing[("Printer profiles<br/>[models.py]")]
  node_print_service["Print payloads<br/>[services.py]"]
end

node_staff(("Staff user"))
node_mobile_client(("Mobile/API client"))

node_staff -->|"uses"| node_webapp
node_webapp -.->|"authenticates"| node_accounts
node_webapp -.->|"routes requests"| node_inventory_ui
node_webapp -.->|"routes requests"| node_commerce_ui
node_webapp -.->|"routes requests"| node_expenses
node_inventory_ui -.->|"manages"| node_inventory_data
node_inventory_ui -.->|"uses"| node_geocoding
node_inventory_data -->|"validates prices"| node_pricing
node_inventory_data -.->|"stock changes"| node_stock_services
node_commerce_ui -.->|"processes transactions"| node_commerce_services
node_commerce_services -->|"updates"| node_commerce_data
node_commerce_services -->|"reads stock data"| node_inventory_data
node_commerce_services -->|"gets sale price"| node_pricing
node_commerce_data -->|"references products"| node_inventory_data
node_product_search -->|"searches products"| node_inventory_data
node_product_search -->|"uses pricing"| node_pricing
node_expenses -->|"records expenses"| node_expense_data
node_expenses -->|"checks permissions"| node_accounts
node_expense_data -->|"references suppliers"| node_inventory_data
node_security -->|"writes audit events"| node_company_audit
node_dashboard -.->|"reports activity"| node_company_audit
node_mobile_client -->|"calls API"| node_api
node_api -.->|"authenticates requests"| node_api_auth
node_api -.->|"serializes data"| node_api_serializers
node_api -.->|"documents endpoints"| node_api_schema
node_api_auth -->|"checks shared roles"| node_accounts
node_print_service -->|"builds payloads"| node_printing
node_print_service -.->|"formats invoices"| node_commerce_data
node_print_service -->|"reads company settings"| node_company_audit
node_backup -.->|"backs up database"| node_company_audit

click node_webapp "https://github.com/youceftahir-dev/appalimgen/blob/main/gestio_stock/urls.py"
click node_accounts "https://github.com/youceftahir-dev/appalimgen/blob/main/apps/accounts/permissions.py"
click node_inventory_ui "https://github.com/youceftahir-dev/appalimgen/blob/main/apps/inventory/views.py"
click node_inventory_data "https://github.com/youceftahir-dev/appalimgen/blob/main/apps/inventory/models.py"
click node_stock_services "https://github.com/youceftahir-dev/appalimgen/blob/main/apps/inventory/services.py"
click node_geocoding "https://github.com/youceftahir-dev/appalimgen/blob/main/apps/inventory/geocoding.py"
click node_pricing "https://github.com/youceftahir-dev/appalimgen/blob/main/apps/inventory/pricing.py"
click node_commerce_ui "https://github.com/youceftahir-dev/appalimgen/blob/main/apps/commerce/views.py"
click node_commerce_data "https://github.com/youceftahir-dev/appalimgen/blob/main/apps/commerce/models.py"
click node_commerce_services "https://github.com/youceftahir-dev/appalimgen/blob/main/apps/commerce/services.py"
click node_product_search "https://github.com/youceftahir-dev/appalimgen/blob/main/apps/commerce/product_search.py"
click node_expenses "https://github.com/youceftahir-dev/appalimgen/blob/main/apps/expenses/views.py"
click node_expense_data "https://github.com/youceftahir-dev/appalimgen/blob/main/apps/expenses/models.py"
click node_company_audit "https://github.com/youceftahir-dev/appalimgen/blob/main/apps/core/models.py"
click node_security "https://github.com/youceftahir-dev/appalimgen/blob/main/apps/core/security.py"
click node_dashboard "https://github.com/youceftahir-dev/appalimgen/blob/main/apps/core/dashboard.py"
click node_backup "https://github.com/youceftahir-dev/appalimgen/blob/main/apps/core/backup.py"
click node_api "https://github.com/youceftahir-dev/appalimgen/blob/main/apps/api/views.py"
click node_api_auth "https://github.com/youceftahir-dev/appalimgen/blob/main/apps/api/authentication.py"
click node_api_serializers "https://github.com/youceftahir-dev/appalimgen/blob/main/apps/api/serializers.py"
click node_api_schema "https://github.com/youceftahir-dev/appalimgen/blob/main/apps/api/schema.py"
click node_printing "https://github.com/youceftahir-dev/appalimgen/blob/main/apps/printing/models.py"
click node_print_service "https://github.com/youceftahir-dev/appalimgen/blob/main/apps/printing/services.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_webapp,node_accounts,node_staff,node_mobile_client toneBlue
class node_inventory_ui,node_inventory_data,node_stock_services,node_geocoding,node_pricing toneAmber
class node_commerce_ui,node_commerce_data,node_commerce_services,node_product_search,node_expenses,node_expense_data toneMint
class node_company_audit,node_security,node_dashboard,node_backup toneRose
class node_api,node_api_auth,node_api_serializers,node_api_schema,node_printing,node_print_service toneIndigo
```

## Components

### Web and identity

- [ERP web app](https://github.com/youceftahir-dev/appalimgen/blob/main/gestio_stock/urls.py): `gestio_stock/urls.py`
- [Accounts and roles](https://github.com/youceftahir-dev/appalimgen/blob/main/apps/accounts/permissions.py): `apps/accounts/permissions.py`

### Inventory operations

- [Inventory workflows](https://github.com/youceftahir-dev/appalimgen/blob/main/apps/inventory/views.py): `apps/inventory/views.py`
- [Products and stock](https://github.com/youceftahir-dev/appalimgen/blob/main/apps/inventory/models.py): `apps/inventory/models.py`
- [Stock operations](https://github.com/youceftahir-dev/appalimgen/blob/main/apps/inventory/services.py): `apps/inventory/services.py`
- [Client geocoding](https://github.com/youceftahir-dev/appalimgen/blob/main/apps/inventory/geocoding.py): `apps/inventory/geocoding.py`
- [Product pricing](https://github.com/youceftahir-dev/appalimgen/blob/main/apps/inventory/pricing.py): `apps/inventory/pricing.py`

### Commerce and expenses

- [Sales and purchases](https://github.com/youceftahir-dev/appalimgen/blob/main/apps/commerce/views.py): `apps/commerce/views.py`
- [Commerce records](https://github.com/youceftahir-dev/appalimgen/blob/main/apps/commerce/models.py): `apps/commerce/models.py`
- [Transaction services](https://github.com/youceftahir-dev/appalimgen/blob/main/apps/commerce/services.py): `apps/commerce/services.py`
- [Product search](https://github.com/youceftahir-dev/appalimgen/blob/main/apps/commerce/product_search.py): `apps/commerce/product_search.py`
- [Expense management](https://github.com/youceftahir-dev/appalimgen/blob/main/apps/expenses/views.py): `apps/expenses/views.py`
- [Expense records](https://github.com/youceftahir-dev/appalimgen/blob/main/apps/expenses/models.py): `apps/expenses/models.py`

### Platform services

- [Company and audit data](https://github.com/youceftahir-dev/appalimgen/blob/main/apps/core/models.py): `apps/core/models.py`
- [Security services](https://github.com/youceftahir-dev/appalimgen/blob/main/apps/core/security.py): `apps/core/security.py`
- [Dashboard and reports](https://github.com/youceftahir-dev/appalimgen/blob/main/apps/core/dashboard.py): `apps/core/dashboard.py`
- [Database backup](https://github.com/youceftahir-dev/appalimgen/blob/main/apps/core/backup.py): `apps/core/backup.py`

### Mobile API and printing

- [REST API](https://github.com/youceftahir-dev/appalimgen/blob/main/apps/api/views.py): `apps/api/views.py`
- [JWT authentication](https://github.com/youceftahir-dev/appalimgen/blob/main/apps/api/authentication.py): `apps/api/authentication.py`
- [API serializers](https://github.com/youceftahir-dev/appalimgen/blob/main/apps/api/serializers.py): `apps/api/serializers.py`
- [OpenAPI schema](https://github.com/youceftahir-dev/appalimgen/blob/main/apps/api/schema.py): `apps/api/schema.py`
- [Printer profiles](https://github.com/youceftahir-dev/appalimgen/blob/main/apps/printing/models.py): `apps/printing/models.py`
- [Print payloads](https://github.com/youceftahir-dev/appalimgen/blob/main/apps/printing/services.py): `apps/printing/services.py`

### Other components

- **Staff user**
- **Mobile/API client**

## Connections

- Staff user → ERP web app: uses
- ERP web app → Accounts and roles: authenticates
- ERP web app → Inventory workflows: routes requests
- ERP web app → Sales and purchases: routes requests
- ERP web app → Expense management: routes requests
- Inventory workflows → Products and stock: manages
- Inventory workflows → Client geocoding: uses
- Products and stock → Product pricing: validates prices (evidence: `apps/inventory/models.py`)
- Products and stock → Stock operations: stock changes (evidence: `apps/inventory/services.py`)
- Sales and purchases → Transaction services: processes transactions
- Transaction services → Commerce records: updates (evidence: `apps/commerce/services.py`)
- Transaction services → Products and stock: reads stock data (evidence: `apps/commerce/services.py`)
- Transaction services → Product pricing: gets sale price (evidence: `apps/commerce/services.py`)
- Commerce records → Products and stock: references products (evidence: `apps/commerce/models.py`)
- Product search → Products and stock: searches products (evidence: `apps/commerce/product_search.py`)
- Product search → Product pricing: uses pricing (evidence: `apps/commerce/product_search.py`)
- Expense management → Expense records: records expenses (evidence: `apps/expenses/views.py`)
- Expense management → Accounts and roles: checks permissions (evidence: `apps/expenses/views.py`)
- Expense records → Products and stock: references suppliers (evidence: `apps/expenses/models.py`)
- Security services → Company and audit data: writes audit events (evidence: `apps/core/security.py`)
- Dashboard and reports → Company and audit data: reports activity
- Mobile/API client → REST API: calls API
- REST API → JWT authentication: authenticates requests
- REST API → API serializers: serializes data
- REST API → OpenAPI schema: documents endpoints
- JWT authentication → Accounts and roles: checks shared roles (evidence: `apps/api/authentication.py`)
- Print payloads → Printer profiles: builds payloads (evidence: `apps/printing/services.py`)
- Print payloads → Commerce records: formats invoices
- Print payloads → Company and audit data: reads company settings (evidence: `apps/printing/services.py`)
- Database backup → Company and audit data: backs up database
