# mandipadk/evoloke architecture

> Architecture diagram of the GitHub repository mandipadk/evoloke, 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/mandipadk/evoloke
- Repository: https://github.com/mandipadk/evoloke

## Overview

##### Project Type and Purpose
- Evoloke is a full-stack, interactive web application that leverages the Next.js framework for both server-side rendering and client-side interactivity.
- It focuses on delivering immersive storytelling experiences featuring branching narratives, visual story flows, and responsive design with dark/light mode support.
- The project contains both a user-facing interface (for reading and interacting with stories) and an admin interface (for managing stories).

##### Main Components & Their Roles
a. User-Facing Frontend (Story Display):
- Represented by the files in the src/app/story and src/app/stories directories.
- Includes pages (page.tsx for landing and individual story display) that manage the interactive display of story content.
- Leverages reusable UI components (in src/components and src/components/ui) e.g., for navigation, theming, and story flow visualization.

b. Administrative Frontend (Story Management):
- Located under src/app/admin and its subdirectories, such as the stories folder with [id] pages.
- Supports story management tasks like creation, editing, or previewing of interactive stories.

c. Data Layer (Story Content Storage):
- Found under src/data/stories, where story-specific data (JSON or script files) is stored.
- Although Evoloke currently uses static files for story data, this layer is crucial for feeding content into the application.

d. Shared Library and Utility Functions:
- The src/lib directory contains utilities (e.g., stories.ts, utils.ts) that likely handle data transformations or business logic around story flow and navigation.
- The src/types directory adds static type definitions which improve code robustness and clarity.

e. UI Components and Themes:
- The src/components directory includes common elements such as the navbar, story flow indicator, theme provider, and toggle.
- These components help maintain a consistent look, feel, and responsive behavior across the application.

f. Configuration and Static Assets:
- Next.js configurations (next.config.ts), ESLint, Tailwind, and PostCSS files which orchestrate the project build and styling setup.
- The public folder serves static assets like images (e.g., the screenshot for the digital whispers story).

##### Relationships and Interactions
- There is a clear separation of concerns: the presentation layer (Next.js pages and React components) interacts with the data layer (static story data) through shared libraries and utility functions.
- The administrative interface (admin pages) is segregated from the user-facing story pages, implying a design that controls based on user roles or access levels.
- The theme provider and UI components are injected across both aspects for a consistent user experience.
- Next.js internals manage the routing by file system, so pages under [id] directories imply dynamic content based on URL parameters.

##### Architectural Patterns and Design Principles
- Next.js File-Based Routing: Emphasize the convention of mapping directories (like app/story or app/admin) directly to URL routes.
- Component Reusability: Identify how UI components (like navbar, theme toggles, and story-flow components) are used across pages.
- Separation between Content and Presentation: Data stored in src/data/ is decoupled from UI rendering logic, following modular design principles.
- Responsive and Themed UI: Incorporate the theme provider and custom styling via Tailwind CSS as part of the presentation layer.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User-Facing Frontend
    subgraph "User-Facing Frontend"
        StoryDisplay["Story Page"]:::frontend
        StoryListing["Story Listing"]:::frontend
    end

    %% Administrative Frontend
    subgraph "Admin Frontend"
        AdminInterface["Admin Interface"]:::admin
        AdminListing["Admin Story Listings"]:::admin
        AdminDetail["Admin Story Detail"]:::admin
    end

    %% Core Libraries
    subgraph "Core Libraries"
        SharedUtils["Shared Utilities"]:::core
        TypeDefs["Type Definitions"]:::core
    end

    %% Data Layer
    subgraph "Data Layer"
        StoryData["Story Data"]:::data
    end

    %% UI Components & Themes
    subgraph "UI Components"
        UIComponents["UI Components"]:::ui
        UISpecialized["UI Specialized"]:::ui
    end

    %% Configuration & Assets
    subgraph "Configuration & Assets"
        Config["Configuration & Build"]:::config
        PublicAssets["Public Assets"]:::config
        GlobalStyles["Global Styles"]:::config
    end

    %% Relationships: Data flows from Data Layer into Core Libraries
    StoryData -->|"feeds"| SharedUtils
    SharedUtils -->|"processes"| TypeDefs

    %% Frontend: Shared utilities drive the User-Facing components
    SharedUtils -->|"supplies data"| StoryDisplay
    SharedUtils -->|"supplies data"| StoryListing

    %% Admin: Shared utilities power the Admin interfaces
    SharedUtils -->|"supplies data"| AdminInterface
    SharedUtils -->|"supplies data"| AdminListing
    SharedUtils -->|"supplies data"| AdminDetail

    %% UI Components are integrated into both frontends
    UIComponents -->|"renders UI"| StoryDisplay
    UIComponents -->|"renders UI"| StoryListing
    UIComponents -->|"renders UI"| AdminInterface
    UIComponents -->|"renders UI"| AdminListing
    UIComponents -->|"renders UI"| AdminDetail
    UISpecialized -->|"enhances UI"| StoryDisplay
    UISpecialized -->|"enhances UI"| AdminInterface

    %% Configuration supports overall application setup
    Config -->|"configures"| StoryDisplay
    Config -->|"configures"| AdminInterface
    GlobalStyles -->|"styles"| UIComponents
    PublicAssets -->|"provides assets"| UIComponents

    %% Class Definitions for Colors and Styles
    classDef frontend fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef admin fill:#FFDAB9,stroke:#000,stroke-width:2px;
    classDef core fill:#C1FFC1,stroke:#000,stroke-width:2px;
    classDef data fill:#E0FFFF,stroke:#000,stroke-width:2px;
    classDef ui fill:#FFB6C1,stroke:#000,stroke-width:2px;
    classDef config fill:#D3D3D3,stroke:#000,stroke-width:2px;

    %% Click Events for Component Mapping
    click StoryDisplay "https://github.com/mandipadk/evoloke/tree/main/src/app/story"
    click StoryListing "https://github.com/mandipadk/evoloke/tree/main/src/app/stories"
    click AdminInterface "https://github.com/mandipadk/evoloke/tree/main/src/app/admin"
    click AdminListing "https://github.com/mandipadk/evoloke/tree/main/src/app/admin/stories"
    click AdminDetail "https://github.com/mandipadk/evoloke/tree/main/src/app/admin/stories/[id]"
    click StoryData "https://github.com/mandipadk/evoloke/tree/main/src/data/stories"
    click SharedUtils "https://github.com/mandipadk/evoloke/tree/main/src/lib"
    click TypeDefs "https://github.com/mandipadk/evoloke/tree/main/src/types"
    click UIComponents "https://github.com/mandipadk/evoloke/tree/main/src/components"
    click UISpecialized "https://github.com/mandipadk/evoloke/tree/main/src/components/ui"
    click Config "https://github.com/mandipadk/evoloke/blob/main/next.config.ts"
    click PublicAssets "https://github.com/mandipadk/evoloke/tree/main/public"
    click GlobalStyles "https://github.com/mandipadk/evoloke/blob/main/src/app/globals.css"
```
