# roke-to/roketo-ui architecture

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

- Interactive diagram: https://gitdiagram.com/roke-to/roketo-ui
- Repository: https://github.com/roke-to/roketo-ui

## Overview

##### Project Overview and Purpose
- This is a decentralized application (dApp) that serves as the front-end for the Roketo ecosystem.
- Its primary role is to interface with the Roketo contracts and Roketo APIs (external blockchain contracts and backend services) and offer a rich user interface for managing streams, authorizations, NFT interactions, and fund transfers.
- Since the README emphasizes prerequisites such as the Roketo contract and API, the dApp itself is clearly a client-side application built with modern tooling (Vite, React using TypeScript, etc.) for interacting with blockchain components.

##### File Structure to Identify Main Components
- Configuration and Environment:
- Files like .env, .env.mainnet, .env.testnet and configuration files for Vite, Babel, ESLint, and prettier indicate that the application supports multiple deployment modes (mainnet vs testnet) and robust code quality checks.
- Testing and CI/CD:
- Cypress tests (integration and support files) and Playwright tests, along with GitHub Actions workflows, represent the automated testing and deployment strategies.
- Frontend Application:
- The “src/” folder is the largest part of the repo. It includes:
∙ /app – entry point and main styles.
∙ /entities – domain objects (e.g., wallet, blur, screen).
∙ /features – modular features (authorization, add-funds, create-stream, legacy integrations) that represent specific business domains or UI components.
∙ /pages – route-based view components (for streams, NFT transfers, archived streams, etc.), indicating a typical single-page application (SPA) with various pages.
∙ /shared – shared utilities, API interfaces (for example, interacting with eco, near, price oracle, and roketo API endpoints), common UI components, hooks, and libraries.
∙ /widgets – smaller composite widgets like header, footer, notifications, and profile components.
- External Dependencies/Interfacing:
- There are key integrations with the Roketo contract and APIs, meaning that there is an external dependency layer that this frontend communicates with via API calls and possibly direct blockchain interactions (through contract API wrappers and endpoints).

##### Main Components and Their Relationships
- Frontend User Interface:
- The “src/app”, “src/pages”, “src/features”, “src/widgets”, and “src/shared/ui” directories form the user interface.
- Domain Entities and Business Logic:
- The “src/entities”, “src/features”, and parts of “src/shared” provide the domain logic to manage things like streams, wallets, NFT interactions, fund transfers, etc.
- As independent modules that encapsulate business rules and data modeling.
- API and External Service Interfaces:
- The API layer under “src/shared/api”, “src/features/legacy/api”, and similar subdirectories indicates external communication with blockchain contracts, pricing oracle, and Roketo API contracts.
- Testing & CI/CD Pipeline:
- Although not part of the runtime application, tests (cypress, playwright, unit tests) and CI/CD configurations (GitHub workflows) are part of the overall system development architecture.
- These can be noted as supporting the quality and deployment pipeline.
- Environment & Build Configurations:
- Configuration management aspect (Vite, Babel, PostCSS, environment variable files) as the build and deployment environment that caters to both development and production (mainnet/testnet) workflows.

##### Architectural Patterns and Design Principles
- Modular and Feature-Based Architecture:
- The “features” and “pages” directories suggest a modular approach where each feature is self-contained—including its UI, styles, and models.
- Separation of Concerns:
- Clear distinctions between UI components (shared/ui, widgets), business logic (entities, features), and inter-service communication (shared/api) illustrate separation of concerns.
- Responsive Design and Modern Tooling:
- Usage of ViteJS, Tailwind, SCSS, and a component-based design (React components) should be highlighted.

##### Steps for the Principal Software Engineer
- Detail each component with its respective directory components:
- For example, indicate that “src/pages” composes the routing and view layer.
- “src/features” encapsulates modular functional areas, and “src/shared” contains the cross-cutting concerns (components, hooks, API utilities).
- Testing and CI/CD aspects in a side panel to show how code quality and deployments are maintained.
- Finally, include annotations such as “Mainnet Build Mode” vs “Testnet Build Mode” to represent environment-specific configurations.

## Diagram (Mermaid)

```mermaid
graph TD
    %% Configuration & Build Configurations
    subgraph "Configuration & Build Configurations"
        conf["Env & Config Files"]:::config
    end
    click conf "https://github.com/roke-to/roketo-ui/blob/master/.env"

    %% Testing & CI/CD Pipeline
    subgraph "Testing & CI/CD Pipeline"
        cypress["Cypress Tests"]:::testing
        playwright["Playwright Config"]:::testing
        tests["Unit & Integration Tests"]:::testing
        github["GitHub Workflows"]:::testing
        husky["Husky Pre-commit"]:::testing
    end
    click cypress "https://github.com/roke-to/roketo-ui/tree/master/cypress/"
    click playwright "https://github.com/roke-to/roketo-ui/blob/master/playwright.config.ts"
    click tests "https://github.com/roke-to/roketo-ui/tree/master/tests/"
    click github "https://github.com/roke-to/roketo-ui/tree/master/.github/workflows"
    click husky "https://github.com/roke-to/roketo-ui/tree/master/husky/"

    %% Frontend UI Layer
    subgraph "Frontend UI Layer"
        app["App Entry & Styling (src/app)"]:::ui
        pages["Pages (Routing & Views) (src/pages)"]:::ui
        features["Feature Modules (src/features)"]:::ui
        widgets["Widgets (src/widgets)"]:::ui
        sharedUI["Shared UI Components (src/shared/ui)"]:::ui
        sharedUtil["Shared Utilities & Hooks (src/shared/hooks)"]:::ui
    end
    click app "https://github.com/roke-to/roketo-ui/tree/master/src/app"
    click pages "https://github.com/roke-to/roketo-ui/tree/master/src/pages"
    click features "https://github.com/roke-to/roketo-ui/tree/master/src/features"
    click widgets "https://github.com/roke-to/roketo-ui/tree/master/src/widgets"
    click sharedUI "https://github.com/roke-to/roketo-ui/tree/master/src/shared/ui"
    click sharedUtil "https://github.com/roke-to/roketo-ui/tree/master/src/shared/hooks"

    %% Business Logic / Domain Entities
    subgraph "Business Logic / Domain Entities"
        entities["Domain Entities (src/entities)"]:::business
        createStream["CreateStream Model (src/features/create-stream/model.ts)"]:::business
    end
    click entities "https://github.com/roke-to/roketo-ui/tree/master/src/entities"
    click createStream "https://github.com/roke-to/roketo-ui/blob/master/src/features/create-stream/model.ts"

    %% API & External Services
    subgraph "API & External Services"
        sharedAPI["Shared API Interfaces (src/shared/api)"]:::api
        legacyAPI["Legacy API Interfaces (src/features/legacy/api)"]:::api
        external["Roketo Contracts & External APIs"]:::api
    end
    click sharedAPI "https://github.com/roke-to/roketo-ui/tree/master/src/shared/api"
    click legacyAPI "https://github.com/roke-to/roketo-ui/tree/master/src/features/legacy/api"

    %% Connections
    conf --> app
    cypress --> app
    playwright --> app
    tests --> app
    github --> app
    husky --> app

    app -->|"routes"| pages
    pages -->|"renders"| features
    pages -->|"renders"| widgets
    pages -->|"renders"| sharedUI
    features -->|"uses"| sharedUtil
    features -->|"integrates"| entities
    features -->|"incorporates"| createStream
    features -->|"calls"| sharedAPI
    features -->|"calls"| legacyAPI
    sharedAPI -->|"communicates"| external
    legacyAPI -->|"communicates"| external

    %% Styles
    classDef config fill:#A2D9CE,stroke:#1E8449,stroke-width:2px
    classDef testing fill:#F9E79F,stroke:#B7950B,stroke-width:2px
    classDef ui fill:#AED6F1,stroke:#2874A6,stroke-width:2px
    classDef business fill:#F5CBA7,stroke:#D35400,stroke-width:2px
    classDef api fill:#D2B4DE,stroke:#7D3C98,stroke-width:2px
```
