# kutver/codentino architecture

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

- Interactive diagram: https://gitdiagram.com/kutver/codentino
- Repository: https://github.com/kutver/codentino

## Overview

##### Main Components Identification

The system consists of several key components that should be represented:

a. Frontend Layer:
- Static Files (CSS, JS, favicon)
- Templates (Blog, Components, Flatpages, Social Account)
- Client Browser

b. Backend Layer:
- Django Applications:
- Blog App (Posts, Series, Comments)
- Tag App (Nested Tags)
- User App (Authentication)
- Django Core (Settings, URLs, WSGI/ASGI)

c. Infrastructure Layer:
- Nginx (Reverse Proxy)
- PostgreSQL Database
- Certbot (SSL/TLS)

**[Client Layer]**
- ↕️
**[Web Server Layer (Nginx)]**
- ↕️
**[Application Layer (Django)]**
- ↕️
**[Database Layer (PostgreSQL)]**

##### Component Details

a. Client Layer:
- Browser connecting through HTTPS
- Static asset serving path
- Social login flow (Google OAuth)

b. Web Server Layer:
- Nginx as reverse proxy
- SSL/TLS termination
- Static file serving

c. Application Layer:
- Django Apps:
- Blog (show models: Post, Series, Comment)
- Tag (show nested tag structure)
- User (show authentication flow)
- Template rendering flow
- Form processing

d. Database Layer:
- PostgreSQL database
- Key relationships between models

##### Relationships to Highlight

- URL routing from Nginx to Django
- Template rendering flow
- Database relationships between Posts, Series, and Tags
- Authentication flow with social providers
- Static file serving path

##### Additional Elements

Supporting elements:
- Version information
- Environment separation (dev/prod)
- Security components (SSL/TLS)

##### Technical Details

- Docker container boundaries
- Network isolation
- Volume mounts for persistent data
- Environment variable configuration

Remember to include a clear indication of the development versus production environments, as they have different configurations (especially regarding Nginx and SSL/TLS handling).

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        Browser["Web Browser"]:::client
    end

    subgraph WebServer["Web Server Layer"]
        Nginx["Nginx Reverse Proxy"]:::server
        Certbot["Certbot SSL/TLS"]:::security
        click Nginx "https://github.com/kutver/codentino/blob/main/nginx/nginx.conf"
        click Certbot "https://github.com/kutver/codentino/tree/main/certbot/"
    end

    subgraph Django["Django Application Layer"]
        DjangoCore["Django Core"]:::core
        click DjangoCore "https://github.com/kutver/codentino/blob/main/django/codentino/settings.py"

        subgraph Apps["Django Apps"]
            Blog["Blog App"]:::app
            Tag["Tag App"]:::app
            User["User App"]:::app
            click Blog "https://github.com/kutver/codentino/tree/main/django/codentino/apps/blog/models/"
            click Tag "https://github.com/kutver/codentino/blob/main/django/codentino/apps/tag/models.py"
            click User "https://github.com/kutver/codentino/blob/main/django/codentino/apps/user/models.py"
        end

        subgraph Templates["Template Layer"]
            BaseTemplates["Base Templates"]:::template
            BlogTemplates["Blog Templates"]:::template
            AuthTemplates["Auth Templates"]:::template
            TagTemplates["Tag Templates"]:::template
            click BaseTemplates "https://github.com/kutver/codentino/blob/main/django/templates/components/base.html"
            click BlogTemplates "https://github.com/kutver/codentino/tree/main/django/templates/blog/"
            click AuthTemplates "https://github.com/kutver/codentino/tree/main/django/templates/socialaccount/"
            click TagTemplates "https://github.com/kutver/codentino/tree/main/django/templates/tag/"
        end

        subgraph Static["Static Assets"]
            CSS["CSS Files"]:::static
            JS["JavaScript Files"]:::static
            Favicon["Favicon"]:::static
            click CSS "https://github.com/kutver/codentino/blob/main/django/static/codentino.css"
            click JS "https://github.com/kutver/codentino/blob/main/django/static/prism.js"
            click Favicon "https://github.com/kutver/codentino/tree/main/django/static/favicon/"
        end
    end

    subgraph Database
        PostgreSQL["PostgreSQL"]:::database
    end

    %% Connections
    Browser --> |HTTPS| Nginx
    Nginx --> |Proxy| DjangoCore
    Nginx --> |Serve| Static
    Certbot --> |SSL| Nginx

    DjangoCore --> |Render| Templates
    DjangoCore --> |Use| Apps
    Blog --> PostgreSQL
    Tag --> PostgreSQL
    User --> PostgreSQL

    %% Styles
    classDef client fill:#3498db,stroke:#2980b9,color:white
    classDef server fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef security fill:#e74c3c,stroke:#c0392b,color:white
    classDef core fill:#2ecc71,stroke:#27ae60,color:white
    classDef app fill:#3498db,stroke:#2980b9,color:white
    classDef template fill:#f1c40f,stroke:#f39c12,color:white
    classDef static fill:#9b59b6,stroke:#8e44ad,color:white
    classDef database fill:#e67e22,stroke:#d35400,color:white

    %% Legend
    subgraph Legend
        Client_["Client"]:::client
        Server["Server"]:::server
        Security["Security"]:::security
        Core["Core"]:::core
        App["Application"]:::app
        Template["Template"]:::template
        Static_["Static"]:::static
        DB["Database"]:::database
    end
```
