# shaharmeer/portfolio architecture

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

- Interactive diagram: https://gitdiagram.com/shaharmeer/portfolio
- Repository: https://github.com/shaharmeer/portfolio

## Overview

##### Main Components
- Django Web Server: Representing the core of your application. Include components such as:
- Django Application “myapp” (controllers in views.py, models, URLs, and templates for the user interface).
- The main project configuration in the “myceleryproject” directory (settings, WSGI, ASGI).
- Celery Components:
- Celery Worker: Executes tasks asynchronously (configured via myceleryproject/celery.py and defined tasks in myapp/tasks.py).
- Celery Beat Scheduler: Responsible for sending periodic tasks to the message broker.
- Database: SQLite (shown as “db.sqlite3” after migrations) used for storing application data.

##### Relationships and Interactions
- Interaction between Celery Beat and the message broker, noting that Celery Beat pushes scheduled task messages to the broker.
- Communication between the Celery Worker and the broker, illustrating that workers consume task messages from it.

##### Architectural Patterns and Technologies
- That the project employs the MVC (or MVT – Model, View, Template in Django) pattern, where:
- Models handle the data structure (myapp/models.py).
- Views (myapp/views.py) process requests.
- Templates (within myapp/templates/myapp) render the frontend.
- Microservice-like behavior for task processing: while Django handles standard synchronous web requests, Celery manages asynchronous background tasks.
- Dependencies like:
- Django for the web framework.
- Celery for task scheduling and distributed asynchronous processing.
- SQLite for database storage.
- And implicitly, a message broker (RabbitMQ/Redis) for Celery’s messaging (even if it is not explicitly set up in the provided file structure).

- Specify that the separation between components is key: distinguishing between synchronous operations (handled by Django) and asynchronous processing (handled by Celery).
- Use of configuration files (like myceleryproject/celery.py and Django’s settings.py) which are pivotal in linking the Django server to the Celery system.
- Deployment scripts (e.g., manage.py, migration steps) as side-notes to illustrate initialization and startup procedures, but keep the focus on the overall architecture.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User / Frontend
    subgraph "User / Frontend"
        U["User Request"]:::frontend
    end

    %% Django Web Server
    subgraph "Django Web Server"
        subgraph "Project Configuration"
            DS["settings.py"]:::django
            DW["wsgi.py"]:::django
            DA["asgi.py"]:::django
        end
        subgraph "Application Logic (myapp)"
            V["views.py"]:::django
            M["models.py"]:::django
            ULS["urls.py"]:::django
            T1["templates/home.html"]:::django
            T2["templates/result.html"]:::django
            A["admin.py"]:::django
        end
    end

    %% Celery Components
    subgraph "Celery Components"
        CW["Celery Worker"]:::celery
        CB["Celery Beat Scheduler"]:::celery
        CT["Task Definitions"]:::celery
    end

    %% Infrastructure
    subgraph "Infrastructure"
        DB["Database (SQLite)"]:::database
        MB["Message Broker"]:::broker
    end

    %% Connections
    U -->|"sends_request"| V
    V -->|"offloads_task"| CT
    CT -->|"executed_by"| CW
    V -->|"data_operation"| DB
    CB -->|"pushes_message"| MB
    MB -->|"consumed_by"| CW

    %% Click Events for Django Web Server
    click DS "https://github.com/shaharmeer/portfolio/blob/main/myceleryproject/settings.py"
    click DW "https://github.com/shaharmeer/portfolio/blob/main/myceleryproject/wsgi.py"
    click DA "https://github.com/shaharmeer/portfolio/blob/main/myceleryproject/asgi.py"
    click V "https://github.com/shaharmeer/portfolio/blob/main/myapp/views.py"
    click M "https://github.com/shaharmeer/portfolio/blob/main/myapp/models.py"
    click ULS "https://github.com/shaharmeer/portfolio/blob/main/myapp/urls.py"
    click T1 "https://github.com/shaharmeer/portfolio/blob/main/myapp/templates/myapp/home.html"
    click T2 "https://github.com/shaharmeer/portfolio/blob/main/myapp/templates/myapp/result.html"
    click A "https://github.com/shaharmeer/portfolio/blob/main/myapp/admin.py"

    %% Click Events for Celery Components
    click CW "https://github.com/shaharmeer/portfolio/blob/main/myceleryproject/celery.py"
    click CT "https://github.com/shaharmeer/portfolio/blob/main/myapp/tasks.py"
    click CB "https://github.com/shaharmeer/portfolio/tree/main/celerybeat-schedule"

    %% Click Event for Database
    click DB "https://github.com/shaharmeer/portfolio/blob/main/db.sqlite3"

    %% Classes for styling
    classDef django fill:#AED6F1,stroke:#1B4F72,stroke-width:2px;
    classDef celery fill:#F9E79F,stroke:#B7950B,stroke-width:2px;
    classDef database fill:#82E0AA,stroke:#117A65,stroke-width:2px;
    classDef broker fill:#F5CBA7,stroke:#D35400,stroke-width:2px;
    classDef frontend fill:#F1948A,stroke:#922B21,stroke-width:2px;
```
