# raycast/ray-so architecture

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

- Interactive diagram: https://gitdiagram.com/raycast/ray-so
- Repository: https://github.com/raycast/ray-so

## Overview

##### High-Level Architecture Components

The system should be represented with these main components:

a) Frontend Layer:
- Next.js Application (Core)
- Navigation Structure
- Tool-specific Modules:
- Code Image Generator
- Prompt Explorer
- Preset Explorer
- Quicklink Explorer
- Snippet Explorer
- Theme Explorer

b) API Layer:
- REST API endpoints (/api directory)
- External Services Integration

c) Data Storage:
- Static Data (JSON files for themes, prompts, etc.)
- File System (for assets and generated content)

##### Component Relationships

**[Client Browser] ←→ [Next.js Frontend]**
- ↓
- [API Routes]
- ↓
- [Data Sources]
- Theme Files
- Prompt Configs
- Snippet Storage
- Asset Storage

##### Specific Implementation Details

a) Core Application Structure (Rectangle):
- Navigation Layout (/app/(navigation))
- Global Components (/components)
- Utility Functions (/utils)

b) Tool Modules (Hexagons):
- Each tool should be represented as a separate module
- Their specific components and assets
- Their dedicated API routes

c) Shared Resources (Ovals):
- Global CSS
- Common Components
- Utility Functions
- Asset Storage

##### Data Flow Representation

- Client-Server Communication
- Internal Component Communication
- API Interactions
- Asset Loading Paths

##### Key Technical Aspects to Highlight

- Next.js 13+ App Router Structure
- API Route Implementation
- Static Asset Handling
- Theme Generation Pipeline
- Image Processing Features

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        Browser[Browser/Client]
    end

    subgraph "Next.js Application"
        Core["Core Application"]:::core
        Layout["Layout Structure"]:::layout
        Nav["Navigation Structure"]:::nav
        GlobalCSS["Global Styles"]:::styles
        GlobalComp["Global Components"]:::components
        Utils["Utility Functions"]:::utils
    end

    subgraph "Tool Modules"
        CodeGen["Code Image Generator"]:::tool
        IconMaker["Icon Maker"]:::tool
        PromptExp["Prompt Explorer"]:::tool
        PresetExp["Preset Explorer"]:::tool
        QuickExp["Quicklink Explorer"]:::tool
        SnipExp["Snippet Explorer"]:::tool
        ThemeExp["Theme Explorer"]:::tool
    end

    subgraph "API Layer"
        API["API Routes"]:::api
        ConfigAPI["Config API"]:::api
        PresetsAPI["Presets API"]:::api
        PromptsAPI["Prompts API"]:::api
        QuicklinksAPI["Quicklinks API"]:::api
        SnippetsAPI["Snippets API"]:::api
        ThemesAPI["Themes API"]:::api
    end

    subgraph "Data Storage"
        ThemeData["Theme Data"]:::storage
        StaticAssets["Static Assets"]:::storage
        FileSystem["File System"]:::storage
    end

    %% Connections
    Browser --> Core
    Core --> Layout
    Layout --> Nav
    Core --> GlobalCSS
    Core --> GlobalComp
    Core --> Utils

    Nav --> CodeGen
    Nav --> IconMaker
    Nav --> PromptExp
    Nav --> PresetExp
    Nav --> QuickExp
    Nav --> SnipExp
    Nav --> ThemeExp

    CodeGen --> API
    IconMaker --> API
    PromptExp --> API
    PresetExp --> API
    QuickExp --> API
    SnipExp --> API
    ThemeExp --> API

    API --> ConfigAPI
    API --> PresetsAPI
    API --> PromptsAPI
    API --> QuicklinksAPI
    API --> SnippetsAPI
    API --> ThemesAPI

    API --> ThemeData
    API --> StaticAssets
    API --> FileSystem

    %% Styles
    classDef core fill:#f9f,stroke:#333
    classDef layout fill:#ffd,stroke:#333
    classDef nav fill:#dfd,stroke:#333
    classDef styles fill:#ddf,stroke:#333
    classDef components fill:#fdf,stroke:#333
    classDef utils fill:#dff,stroke:#333
    classDef tool fill:#ffd,stroke:#333
    classDef api fill:#ddf,stroke:#333
    classDef storage fill:#ffd,stroke:#333

    %% Click Events
    click CodeGen "https://github.com/raycast/ray-so/tree/main/app/(navigation)/(code)"
    click IconMaker "https://github.com/raycast/ray-so/tree/main/app/(navigation)/icon"
    click PromptExp "https://github.com/raycast/ray-so/tree/main/app/(navigation)/prompts"
    click PresetExp "https://github.com/raycast/ray-so/tree/main/app/(navigation)/presets"
    click QuickExp "https://github.com/raycast/ray-so/tree/main/app/(navigation)/quicklinks"
    click SnipExp "https://github.com/raycast/ray-so/tree/main/app/(navigation)/snippets"
    click ThemeExp "https://github.com/raycast/ray-so/tree/main/app/(navigation)/themes"
    click API "https://github.com/raycast/ray-so/tree/main/app/api"
    click Nav "https://github.com/raycast/ray-so/blob/main/components/navigation.tsx"
    click GlobalComp "https://github.com/raycast/ray-so/tree/main/components"
    click Utils "https://github.com/raycast/ray-so/tree/main/utils"
    click ThemeData "https://github.com/raycast/ray-so/tree/main/app/(navigation)/themes/themes"
    click Layout "https://github.com/raycast/ray-so/blob/main/app/components/layout.tsx"
    click Core "https://github.com/raycast/ray-so/blob/main/app/layout.tsx"
    click GlobalCSS "https://github.com/raycast/ray-so/blob/main/app/globals.css"
    click ConfigAPI "https://github.com/raycast/ray-so/blob/main/app/api/config/route.ts"
    click PresetsAPI "https://github.com/raycast/ray-so/blob/main/app/api/presets/route.ts"
    click PromptsAPI "https://github.com/raycast/ray-so/blob/main/app/api/prompts/route.ts"
    click QuicklinksAPI "https://github.com/raycast/ray-so/blob/main/app/api/quicklinks/route.ts"
    click SnippetsAPI "https://github.com/raycast/ray-so/blob/main/app/api/snippets/route.ts"
    click ThemesAPI "https://github.com/raycast/ray-so/blob/main/app/api/themes/route.ts"
```
