# 67au/ornacodex architecture

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

- Interactive diagram: https://gitdiagram.com/67au/ornacodex
- Repository: https://github.com/67au/ornacodex

## Overview

##### PROJECT TYPE & PURPOSE
- This is a front-end, single-page application (SPA) built with Vue.js (using components, plugins, and state management) for a specialized codex.
- Its purpose is to provide a richer experience for browsing and comparing data related to the OrnaRPG codex. It pulls data using an internal API client, integrates with third-party services (such as OrnaGuide), and includes specialized tools for search, comparison, and calculation (e.g., gear quality, guild certificates).

##### KEY COMPONENTS & ARCHITECTURAL SECTIONS
- Browser / Client: The end user interacts with the application via the web browser.
- Entry Point:
- index.html loads the Vue application.
- main.ts (under src/) bootstraps the app.
- Presentation/UI Layer:
- App.vue (the root component).
- Views: Found in src/views (e.g., HomeView, CodexView, ShareView) that represent different “pages”.
- Layout: MainLayout.vue in src/pages encapsulates common UI structure.
- Components Layer:
- A rich component folder under src/components with subdirectories indicating modularity (Header, Home, CodexEntry, Popup, Utils).
- Each folder (like CodexEntry or Header) groups related components (e.g., AbilityCard, BestialBondCard, AppThemeSwitch, etc.).
- Routing Layer:
- Vue Router configuration in src/router/index.ts.
- Determines how users navigate between views.
- State Management:
- Stores located under src/stores (several files for codex, compare, entriesList, etc.) for maintaining application state.
- Plugins & Utilities:
- Found in src/plugins, which include modules for various functionalities like assess, codex, filters, guide, proof, and extra utilities.
- Global plugins (src/plugins/global.ts) and helper functions unify common actions across components.
- Internationalization (i18n):
- The src/i18n folder manages localization including locale.json and index.ts.
- Styling & Assets:
- Assets in src/assets (including JSON data files).
- Type Declarations & Enums:
- Declarations in files like auto-imports.d.ts, components.d.ts, and src/enums for standardized types.

##### EXTERNAL DATA & INTEGRATIONS
- Data Sources:
- The codex data comes from the official OrnaRPG Codex and uses tools like Codex Crawler.
- Additional data is fetched via the OrnaGuide API client.
- External Links:
- The README includes references to Official and OrnaGuide websites.
- Tools:
- There’s an inbuilt “YACO 品质查询工具” for gear quality and comparison functions.

##### ARCHITECTURAL PATTERNS & DESIGN PRINCIPLES
- Component-Based Architecture: The project is organized into small, self-contained Vue components.
- Modularization: Separation of concerns is visible – routes, stores, plugins, views, and components are all isolated.
- Single-Page Application Pattern: Navigation is controlled on the client side using Vue Router.
- Extensibility: The use of plugins and stores facilitates the addition of new features without major rewrites.

## Diagram (Mermaid)

```mermaid
flowchart TD
    Browser["Browser: index.html"]:::browser
    MainTS["Entry Point: main.ts"]:::entry
    App["Vue App: App.vue"]:::app

    subgraph "UI Layer: Views"
        HomeView["Home View"]:::views
        CodexView["Codex View"]:::views
        ShareView["Share View"]:::views
        MainLayout["Main Layout: MainLayout.vue"]:::views
    end

    subgraph "Components Layer"
        Header["Header Components"]:::components
        CodexEntry["CodexEntry Components"]:::components
        Popup["Popup Components"]:::components
        HomeComp["Home Components"]:::components
        Utils["Utility Components"]:::components
    end

    Router["Vue Router"]:::routing
    Stores["State Stores"]:::state
    Plugins["Plugins & Utilities"]:::plugins
    Intl["Internationalization"]:::i18n
    Assets["Assets"]:::assets
    Styles["Styles"]:::assets
    Types["Types & Enums"]:::types
    External["External APIs"]:::external

    %% Primary Flow
    Browser -->|"loads"| MainTS
    MainTS -->|"bootstraps"| App

    %% Application initialization and configuration resources
    App -->|"initializes"| Router
    App -->|"loads"| Intl
    App -->|"applies"| Assets
    App -->|"applies"| Styles
    App -->|"utilizes"| Types

    %% Routing to UI Views
    Router -->|"renders"| HomeView
    Router -->|"renders"| CodexView
    Router -->|"renders"| ShareView

    %% Main layout wraps the views
    HomeView -->|"contained in"| MainLayout
    CodexView -->|"contained in"| MainLayout
    ShareView -->|"contained in"| MainLayout

    %% Views integrating Components
    HomeView -->|"composes"| Header
    HomeView -->|"composes"| CodexEntry
    HomeView -->|"composes"| Popup
    HomeView -->|"composes"| HomeComp
    HomeView -->|"composes"| Utils

    %% Components interactions with state and plugins
    Header ---|"state_update"| Stores
    CodexEntry ---|"state_update"| Stores
    Popup ---|"state_update"| Stores
    HomeComp ---|"state_update"| Stores
    Utils ---|"state_update"| Stores

    Header ---|"fetch_data"| Plugins
    CodexEntry ---|"fetch_data"| Plugins
    Popup ---|"fetch_data"| Plugins
    HomeComp ---|"fetch_data"| Plugins
    Utils ---|"fetch_data"| Plugins

    %% Plugins interacting with External APIs
    Plugins -->|"data_request"| External

    %% Click Events
    click Browser "https://github.com/67au/ornacodex/blob/main/index.html"
    click MainTS "https://github.com/67au/ornacodex/blob/main/src/main.ts"
    click App "https://github.com/67au/ornacodex/blob/main/src/App.vue"
    click HomeView "https://github.com/67au/ornacodex/blob/main/src/views/HomeView.vue"
    click CodexView "https://github.com/67au/ornacodex/blob/main/src/views/CodexView.vue"
    click ShareView "https://github.com/67au/ornacodex/blob/main/src/views/ShareView.vue"
    click MainLayout "https://github.com/67au/ornacodex/blob/main/src/pages/MainLayout.vue"
    click Header "https://github.com/67au/ornacodex/tree/main/src/components/Header"
    click CodexEntry "https://github.com/67au/ornacodex/tree/main/src/components/CodexEntry"
    click Popup "https://github.com/67au/ornacodex/tree/main/src/components/Popup"
    click HomeComp "https://github.com/67au/ornacodex/tree/main/src/components/Home"
    click Utils "https://github.com/67au/ornacodex/tree/main/src/components/Utils"
    click Router "https://github.com/67au/ornacodex/blob/main/src/router/index.ts"
    click Stores "https://github.com/67au/ornacodex/tree/main/src/stores"
    click Plugins "https://github.com/67au/ornacodex/tree/main/src/plugins"
    click Intl "https://github.com/67au/ornacodex/tree/main/src/i18n"
    click Assets "https://github.com/67au/ornacodex/tree/main/src/assets"
    click Styles "https://github.com/67au/ornacodex/tree/main/src/styles"
    click Types "https://github.com/67au/ornacodex/tree/main/src/enums"

    %% Styles
    classDef browser fill:#fce94f,stroke:#555,stroke-width:2px;
    classDef entry fill:#8ae234,stroke:#555,stroke-width:2px;
    classDef app fill:#729fcf,stroke:#555,stroke-width:2px;
    classDef views fill:#ad7fa8,stroke:#555,stroke-width:2px;
    classDef components fill:#fcaf3e,stroke:#555,stroke-width:2px;
    classDef routing fill:#e9b96e,stroke:#555,stroke-width:2px;
    classDef state fill:#ef2929,stroke:#555,stroke-width:2px;
    classDef plugins fill:#8ae234,stroke:#555,stroke-width:2px;
    classDef i18n fill:#fce94f,stroke:#555,stroke-width:2px;
    classDef assets fill:#edd400,stroke:#555,stroke-width:2px;
    classDef types fill:#729fcf,stroke:#555,stroke-width:2px;
    classDef external fill:#8faaff,stroke:#555,stroke-width:2px;
```
