# akzarma/enterpriseresourceplanning architecture

> Architecture diagram of the GitHub repository akzarma/enterpriseresourceplanning, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/akzarma/enterpriseresourceplanning
- Repository: https://github.com/akzarma/enterpriseresourceplanning

## Overview

##### Project type and purpose
- This is a monolithic, full-stack ERP system built with Django.
- It provides a web interface (Django templates + static JS/CSS) and exposes APIs for a mobile (Android) client.
- Domain-specific Django apps encapsulate functions like Attendance, Registration, Exam, Timetable, Research, etc.

##### File structure
- Top-level “EnterpriseResourcePlanning/” directory:
- settings.py, urls.py, wsgi.py — the Django project entry point.
- manage.py — Django CLI.
- One Django app per feature under the root:
- Attendance, Registration, Exam, Feedback, Internship, Timetable, BackupRestore, Dashboard, Research, etc.
- Each app contains models.py, views.py, urls.py, templates/, static/ (where applicable), and migrations/.
- Supporting files:
- celerybeat-schedule & .pid — Celery periodic tasks.
- Sync/ — JSON cert and a function for data synchronization.
- Configuration/ — application-wide configs (countryConf.py, stateConf.py).
- templates/ at root: global base.html, alert.html, loading.css.
- requirements.txt, runtime.txt, Procfile — deployment descriptors (Heroku/Gunicorn).

##### README
- Confirms it’s an ERP system with both mobile (Android) and web interfaces.

##### Key components and interactions
a. Clients
- Web browser (HTML/CSS/JS)
- Android mobile app (consumes REST API endpoints)
b. Web Server Layer
- Django application
- URL router → App modules (Attendance, Registration, Exam, …)
- View logic → Templates (HTML) for web, JSON for mobile clients
- Configuration module (Configuration/countryConf.py, stateConf.py)
c. Data Layer
- Primary relational database (SQLite in development, likely Postgres/MySQL in production)
- Backup/Restore subsystem (BackupRestore app writes/reads .sqlite3 dumps)
d. Asynchronous/Task Layer
- Celery workers (tasks defined in Timetable/tasks.py and others)
- Message broker (e.g., Redis or RabbitMQ)
- celerybeat scheduler for periodic jobs (e.g., backups, notifications)
e. Static & Media
- Static files served via Django’s staticfiles (Dashboard/static/)
- Template files under each app and global templates/
f. External Services
- Email/SMS gateways for notifications (hinted by Dashboard notifications)
- Possible third-party APIs for Sync/function.py

##### Architectural patterns & principles
- MVC (Django’s MTV): models.py → templates/ → views.py
- Modular app decomposition: each business domain in its own Django app
- Asynchronous processing via Celery for long-running tasks (timetable generation, backups)
- Configuration-driven setup via Python modules (Configuration/)
- Separation of concerns: UI (templates/static), business logic (views/forms), data (models), integration (Sync, BackupRestore)

##### Detail
- Major Django apps as sub-components of the server.
- Celery beat scheduler as a timed trigger to Celery tasks.
- Global templates/ and static/ directories as part of the view layer.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Clients
    Web["Web Browser"]:::client
    Mobile["Android App"]:::client

    %% Server Monolith
    subgraph "Django Monolith" 
        direction TB
        %% Core
        subgraph "Core"
            direction TB
            Settings["settings.py"]:::server
            URLRouter["urls.py"]:::server
            WSGI["wsgi.py"]:::server
            Manage["manage.py"]:::server
        end

        %% View Layer
        subgraph "View Layer"
            direction TB
            Templates["templates/"]:::server
            Static["static/"]:::server
        end

        %% Business Logic & Apps
        subgraph "Apps & Business Logic"
            direction TB
            Attendance["Attendance App"]:::server
            Registration["Registration App"]:::server
            Exam["Exam App"]:::server
            Feedback["Feedback App"]:::server
            Internship["Internship App"]:::server
            Timetable["Timetable App"]:::server
            Dashboard["Dashboard App"]:::server
            BackupRestore["Backup & Restore"]:::server
            Research["Research App"]:::server
            Report["Report App"]:::server
            Requests["Requests App"]:::server
            Roles["Roles App"]:::server
            Update["Update App"]:::server
            Login["Login App"]:::server
            General["General Utility"]:::server
        end

        %% Utilities
        subgraph "Utilities"
            direction TB
            Configuration["Configuration Module"]:::server
            Sync["Data Sync Module"]:::server
        end
    end

    %% Data Layer
    DB["Relational Database"]:::datastore
    FileStorage["Backup File Storage"]:::datastore

    %% Async Layer
    Broker["Message Broker\n(Redis/RabbitMQ)"]:::async
    Celery["Celery Worker"]:::async
    Scheduler["Celery Beat Scheduler"]:::async

    %% External Services
    External1["Email/SMS Gateway"]:::external
    External2["Third-Party APIs"]:::external

    %% Connections
    Web -->|HTTP/HTTPS| Django
    Mobile -->|REST API| Django
    Django -->|ORM calls| DB
    DB -->|dump/restore| FileStorage
    Django -->|enqueue tasks| Broker
    Broker -->|deliver tasks| Celery
    Scheduler -->|trigger tasks| Broker
    Django -->|send notifications| External1
    Celery -->|send notifications| External1
    Django -->|call APIs| External2

    %% Click Events
    click Settings "https://github.com/akzarma/enterpriseresourceplanning/blob/dev/EnterpriseResourcePlanning/settings.py"
    click URLRouter "https://github.com/akzarma/enterpriseresourceplanning/blob/dev/EnterpriseResourcePlanning/urls.py"
    click WSGI "https://github.com/akzarma/enterpriseresourceplanning/blob/dev/EnterpriseResourcePlanning/wsgi.py"
    click Manage "https://github.com/akzarma/enterpriseresourceplanning/blob/dev/manage.py"
    click Attendance "https://github.com/akzarma/enterpriseresourceplanning/tree/dev/Attendance/"
    click Registration "https://github.com/akzarma/enterpriseresourceplanning/tree/dev/Registration/"
    click Exam "https://github.com/akzarma/enterpriseresourceplanning/tree/dev/Exam/"
    click Feedback "https://github.com/akzarma/enterpriseresourceplanning/tree/dev/Feedback/"
    click Internship "https://github.com/akzarma/enterpriseresourceplanning/tree/dev/Internship/"
    click Timetable "https://github.com/akzarma/enterpriseresourceplanning/tree/dev/Timetable/"
    click Dashboard "https://github.com/akzarma/enterpriseresourceplanning/tree/dev/Dashboard/"
    click BackupRestore "https://github.com/akzarma/enterpriseresourceplanning/tree/dev/BackupRestore/"
    click Research "https://github.com/akzarma/enterpriseresourceplanning/tree/dev/Research/"
    click Report "https://github.com/akzarma/enterpriseresourceplanning/tree/dev/Report/"
    click Requests "https://github.com/akzarma/enterpriseresourceplanning/tree/dev/Requests/"
    click Roles "https://github.com/akzarma/enterpriseresourceplanning/tree/dev/Roles/"
    click Update "https://github.com/akzarma/enterpriseresourceplanning/tree/dev/Update/"
    click Login "https://github.com/akzarma/enterpriseresourceplanning/tree/dev/Login/"
    click General "https://github.com/akzarma/enterpriseresourceplanning/tree/dev/General/"
    click Configuration "https://github.com/akzarma/enterpriseresourceplanning/tree/dev/Configuration/"
    click Sync "https://github.com/akzarma/enterpriseresourceplanning/tree/dev/Sync/"
    click Templates "https://github.com/akzarma/enterpriseresourceplanning/tree/dev/templates/"

    %% Styles
    classDef client fill:#ADD8E6,stroke:#000,color:#000
    classDef server fill:#90EE90,stroke:#000,color:#000
    classDef async fill:#FFA500,stroke:#000,color:#000
    classDef datastore fill:#A9A9A9,stroke:#000,color:#000
    classDef external fill:#DDA0DD,stroke:#000,color:#000
```
