# lencodigitexer/photo-portfolio-django architecture

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

- Interactive diagram: https://gitdiagram.com/lencodigitexer/photo-portfolio-django
- Repository: https://github.com/lencodigitexer/photo-portfolio-django

## Overview

##### Project Type & Purpose
- A full-stack Django web application (“photo_portfolio”) for managing and displaying user photos and avatars.

##### Main Components
a. Client (Web Browser/REST Client)
b. Django App Server
- URL Router (photo_portfolio/urls.py + photos/urls.py)
- Views & REST API (photos/views.py + DRF serializers)
- Models & Business Logic (photos/models.py + signals.py + permissions.py)
c. Database (SQLite: db.sqlite3)
d. Media Storage (photo uploads & avatars in photo_portfolio/media)
e. Admin Interface (photos/admin.py)

##### Component Interactions
- Client → HTTP(S) → Django URL Router
- Router dispatches to Views/REST endpoints
- Views use Serializers → translate JSON ↔ Models
- Models ↔ ORM → SQLite
- File uploads/downloads → Media Storage
- Signals trigger side-effects (e.g., thumbnail generation)
- Admin UI ↔ ORM ↔ Database

##### Architectural Patterns & Tech
- MTV (Model-Template-View) / REST API (Django REST Framework)
- Modular “photos” app
- Migrations for schema evolution
- Signal-based hooks for post-save logic

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client
    Browser["Browser/Client"]:::client

    %% Django Application
    subgraph "Django Application"
        direction TB
        Settings["Settings"]:::config
        ASGI["ASGI Entrypoint"]:::infra
        WSGI["WSGI Entrypoint"]:::infra
        Manage["manage.py"]:::infra
        RouterProject["Project URL Router"]:::router
        RouterApp["App URL Router"]:::router
        Views["Views & REST API"]:::view
        Serializers["DRF Serializers"]:::component
        Models["Models & Business Logic"]:::model
        Signals["Signal Handlers"]:::component
        Permissions["Permission Classes"]:::component
        Admin["Admin Interface"]:::admin
        Migrations["Migrations"]:::infra
    end

    %% Database and Storage
    DB["SQLite DB"]:::db
    MediaPhotos["Media: photos"]:::storage
    MediaAvatars["Media: avatars"]:::storage

    %% Flows
    Browser -->|"HTTP(S)"| RouterProject
    RouterProject --> RouterApp
    RouterApp --> Views
    Views -->|uses| Serializers
    Serializers -->|maps JSON↔| Models
    Views -->|calls| Models
    Models <-->|ORM| DB
    Views -->|file I/O| MediaPhotos
    Views -->|file I/O| MediaAvatars
    Models --> Signals
    Admin -->|ORM| Models
    ASGI --> RouterProject
    WSGI --> RouterProject

    %% Click Events
    click RouterProject "https://github.com/lencodigitexer/photo-portfolio-django/blob/main/photo_portfolio/photo_portfolio/urls.py"
    click RouterApp "https://github.com/lencodigitexer/photo-portfolio-django/blob/main/photo_portfolio/photos/urls.py"
    click Views "https://github.com/lencodigitexer/photo-portfolio-django/blob/main/photo_portfolio/photos/views.py"
    click Serializers "https://github.com/lencodigitexer/photo-portfolio-django/blob/main/photo_portfolio/photos/serializers.py"
    click Models "https://github.com/lencodigitexer/photo-portfolio-django/blob/main/photo_portfolio/photos/models.py"
    click Signals "https://github.com/lencodigitexer/photo-portfolio-django/blob/main/photo_portfolio/photos/signals.py"
    click Permissions "https://github.com/lencodigitexer/photo-portfolio-django/blob/main/photo_portfolio/photos/permissions.py"
    click Admin "https://github.com/lencodigitexer/photo-portfolio-django/blob/main/photo_portfolio/photos/admin.py"
    click DB "https://github.com/lencodigitexer/photo-portfolio-django/blob/main/photo_portfolio/db.sqlite3"
    click MediaPhotos "https://github.com/lencodigitexer/photo-portfolio-django/tree/main/photo_portfolio/media/photos"
    click MediaAvatars "https://github.com/lencodigitexer/photo-portfolio-django/tree/main/photo_portfolio/media/avatars"
    click Settings "https://github.com/lencodigitexer/photo-portfolio-django/blob/main/photo_portfolio/photo_portfolio/settings.py"
    click ASGI "https://github.com/lencodigitexer/photo-portfolio-django/blob/main/photo_portfolio/photo_portfolio/asgi.py"
    click WSGI "https://github.com/lencodigitexer/photo-portfolio-django/blob/main/photo_portfolio/photo_portfolio/wsgi.py"
    click Manage "https://github.com/lencodigitexer/photo-portfolio-django/blob/main/photo_portfolio/manage.py"
    click Migrations "https://github.com/lencodigitexer/photo-portfolio-django/tree/main/photo_portfolio/photos/migrations"

    %% Styles
    classDef client fill:#f9f,stroke:#333,stroke-width:2px;
    classDef router fill:#bbf,stroke:#333,stroke-width:2px;
    classDef view fill:#bfb,stroke:#333,stroke-width:2px;
    classDef component fill:#ffd,stroke:#333,stroke-width:2px;
    classDef model fill:#fdd,stroke:#333,stroke-width:2px;
    classDef db fill:#cdf,stroke:#333,stroke-width:2px;
    classDef storage fill:#fcf,stroke:#333,stroke-width:2px;
    classDef admin fill:#fbf,stroke:#333,stroke-width:2px;
    classDef infra fill:#eee,stroke:#333,stroke-width:2px;
    classDef config fill:#eef,stroke:#333,stroke-width:2px;
```
