# zostera/django-icons architecture

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

- Interactive diagram: https://gitdiagram.com/zostera/django-icons
- Repository: https://github.com/zostera/django-icons

## Overview

##### Project type and purpose
- It is not a standalone web service but a library/plugin that hooks into Django’s template engine and settings system.

##### File structure
- Top-level:
- pyproject.toml, setup/configuration files (tox.ini, justfile, GitHub workflows)
- README.md, docs/ (Sphinx docs), example/ (demo Django project), tests/
- src/django_icons/:
- core.py: central registry and logic
- css.py: CSS-related helpers
- example/: a small Django project showing plugin usage (settings.py → INSTALLED_APPS + DJANGO_ICONS, template files, manage.py)
- tests/: unit tests for each renderer, core functionality, template tags

##### README for additional insights
- Shows how to configure DJANGO_ICONS in settings.py
- Mentions extension by subclassing IconRenderer

##### Elements
- “Django App Server”
- “IconRegistry (core.py)”
- “Browser”
- From Settings → IconRegistry
- From Template Tag → IconRegistry → Renderer → HTML output
- From Browser → External Assets
- Another for “external dependencies” (CSS libraries, image assets)
- A different style for “runtime environment” (browser)

## Diagram (Mermaid)

```mermaid
flowchart TD
    DjangoAppServer["Django App Server"]:::backend

    subgraph "django-icons App"
        Settings["Settings Loader & IconRegistry\n(core.py)"]:::backend
        CSS["CSS Helpers\n(css.py)"]:::backend
        TemplateTag["Template Tag\n(templatetags/icons.py)"]:::backend
        Interface["IconRenderer Interface\n(icon.py)"]:::interface
        subgraph "Renderers"
            Boot["Bootstrap3 Renderer\n(bootstrap3.py)"]:::interface
            FA["FontAwesome4 Renderer\n(fontawesome4.py)"]:::interface
            Mat["Material Icons Renderer\n(material.py)"]:::interface
            Img["Image Renderer\n(image.py)"]:::interface
        end
    end

    subgraph "Example Project"
        ExampleSettings["Example: Settings\n(settings.py)"]:::backend
        ExampleCustom["Example: Custom Renderer\n(app/renderers.py)"]:::interface
        ExampleBase["Example: Template\n(base.html)"]:::runtime
        ExampleHome["Example: Template\n(home.html)"]:::runtime
    end

    subgraph Docs
        DocsSettings["Docs: settings.rst"]:::external
        DocsRenderers["Docs: renderers.rst"]:::external
        DocsTemplatetags["Docs: templatetags.rst"]:::external
    end

    ExternalAssets["External Icon Assets/CSS/JS"]:::external
    Browser["Browser"]:::runtime

    DjangoAppServer -->|"startup: load settings"| Settings
    ExampleSettings -->|"demo config"| Settings
    DocsSettings --> Settings

    TemplateTag -->|"lookup icon"| Settings
    DocsTemplatetags --> TemplateTag

    Settings -->|"select renderer"| Interface
    DocsRenderers --> Interface
    ExampleCustom -->|"extends interface"| Interface

    Interface -->|"render()"| Boot
    Interface -->|"render()"| FA
    Interface -->|"render()"| Mat
    Interface -->|"render()"| Img

    Boot -->|"use CSS helpers"| CSS
    FA -->|"use CSS helpers"| CSS
    Mat -->|"use CSS helpers"| CSS

    Boot --> TemplateTag
    FA --> TemplateTag
    Mat --> TemplateTag
    Img --> TemplateTag

    TemplateTag -->|"send HTML"| Browser
    ExampleBase -->|"uses tag"| TemplateTag
    ExampleHome -->|"uses tag"| TemplateTag

    Browser -->|"load CSS/assets"| ExternalAssets

    click Settings "https://github.com/zostera/django-icons/blob/main/src/django_icons/core.py"
    click CSS "https://github.com/zostera/django-icons/blob/main/src/django_icons/css.py"
    click Interface "https://github.com/zostera/django-icons/blob/main/src/django_icons/renderers/icon.py"
    click Boot "https://github.com/zostera/django-icons/blob/main/src/django_icons/renderers/bootstrap3.py"
    click FA "https://github.com/zostera/django-icons/blob/main/src/django_icons/renderers/fontawesome4.py"
    click Mat "https://github.com/zostera/django-icons/blob/main/src/django_icons/renderers/material.py"
    click Img "https://github.com/zostera/django-icons/blob/main/src/django_icons/renderers/image.py"
    click TemplateTag "https://github.com/zostera/django-icons/blob/main/src/django_icons/templatetags/icons.py"
    click ExampleSettings "https://github.com/zostera/django-icons/blob/main/example/settings.py"
    click ExampleCustom "https://github.com/zostera/django-icons/blob/main/example/app/renderers.py"
    click ExampleBase "https://github.com/zostera/django-icons/blob/main/example/templates/base.html"
    click ExampleHome "https://github.com/zostera/django-icons/blob/main/example/templates/home.html"
    click DocsSettings "https://github.com/zostera/django-icons/blob/main/docs/settings.rst"
    click DocsRenderers "https://github.com/zostera/django-icons/blob/main/docs/renderers.rst"
    click DocsTemplatetags "https://github.com/zostera/django-icons/blob/main/docs/templatetags.rst"

    classDef backend fill:#E3F2FD,stroke:#90CAF9,color:#0D47A1
    classDef interface fill:#E8F5E9,stroke:#66BB6A,color:#1B5E20
    classDef external fill:#FFF8E1,stroke:#FFEB3B,color:#F57F17
    classDef runtime fill:#F3E5F5,stroke:#CE93D8,color:#4A148C
```
