# ahnopologetic/vebatim architecture

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

- Interactive diagram: https://gitdiagram.com/ahnopologetic/vebatim
- Repository: https://github.com/ahnopologetic/vebatim

## Overview

##### Main Components Identification

a) Figma Widget Layer
- Widget UI Components
- Event Management Interface
- IFrame Communication System

b) Core Application Layer
- Event Definition System
- Data Contract Management
- State Management

c) Integration Layer
- Figma API Integration
- External Services Communication

**┌─────────────────────────────────────────────┐**
- Figma Layer                 │
- (Widget Container & Integration Context)   │
- ┤
- Widget Application             │
- (Event Management & User Interface)      │
- ┤
- Integration Layer               │
- (Data Contracts & External Services)     │
- ┘

##### Detailed Component Breakdown

For each major section, include:

a) Widget Layer (src/widget):
- Relationship between code.tsx and pages
- Hooks system (use-modal, use-widget-init)
- UI components hierarchy
- Event handling system

b) IFrame Layer (src/iframes):
- Routing system
- Page components
- Context management
- Communication patterns with main widget

c) Shared Components:
- Message types
- Style system
- Type definitions
- Usecases implementation

##### Data Flow Indicators

- Event creation flow
- Data synchronization
- User interaction paths
- External communication

##### Implementation Details

- React component structure
- TypeScript type system
- Tailwind CSS integration
- Build system flow

##### Key Relationships to Highlight

- Widget-to-Figma communication
- IFrame-to-Widget communication
- Event data flow
- User interaction patterns

##### Technical Stack Representation

Symbols for:
- TypeScript
- React
- Tailwind CSS
- Vite
- Figma Widget API

##### Architectural Patterns

Highlight:
- Component-based architecture
- Context-based state management
- Use-case driven design
- Message-based communication

This system design should help developers understand:
- How components interact
- Where state is managed
- How events flow through the system
- How the widget integrates with Figma
- Where to find specific functionality

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Figma_Layer
        FigmaAPI[Figma API]
        WidgetContainer["Widget Container"]:::core
        click WidgetContainer "https://github.com/ahnopologetic/vebatim/blob/main/vebatim-widget/src/widget/code.tsx"
    end

    subgraph Widget_Application
        EventWidget["Event Management Interface"]:::core
        click EventWidget "https://github.com/ahnopologetic/vebatim/blob/main/vebatim-widget/src/widget/pages/event-widget.tsx"
        
        subgraph UI_Components
            Components["UI Components Library"]:::ui
            click Components "https://github.com/ahnopologetic/vebatim/tree/main/vebatim-widget/src/widget/lib/ui/components/"
            StyleSystem["Style System"]:::ui
            click StyleSystem "https://github.com/ahnopologetic/vebatim/tree/main/vebatim-widget/src/widget/shared/styles/"
        end

        subgraph State_Management
            Hooks["Hook System"]:::state
            click Hooks "https://github.com/ahnopologetic/vebatim/tree/main/vebatim-widget/src/widget/hooks/"
            WidgetInit["Widget Initialization"]:::state
            click WidgetInit "https://github.com/ahnopologetic/vebatim/blob/main/vebatim-widget/src/widget/hooks/use-widget-init.ts"
            ModalManagement["Modal Management"]:::state
            click ModalManagement "https://github.com/ahnopologetic/vebatim/blob/main/vebatim-widget/src/widget/hooks/use-modal.ts"
        end

        subgraph Core_Systems
            EventDefinition["Event Definition System"]:::core
            click EventDefinition "https://github.com/ahnopologetic/vebatim/blob/main/vebatim-widget/src/widget/shared/types.ts"
            DataContracts["Data Contract Management"]:::core
            click DataContracts "https://github.com/ahnopologetic/vebatim/tree/main/vebatim-widget/src/widget/usecases/"
        end
    end

    subgraph Integration_Layer
        subgraph IFrame_System
            IFrameComm["IFrame Communication"]:::comm
            click IFrameComm "https://github.com/ahnopologetic/vebatim/blob/main/vebatim-widget/src/widget/shared/message-types.ts"
            IFramePages["Integration Pages"]:::ui
            click IFramePages "https://github.com/ahnopologetic/vebatim/tree/main/vebatim-widget/src/iframes/pages/"
            AppContext["Application Context"]:::state
            click AppContext "https://github.com/ahnopologetic/vebatim/blob/main/vebatim-widget/src/iframes/lib/contexts/app.tsx"
            Router["Routing System"]:::comm
            click Router "https://github.com/ahnopologetic/vebatim/tree/main/vebatim-widget/src/iframes/app/routes/"
            Layout["IFrame Layout"]:::ui
            click Layout "https://github.com/ahnopologetic/vebatim/blob/main/vebatim-widget/src/iframes/components/ui/layout.tsx"
        end

        EventCreation["Event Creation Flow"]:::flow
        click EventCreation "https://github.com/ahnopologetic/vebatim/blob/main/vebatim-widget/src/iframes/pages/create-event.tsx"
    end

    %% Relationships
    FigmaAPI <--> WidgetContainer
    WidgetContainer --> EventWidget
    EventWidget --> Components
    Components --> StyleSystem
    EventWidget --> Hooks
    Hooks --> WidgetInit
    Hooks --> ModalManagement
    EventWidget --> EventDefinition
    EventDefinition --> DataContracts
    IFrameComm <--> WidgetContainer
    IFrameComm <--> IFramePages
    IFramePages --> AppContext
    IFramePages --> Router
    IFramePages --> Layout
    EventCreation --> IFrameComm
    EventCreation --> DataContracts

    %% Styles
    classDef core fill:#2563eb,color:white
    classDef ui fill:#22c55e,color:white
    classDef state fill:#9333ea,color:white
    classDef comm fill:#f97316,color:white
    classDef flow fill:#64748b,color:white

    %% Legend
    subgraph Legend
        CoreComponent["Core Components"]:::core
        UIComponent["UI Components"]:::ui
        StateComponent["State Management"]:::state
        CommComponent["Communication"]:::comm
        FlowComponent["Flow Control"]:::flow
    end
```
