# developermindset123/arise architecture

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

- Interactive diagram: https://gitdiagram.com/developermindset123/arise
- Repository: https://github.com/developermindset123/arise

## Overview

##### Project type and purpose
- This is a Next.js-based web application (written in TypeScript, using the new App Router) whose goal is to let users generate and customize “manhwa” panels via AI/LLM engines and image-generation backends.
- It packages a UI layer, an “engine” module (business logic, LLM orchestration, censorship, captioning, presets), and client‐side hooks that call out to multiple LLM/image vendors.

##### File structure
- Top level:
– Dockerfile, .env, .nvmrc, .eslintrc.json, tsconfig.json, tailwind.config.cjs, next.config.cjs
- Public/static assets under public/favicon and public/layouts
- src/app: Next.js App Router folder containing:
– engine/ (server-side business logic for caption, censorship, community rules, forbidden‐word filtering, presets, render pipeline)
– interface/ (React pages and UI containers: login, panels, share, settings, modals)
– queries/ (server‐side fetch functions for LLM and image services: OpenAI, Anthropic, HuggingFace, Groq)
– store/ (client-side global state/provider)
– layout.tsx, page.tsx, main.tsx for top‐level app structure
- src/lib: utility functions and small “glue” modules (base64 conversions, canvas/image helpers, prompt builders, JSON cleaners, OAuth helpers, persistence hooks)

##### (minimal) README
– Frontend: Next.js 13 (App Router), React, TypeScript, Tailwind CSS
– Packaging: Docker
– Data: calls out to external LLM/image APIs

##### Elements
– Blue for UI layers
– Green for backend/server modules
– Orange for external services
– Gray for utilities/storage
- Legends and labels:

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Browser (Client)"
        direction TB
        UI_C("UI Containers & Pages"):::ui
        Shared_UI("Shared UI Components & Icons"):::ui
        Styles("Global Styles"):::ui
        Hooks("Client-side Hooks & Persistence"):::util
        Store("Global State Store"):::util
    end

    subgraph "Next.js Server"
        direction TB
        AppRouter("App Router\n(layouts & routes)"):::backend
    end

    UI_C -->|uses| Styles
    UI_C -->|renders| Hooks
    UI_C -->|connects to| Store
    UI_C -->|requests| AppRouter

    subgraph "Engine Module"
        direction TB
        Caption["caption.ts"]:::backend
        Censorship["censorship.ts"]:::backend
        Community["community.ts"]:::backend
        Forbidden["forbidden.ts"]:::backend
        Presets["presets.ts"]:::backend
        Render["render.ts"]:::backend
    end

    AppRouter -->|"calls render pipeline"| Render
    Render --> Caption
    Render --> Censorship
    Render --> Community
    Render --> Forbidden
    Render --> Presets

    subgraph "Queries (LLM/Image)"
        direction TB
        OpenAI["predictWithOpenAI.ts"]:::external
        Anthropic["predictWithAnthropic.ts"]:::external
        Huggingface["predictWithHuggingface.ts"]:::external
        Groq["predictWithGroq.ts"]:::external
    end

    Render --> OpenAI
    Render --> Anthropic
    Render --> Huggingface
    Render --> Groq

    subgraph "Prompt Builders & Post-processors"
        direction TB
        Llama["createLlamaPrompt.ts"]:::util
        Zephyr["createZephyrPrompt.ts"]:::util
        Cleaner["dirtyLLMResponseCleaner.ts"]:::util
        Parser["dirtyGeneratedPanelsParser.ts"]:::util
    end

    Render --> Llama
    Render --> Zephyr
    Render --> Cleaner
    Render --> Parser

    subgraph "Utilities (lib)"
        direction TB
        ImageUtils("Image & Canvas Utilities"):::util
        GeneralUtils("General Utilities"):::util
    end

    Render --> ImageUtils
    Render --> GeneralUtils

    subgraph "External LLM & Image Vendors"
        direction TB
        extOpenAI("OpenAI API"):::external
        extAnthropic("Anthropic API"):::external
        extHugging("HuggingFace API"):::external
        extGroq("Groq API"):::external
    end

    OpenAI -->|HTTPS| extOpenAI
    Anthropic -->|HTTPS| extAnthropic
    Huggingface -->|HTTPS| extHugging
    Groq -->|HTTPS| extGroq

    subgraph "Storage & CDN"
        direction TB
        LocalStorage("Browser localStorage"):::storage
        EnvSecrets("Server env secrets"):::storage
        StaticAssets("Public/Static Assets\nCDN"):::storage
    end

    Hooks --> LocalStorage
    AppRouter --> EnvSecrets
    StaticAssets -->|served via CDN| UI_C

    click AppRouter "https://github.com/developermindset123/arise/blob/main/arise-my-manhwa/src/app/layout.tsx"
    click AppRouter "https://github.com/developermindset123/arise/blob/main/arise-my-manhwa/src/app/page.tsx"
    click AppRouter "https://github.com/developermindset123/arise/blob/main/arise-my-manhwa/src/app/main.tsx"
    click UI_C "https://github.com/developermindset123/arise/tree/main/arise-my-manhwa/src/app/interface/"
    click Shared_UI "https://github.com/developermindset123/arise/tree/main/arise-my-manhwa/src/components/ui/"
    click Shared_UI "https://github.com/developermindset123/arise/tree/main/arise-my-manhwa/src/components/icons/"
    click Styles "https://github.com/developermindset123/arise/blob/main/arise-my-manhwa/src/app/globals.css"
    click Styles "https://github.com/developermindset123/arise/blob/main/arise-my-manhwa/tailwind.config.cjs"
    click Caption "https://github.com/developermindset123/arise/blob/main/arise-my-manhwa/src/app/engine/caption.ts"
    click Censorship "https://github.com/developermindset123/arise/blob/main/arise-my-manhwa/src/app/engine/censorship.ts"
    click Community "https://github.com/developermindset123/arise/blob/main/arise-my-manhwa/src/app/engine/community.ts"
    click Forbidden "https://github.com/developermindset123/arise/blob/main/arise-my-manhwa/src/app/engine/forbidden.ts"
    click Presets "https://github.com/developermindset123/arise/blob/main/arise-my-manhwa/src/app/engine/presets.ts"
    click Render "https://github.com/developermindset123/arise/blob/main/arise-my-manhwa/src/app/engine/render.ts"
    click OpenAI "https://github.com/developermindset123/arise/blob/main/arise-my-manhwa/src/app/queries/predictWithOpenAI.ts"
    click Anthropic "https://github.com/developermindset123/arise/blob/main/arise-my-manhwa/src/app/queries/predictWithAnthropic.ts"
    click Huggingface "https://github.com/developermindset123/arise/blob/main/arise-my-manhwa/src/app/queries/predictWithHuggingface.ts"
    click Groq "https://github.com/developermindset123/arise/blob/main/arise-my-manhwa/src/app/queries/predictWithGroq.ts"
    click Hooks "https://github.com/developermindset123/arise/blob/main/arise-my-manhwa/src/lib/useOAuth.ts"
    click Hooks "https://github.com/developermindset123/arise/blob/main/arise-my-manhwa/src/lib/usePersistedOAuth.ts"
    click Hooks "https://github.com/developermindset123/arise/blob/main/arise-my-manhwa/src/lib/useDynamicConfig.ts"
    click Hooks "https://github.com/developermindset123/arise/blob/main/arise-my-manhwa/src/lib/useLLMVendorConfig.ts"
    click Hooks "https://github.com/developermindset123/arise/blob/main/arise-my-manhwa/src/lib/usePageOrientation.ts"
    click Hooks "https://github.com/developermindset123/arise/blob/main/arise-my-manhwa/src/lib/useShouldDisplayLoginWall.ts"
    click Llama "https://github.com/developermindset123/arise/blob/main/arise-my-manhwa/src/lib/createLlamaPrompt.ts"
    click Zephyr "https://github.com/developermindset123/arise/blob/main/arise-my-manhwa/src/lib/createZephyrPrompt.ts"
    click Cleaner "https://github.com/developermindset123/arise/blob/main/arise-my-manhwa/src/lib/dirtyLLMResponseCleaner.ts"
    click Parser "https://github.com/developermindset123/arise/blob/main/arise-my-manhwa/src/lib/dirtyGeneratedPanelsParser.ts"

    classDef ui fill:#BBDEFB,stroke:#333
    classDef backend fill:#C8E6C9,stroke:#333
    classDef external fill:#FFE0B2,stroke:#333
    classDef util fill:#E0E0E0,stroke:#333
    classDef storage fill:#CFD8DC,stroke:#333
```
