# itsaidi/vidy architecture

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

## Overview

##### Project Overview & Main Purpose
- Vidy is a full-stack mobile application that provides user authentication (via Appwrite), video listing/sharing features, and smooth navigation through AI-generated video feeds.
- The app uses React Native with Expo for the frontend, integrates TailwindCSS for styling, leverages Context API for state management, and depends on Appwrite as the backend.

##### And Map the Main Components
a. Frontend (Mobile App):
- Screens/Pages:
- Authentication: Contains sign-in and sign-up pages through app/(auth)/SignIn.jsx, app/(auth)/SignUp.jsx, with a dedicated layout file (app/(auth)/_layout.jsx).
- Tabs: Multiple views labeled Bookmark, Create, Home, Profile under app/(tabs); includes its own layout file (app/(tabs)/_layout.jsx).
- Search Functionality: Managed under app/search with a dynamic route ([query].jsx).
- Main Layout: Global entry point app/index.jsx and master layout file app/_layout.jsx.
- Components:
- Reusable UI components such as CustomButton, CustomInputField, EmptyState, SearchInputField, Trending, VideoCard from the components directory.
- Assets:

b. State Management:
- Global Provider: Managed using Context API found in context/GlobalProvider.js, which orchestrates state across components.

c. Backend Integration:
- The use of Appwrite for authentication and backend services is indicated both in the README and through integration files like lib/Appwrite.js. This file encapsulates functions to interact with Appwrite services.

d. Auxiliary/Configuration:
- Configuration files like babel.config.js and tailwind.config.js suggest build-time settings.
- Other files such as package.json, package-lock.json, and app.json provide project meta and dependency specifications.

##### Architectural Relationships and Data Flow
- Frontend UI (React Native components) is the facade; it communicates with the Context API (GlobalProvider) to manage and propagate state changes.
- UI components make calls to the backend through the abstraction layer provided by lib/Appwrite.js.
- Routing and layout components in the “app” folder segregate different user flows (authentication, tabs, search).
- Assets and static resources (images, fonts) are used by the frontend and are organized separately.
- Integration with Appwrite ensures secure authentication and likely CRUD operations for video content and user data.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend UI Subgraph
    subgraph "Frontend UI"
        FE["Global Entry & Layout"]:::frontend
        subgraph "Auth Module"
            A1["SignIn"]:::frontend
            A2["SignUp"]:::frontend
            A3["Auth Layout"]:::frontend
        end
        subgraph "Tabs Module"
            T1["Bookmark"]:::frontend
            T2["Create"]:::frontend
            T3["Home"]:::frontend
            T4["Profile"]:::frontend
            T5["Tabs Layout"]:::frontend
        end
        subgraph "Search Module"
            S1["Dynamic Search Page"]:::frontend
        end
        subgraph "UI Components & Assets"
            UC["UI Components"]:::component
            II["Icons & Images"]:::component
            AS["Assets"]:::component
        end
    end

    %% Global Provider, Backend API and Build Configurations
    GP["Global Provider"]:::state
    AP["Appwrite API"]:::backend
    BC["Build Configurations"]:::config

    %% Navigation from Global Entry & Layout to Module Layouts
    FE -->|"navigates"| A3
    FE -->|"navigates"| T5
    FE -->|"navigates"| S1

    %% Auth Module internal flow and state update
    A1 -->|"uses"| A3
    A2 -->|"uses"| A3
    A1 -->|"StateUpdate"| GP
    A2 -->|"StateUpdate"| GP

    %% Tabs Module internal flow and state update
    T1 -->|"uses"| T5
    T2 -->|"uses"| T5
    T3 -->|"uses"| T5
    T4 -->|"uses"| T5
    T1 -->|"StateUpdate"| GP
    T2 -->|"StateUpdate"| GP
    T3 -->|"StateUpdate"| GP
    T4 -->|"StateUpdate"| GP

    %% UI Components & Assets support Frontend Entry
    UC -->|"UI_Support"| FE
    II -->|"UI_Support"| FE
    AS -->|"UI_Support"| FE

    %% API Requests from UI layouts to Backend
    A3 -->|"APIRequest"| AP
    T5 -->|"APIRequest"| AP
    S1 -->|"APIRequest"| AP

    %% Global Provider propagates state back to Frontend
    GP -->|"StatePropagation"| FE

    %% Build Configurations support project setup
    BC -->|"build_settings"| FE

    %% Styles
    classDef frontend fill:#e0f7fa,stroke:#006064,stroke-width:1px;
    classDef state fill:#fff9c4,stroke:#f57f17,stroke-width:1px;
    classDef backend fill:#ffe0b2,stroke:#fb8c00,stroke-width:1px;
    classDef config fill:#dcedc8,stroke:#558b2f,stroke-width:1px;
    classDef component fill:#f3e5f5,stroke:#8e24aa,stroke-width:1px;

    %% Click Events
    click FE "https://github.com/itsaidi/vidy/blob/main/app/index.jsx"
    click A1 "https://github.com/itsaidi/vidy/blob/main/app/(auth)/SignIn.jsx"
    click A2 "https://github.com/itsaidi/vidy/blob/main/app/(auth)/SignUp.jsx"
    click A3 "https://github.com/itsaidi/vidy/blob/main/app/(auth)/_layout.jsx"
    click T1 "https://github.com/itsaidi/vidy/blob/main/app/(tabs)/Bookmark.jsx"
    click T2 "https://github.com/itsaidi/vidy/blob/main/app/(tabs)/Create.jsx"
    click T3 "https://github.com/itsaidi/vidy/blob/main/app/(tabs)/Home.jsx"
    click T4 "https://github.com/itsaidi/vidy/blob/main/app/(tabs)/Profile.jsx"
    click T5 "https://github.com/itsaidi/vidy/blob/main/app/(tabs)/_layout.jsx"
    click S1 "https://github.com/itsaidi/vidy/blob/main/app/search/[query].jsx"
    click UC "https://github.com/itsaidi/vidy/blob/main/components/CustomButton.jsx"
    click II "https://github.com/itsaidi/vidy/blob/main/app/icons.jsx"
    click AS "https://github.com/itsaidi/vidy/tree/main/assets"
    click GP "https://github.com/itsaidi/vidy/blob/main/context/GlobalProvider.js"
    click AP "https://github.com/itsaidi/vidy/blob/main/lib/Appwrite.js"
    click BC "https://github.com/itsaidi/vidy/blob/main/babel.config.js"
```
