# skoll69/rq6-enemy-generator architecture

> Architecture diagram of the GitHub repository skoll69/rq6-enemy-generator, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/skoll69/rq6-enemy-generator
- Repository: https://github.com/skoll69/rq6-enemy-generator

## Overview

##### Main Components

a. Web Application Layer:
- Django Framework (Core Application)
- Template Engine (evidenced by extensive templates directory)
- Static Files Handler
- URL Router

b. Core Features:
- Enemy Generation System
- Party Management
- Template Management
- User Authentication System
- PDF/PNG Export Service (WeasyPrint integration)

c. Data Layer:
- Database (mentioned in settings configuration)
- Static File Storage

**[Client Layer]**
- ↑↓
**[Application Layer]**
- ↑↓
**[Data Layer]**

##### Detailed Component Breakdown

Client Layer:
- Static assets (JS, CSS, Images)
- AJAX interactions (evidenced by ajax.py)

Application Layer (Main Django Components):
- URL Router (urls.py)
- View Controllers
- Regular Views (views.py)
- Admin Views (admin.py)
- Registration Views (reg_views.py)
- Core Logic
- Enemy Generator (enemygen_lib.py)
- Dice System (dice.py)
- Template Processing
- Authentication System
- PDF/PNG Export Service

Data Layer:
- Database (show tables from models.py)
- File Storage (for temporary files)

##### Key Interactions to Illustrate

- User authentication flow
- Enemy generation process
- Template management
- Export functionality
- Party management

##### Additional Elements

- Component types
- Authentication boundaries
- File storage areas

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        Browser["Web Browser"]
        StaticAssets["Static Assets"]:::static
    end

    subgraph "Application Layer"
        Django["Django Core"]:::core
        click Django "https://github.com/skoll69/RQ6-Enemy-Generator/tree/master/mythras_eg/"

        subgraph "URL Routing"
            MainURLs["Main URLs"]:::router
            AppURLs["App URLs"]:::router
            click MainURLs "https://github.com/skoll69/RQ6-Enemy-Generator/blob/master/mythras_eg/urls.py"
            click AppURLs "https://github.com/skoll69/RQ6-Enemy-Generator/blob/master/enemygen/urls.py"
        end

        subgraph "View Controllers"
            Views["Views"]:::controller
            ViewsLib["Views Library"]:::controller
            AjaxViews["Ajax Handler"]:::controller
            click Views "https://github.com/skoll69/RQ6-Enemy-Generator/blob/master/enemygen/views.py"
            click ViewsLib "https://github.com/skoll69/RQ6-Enemy-Generator/blob/master/enemygen/views_lib.py"
            click AjaxViews "https://github.com/skoll69/RQ6-Enemy-Generator/blob/master/enemygen/ajax.py"
        end

        subgraph "Core Features"
            EnemyGen["Enemy Generator"]:::core
            DiceSystem["Dice System"]:::core
            click EnemyGen "https://github.com/skoll69/RQ6-Enemy-Generator/blob/master/enemygen/enemygen_lib.py"
            click DiceSystem "https://github.com/skoll69/RQ6-Enemy-Generator/blob/master/enemygen/dice.py"
        end

        subgraph "Template System"
            Templates["Templates"]:::template
            PartyTemplates["Party Templates"]:::template
            EnemyTemplates["Enemy Templates"]:::template
            click Templates "https://github.com/skoll69/RQ6-Enemy-Generator/tree/master/enemygen/templates/"
            click PartyTemplates "https://github.com/skoll69/RQ6-Enemy-Generator/blob/master/enemygen/templates/party.html"
            click EnemyTemplates "https://github.com/skoll69/RQ6-Enemy-Generator/blob/master/enemygen/templates/enemy_template.html"
        end

        subgraph "Authentication"
            Auth["Authentication System"]:::auth
            RegViews["Registration Views"]:::auth
            click Auth "https://github.com/skoll69/RQ6-Enemy-Generator/tree/master/templates/registration/"
            click RegViews "https://github.com/skoll69/RQ6-Enemy-Generator/blob/master/enemygen/reg_views.py"
        end

        Admin["Admin Interface"]:::admin
        click Admin "https://github.com/skoll69/RQ6-Enemy-Generator/blob/master/enemygen/admin.py"

        PDFExport["PDF/PNG Export"]:::export
    end

    subgraph "Data Layer"
        DB[(Database)]:::database
        Models["Data Models"]:::database
        FileStorage["File Storage"]:::storage
        click Models "https://github.com/skoll69/RQ6-Enemy-Generator/blob/master/enemygen/models.py"
    end

    subgraph "Client Logic"
        ClientJS["Enemy Gen JS"]:::clientjs
        HelperJS["Helper Functions"]:::clientjs
        click ClientJS "https://github.com/skoll69/RQ6-Enemy-Generator/blob/master/static/js/enemygen.js"
        click HelperJS "https://github.com/skoll69/RQ6-Enemy-Generator/blob/master/static/js/helpers.js"
    end

    %% Connections
    Browser --> StaticAssets
    Browser --> MainURLs
    MainURLs --> AppURLs
    AppURLs --> Views
    Views --> ViewsLib
    Views --> AjaxViews
    Views --> EnemyGen
    EnemyGen --> DiceSystem
    Views --> Templates
    Templates --> PartyTemplates
    Templates --> EnemyTemplates
    Auth --> RegViews
    Views --> PDFExport
    Views --> Models
    Models --> DB
    PDFExport --> FileStorage
    Browser --> ClientJS
    ClientJS --> HelperJS

    %% Styles
    classDef core fill:#2196F3,stroke:#1565C0,color:white
    classDef router fill:#FF9800,stroke:#F57C00,color:white
    classDef controller fill:#4CAF50,stroke:#388E3C,color:white
    classDef template fill:#9C27B0,stroke:#7B1FA2,color:white
    classDef auth fill:#F44336,stroke:#D32F2F,color:white
    classDef admin fill:#795548,stroke:#5D4037,color:white
    classDef database fill:#FFC107,stroke:#FFA000,color:black
    classDef storage fill:#607D8B,stroke:#455A64,color:white
    classDef export fill:#00BCD4,stroke:#0097A7,color:white
    classDef static fill:#9E9E9E,stroke:#616161,color:white
    classDef clientjs fill:#3F51B5,stroke:#303F9F,color:white
```
