# sezer-muhammed/anadolu-ajans--medya-teknolojileri-hackathon architecture

> Architecture diagram of the GitHub repository sezer-muhammed/anadolu-ajans--medya-teknolojileri-hackathon, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sezer-muhammed/anadolu-ajans--medya-teknolojileri-hackathon
- Repository: https://github.com/sezer-muhammed/anadolu-ajans--medya-teknolojileri-hackathon

## Overview

##### Main Components
- Web Server / Application Layer: The core Django project is initiated by “manage.py” and sets the context for running the application. This part uses both ASGI (for asynchronous support) and WSGI (for synchronous processing).
- GUI Module: Found under the “GUI” directory, this component handles user interface-related logic. It contains templates (HTML files), static assets (CSS and images), views, forms, and configuration files (like navbar.json, styles.json). It’s responsible for rendering the main website, including the upload page as mentioned in the README.
- API Module: Under the “api” directory, this serves as the back-end REST API layer. It manages endpoints, serializers, validators, migrations, and models which handle backend business logic and integrations (such as OpenAI prompts via openai_interface in both the API and GUI modules).
- Image Generator Module: Under “image_generator”, this specialized module appears dedicated to handling AI-based image generation tasks. It includes its own models, migrations, views, serializers, and configuration files (like image_upload.json). This indicates a focused service within the overall application.
- Database: The “db.sqlite3” file indicates that the project uses a SQLite database for data persistence (though Docker and production setups may adopt a different database engine).
- External Services / Integrations: The project incorporates OpenAI (via openai_prompt.py and openai_interface.py) for AI operations and might use Docker for containerization. These play a crucial role in content creation and possibly image generation.
- Continuous Integration (CI): The presence of a GitHub workflows directory (".github/workflows/django.yml") suggests there is automated testing and deployment enabled.

##### Relationships and Interactions
- The User (via web browser) connects to the web server where the Django framework first handles the request.
- The GUI layer (frontend) serves up HTML pages, static files, and is supported by context processors (e.g., navbar_context_processor.py) for shared data.
- API endpoints (under the “api” folder) serve data requests and act as a bridge between the user interface and backend logic.
- The Image Generator module processes image creation requests, interacting with both the database (for storing records) and external AI services (OpenAI integrative scripts).
- Both the GUI and API modules rely on shared configurations and may invoke the OpenAI interface module to generate or validate AI content.
- All data management flows through Django’s ORM, interacting with the SQLite database (or an alternative DB via Docker in production).
- The .bat script (“AnadoluAjansi.bat”) serves as the entry point for users on Windows to start up the system, likely initializing Docker containers and the Django server.

##### Architectural Patterns and Design Principles
- The project follows the Model-View-Controller (MVC, or the “MTV” pattern in Django terminology) architecture by separating models (data), views (business logic/routing), and templates (presentation).
- Modular design is evident: separate apps (GUI, API, Image Generator) each focus on a specific piece of functionality.
- Use of context processors and configuration files shows a clear separation of concerns for application settings, UI elements, and AI prompt handling.

##### Relevant Technologies, Frameworks and Libraries
- Django Framework: Core of the application with its settings, middleware, URL routing (urls.py), and application configuration.
- SQLite: Used for the development and possibly initial deployment database.
- Docker: For containerization and ensuring consistency across environments.
- WSL & Git: Supporting infrastructure on Windows.
- OpenAI Integration: Scripts and configurations in API and GUI to provide AI-driven features.
- GitHub Actions: As seen in the .github folder, enabling CI/CD for automated testing and deployment.

## Diagram (Mermaid)

```mermaid
flowchart TD
    A["Web Browser"]:::browser
    B["Startup Script (.bat)"]:::script
    subgraph "Web Server & Application Layer"
        C["Manage.py"]:::infrastructure
        D["Django Config (settings,urls,asgi,wsgi)"]:::infrastructure
    end
    E["GUI Module"]:::frontend
    F["API Module"]:::backend
    G["Image Generator Module"]:::backend
    H["SQLite Database"]:::infrastructure
    I["OpenAI (GUI)"]:::external
    J["OpenAI (API)"]:::external
    K["CI/CD (GitHub Actions)"]:::infrastructure

    %% Dataflow between components
    A -->|"initiates"| B
    B -->|"starts"| C
    C -->|"loads"| D
    D -->|"renders"| E
    D -->|"handles"| F
    D -->|"routes"| G
    A -->|"accesses"| E
    E -->|"fetches"| F
    E -->|"calls"| I
    F -->|"calls"| J
    F -->|"CRUD"| H
    G -->|"CRUD"| H
    K -->|"deploys"| C

    %% Click Events
    click B "https://github.com/sezer-muhammed/anadolu-ajans--medya-teknolojileri-hackathon/blob/main/AnadoluAjansiAjansi.bat"
    click C "https://github.com/sezer-muhammed/anadolu-ajans--medya-teknolojileri-hackathon/blob/main/AnadoluAjansiMedyaTeknolojileriWebApp/manage.py"
    click D "https://github.com/sezer-muhammed/anadolu-ajans--medya-teknolojileri-hackathon/tree/main/AnadoluAjansiMedyaTeknolojileriWebApp/AnadoluAjansiMedyaTeknolojileriWebApp/"
    click E "https://github.com/sezer-muhammed/anadolu-ajans--medya-teknolojileri-hackathon/tree/main/AnadoluAjansiMedyaTeknolojileriWebApp/GUI"
    click F "https://github.com/sezer-muhammed/anadolu-ajans--medya-teknolojileri-hackathon/tree/main/AnadoluAjansiMedyaTeknolojileriWebApp/api"
    click G "https://github.com/sezer-muhammed/anadolu-ajans--medya-teknolojileri-hackathon/tree/main/AnadoluAjansiMedyaTeknolojileriWebApp/image_generator"
    click H "https://github.com/sezer-muhammed/anadolu-ajans--medya-teknolojileri-hackathon/blob/main/AnadoluAjansiMedyaTeknolojileriWebApp/db.sqlite3"
    click I "https://github.com/sezer-muhammed/anadolu-ajans--medya-teknolojileri-hackathon/blob/main/AnadoluAjansiMedyaTeknolojileriWebApp/GUI/config/openai_prompt.py"
    click J "https://github.com/sezer-muhammed/anadolu-ajans--medya-teknolojileri-hackathon/blob/main/AnadoluAjansiMedyaTeknolojileriWebApp/api/config/openai_prompt.py"
    click K "https://github.com/sezer-muhammed/anadolu-ajans--medya-teknolojileri-hackathon/blob/main/.github/workflows/django.yml"

    %% Styles
    classDef browser fill:#FFD700,stroke:#333,stroke-width:2px;
    classDef script fill:#D3D3D3,stroke:#333,stroke-width:2px;
    classDef infrastructure fill:#CFC,stroke:#333,stroke-width:2px;
    classDef frontend fill:#F9C,stroke:#333,stroke-width:2px;
    classDef backend fill:#CCF,stroke:#333,stroke-width:2px;
    classDef external fill:#F99,stroke:#333,stroke-width:2px;
```
