# cpayne624/dokno architecture

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

- Interactive diagram: https://gitdiagram.com/cpayne624/dokno
- Repository: https://github.com/cpayne624/dokno

## Overview

##### Main Components

a) Core Engine Components:
- Models Layer
- Article
- Category
- ArticleSlug
- Log
- Controllers Layer
- Articles Controller
- Categories Controller
- Views Layer
- Article views
- Category views
- Shared partials

b) Integration Components:
- Host Rails Application
- Database
- User Authentication System (configurable)

**┌─ Host Rails Application ─────────────────────────────────┐**

- ┌─ Dokno Engine ──────────────────────────────────┐    │

- ┌─ Controllers ─┐    ┌─ Models ──────────┐    │    │
- Articles      │    │ Article           │    │    │
- Categories    │◄───►│ Category         │    │    │
- ┘    │ ArticleSlug       │    │    │
- ▲           │ Log               │    │    │
- ┘    │    │
- ▲              │    │

- ┌─ Views ───┐              │              │    │
- Articles  │              │              │    │
- Categories│              │              │    │
- Partials  │              │              │    │
- ┘              ▼              │    │
- ┌─ Database ─┐        │    │
- ┘        │    │
- ┘    │
- ▲                          │

- ┌─ User System ─┐    │     ┌─ Asset Pipeline ─┐│
- (Configurable)│◄───┘     │ JS & CSS         ││
- ┘           └─────────────────┘│
- ┘

##### Key Relationships to Highlight
- Mount point integration with host Rails app
- Database interactions through ActiveRecord
- User authentication integration
- Asset pipeline integration
- MVC pattern within the engine

##### Important Implementation Details
- Engine's namespace (Dokno::)
- Mount point configuration
- Article panel integration point
- Markdown processing flow

##### Additional Elements
- Notes about configuration options
- External dependencies (redcarpet and diffy)

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Host["Host Rails Application"]
        UserAuth["User Authentication System"]:::external
        Assets["Asset Pipeline"]:::host
        
        subgraph Engine["Dokno Engine"]
            Config["Configuration"]:::config
            
            subgraph Controllers["Controllers Layer"]
                ArticlesCtrl["Articles Controller"]:::controller
                CategoriesCtrl["Categories Controller"]:::controller
            end
            
            subgraph Models["Models Layer"]
                Article["Article"]:::model
                Category["Category"]:::model
                ArticleSlug["ArticleSlug"]:::model
                Log["Log"]:::model
            end
            
            subgraph Views["Views Layer"]
                ArticleViews["Article Views"]:::view
                CategoryViews["Category Views"]:::view
                Partials["Shared Partials"]:::view
                Panel["Article Panel"]:::view
            end
            
            DB[(Database)]:::database
        end
    end
    
    %% Relationships
    ArticlesCtrl --> Article
    ArticlesCtrl --> Category
    CategoriesCtrl --> Category
    
    Article --> DB
    Category --> DB
    ArticleSlug --> DB
    Log --> DB
    
    ArticlesCtrl --> ArticleViews
    CategoriesCtrl --> CategoryViews
    
    UserAuth -.-> Controllers
    Assets --> Views
    
    Panel --> Article
    
    %% Click Events
    click Article "https://github.com/cpayne624/dokno/blob/master/app/models/dokno/article.rb"
    click Category "https://github.com/cpayne624/dokno/blob/master/app/models/dokno/category.rb"
    click ArticleSlug "https://github.com/cpayne624/dokno/blob/master/app/models/dokno/article_slug.rb"
    click Log "https://github.com/cpayne624/dokno/blob/master/app/models/dokno/log.rb"
    click ArticlesCtrl "https://github.com/cpayne624/dokno/blob/master/app/controllers/dokno/articles_controller.rb"
    click CategoriesCtrl "https://github.com/cpayne624/dokno/blob/master/app/controllers/dokno/categories_controller.rb"
    click ArticleViews "https://github.com/cpayne624/dokno/tree/master/app/views/dokno/articles/"
    click CategoryViews "https://github.com/cpayne624/dokno/tree/master/app/views/dokno/categories/"
    click Partials "https://github.com/cpayne624/dokno/tree/master/app/views/partials/"
    click Engine "https://github.com/cpayne624/dokno/blob/master/lib/dokno/engine.rb"
    click DB "https://github.com/cpayne624/dokno/tree/master/db/migrate/"
    click UserAuth "https://github.com/cpayne624/dokno/blob/master/app/controllers/dokno/user_concern.rb"
    click Assets "https://github.com/cpayne624/dokno/blob/master/app/assets/javascripts/dokno/application.js"
    click Config "https://github.com/cpayne624/dokno/blob/master/lib/dokno/config/config.rb"
    click Panel "https://github.com/cpayne624/dokno/blob/master/app/views/dokno/_article_panel.html.erb"
    
    %% Styles
    classDef model fill:#a8d0e6,stroke:#333
    classDef controller fill:#8fb8de,stroke:#333
    classDef view fill:#f8e9a1,stroke:#333
    classDef database fill:#f76c6c,stroke:#333
    classDef config fill:#a8e6cf,stroke:#333
    classDef external fill:#374785,stroke:#333,color:#fff
    classDef host fill:#24305e,stroke:#333,color:#fff
    
    %% Legend
    subgraph Legend
        ModelLegend["Model"]:::model
        ControllerLegend["Controller"]:::controller
        ViewLegend["View"]:::view
        DBLegend["Database"]:::database
        ConfigLegend["Configuration"]:::config
        ExtLegend["External System"]:::external
        HostLegend["Host Component"]:::host
    end
```
