# muhammadhasaanwaseem/fyp-react-native-social-media-application-name-rabbit- architecture

> Architecture diagram of the GitHub repository muhammadhasaanwaseem/fyp-react-native-social-media-application-name-rabbit-, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/muhammadhasaanwaseem/fyp-react-native-social-media-application-name-rabbit-
- Repository: https://github.com/muhammadhasaanwaseem/fyp-react-native-social-media-application-name-rabbit-

## Overview

##### Project Overview & Identification of Main Components
- This project is a full-stack, React Native social media application built with Expo Router. Its core functionalities include authentication (with Supabase and Twilio Verify), posting (media, text, audio, video, GIF support), real-time notifications, messaging, and AI-based chatbot integration.
- The file tree clearly separates “app” (or “screens”) for different functional areas (auth, onboarding, tabs, etc.), custom UI components (in components/ui), utility libraries (in lib, hooks), and providers that abstract business logic and external integrations.

##### Main Architectural Elements
a. Frontend/UI Layer:
- Mobile UI Delivery: The React Native “app” and “screens” directories contain the implementation for various screens (splash, authentication, onboarding, tabs such as home, profile, search, etc.).
- Reusable UI Components: The “components/ui” folder is a collection of custom-designed UI elements using the Gluestack UI library, designed with both mobile and web variations.
- Assets: Static media (images, logos, fonts) are provided in the “assets” folder.

b. Business Logic & State Management:
- Providers: “providers/AuthProviders.tsx”, “providers/PostProvider.tsx”, and “providers/VideoPlayerProvider.tsx” encapsulate cross-functional logic (authentication flow, post management, video handling).
- Hooks: Custom hooks (in the “hooks” directory) manage data fetching and real-time interactions (e.g., use-posts, use-followers, etc.).
- Libraries: “lib” directory includes code for sharing profiles, Supabase integration, storage handling, and defining custom types.

c. Backend / Data Layer:
- Database & ORM: Prisma (located in the “prisma” folder) serves as the database schema and migration tool.
- Authentication & Real-Time Data: Supabase is used to handle authentication (in the README you see the SQL commands to set permissions) and store data.
- External Services Integration: Integration with Twilio Verify for phone-based authentication and OpenRouter API for the DeepSeek Llama R1 chatbot.

##### Relationships & Data Flow
- Bidirectional data flow where needed (e.g., real-time notifications from Supabase sent back to the UI).
- Dependencies of external services such as Twilio Verify (for authentication) and the chatbot API.

##### Incorporate Key Architectural Patterns
- MVC / MVVM can be implicitly depicted by separating the UI (view layer) from the business logic.
- Component-based architecture: Emphasize the reusability of UI components.
- Service abstraction: Use providers to abstract API calls and external service interactions.

##### Relevant Technologies, Frameworks, and Libraries
- React Native with Expo Router (for mobile navigation).
- Prisma for ORM and database migrations.
- Supabase for backend services.
- Gluestack UI for component styling.
- TanStack Query for data caching.
- Twilio Verify and OpenRouter API for authentication and chatbot integration.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend/UI Layer
    subgraph "Frontend/UI Layer"
        UI_Mobile["Mobile UI Screens"]:::frontend
        UI_Comp["UI Components Library"]:::frontend
        Assets["Assets"]:::frontend
        ChatbotUI["Chatbot Integration"]:::frontend
    end

    %% Business Logic Layer
    subgraph "Business Logic Layer"
        AuthProvider["AuthProvider"]:::logic
        PostProvider["PostProvider"]:::logic
        VideoPlayerProvider["VideoPlayerProvider"]:::logic
        Hooks["Custom Hooks"]:::logic
        UtilLib["Utility Libraries"]:::logic
    end

    %% Data Access Layer & External Integrations
    subgraph "Data Access Layer & External Integrations"
        Supabase["Supabase Service"]:::data
        Prisma["Prisma ORM & Database Schema"]:::data
        ExternalAPIs["External APIs<br/>(Twilio Verify, OpenRouter)"]:::data
    end

    %% Connections from Frontend to Business Logic
    UI_Mobile -->|"initiates"| AuthProvider
    UI_Mobile -->|"initiates"| PostProvider
    UI_Mobile -->|"initiates"| VideoPlayerProvider
    UI_Mobile -->|"uses"| UI_Comp
    UI_Mobile -->|"loads"| Assets
    UI_Mobile -->|"triggers"| ChatbotUI

    %% Connections within Business Logic
    AuthProvider -->|"calls"| Hooks
    PostProvider -->|"calls"| Hooks
    VideoPlayerProvider -->|"calls"| Hooks
    AuthProvider -->|"uses"| UtilLib
    PostProvider -->|"uses"| UtilLib
    VideoPlayerProvider -->|"uses"| UtilLib

    %% Connections to Data Access Layer
    UtilLib -->|"integrates"| Supabase
    Supabase -->|"stores data in"| Prisma

    %% External Integrations
    AuthProvider -->|"validates"| ExternalAPIs
    ChatbotUI -->|"integrates"| ExternalAPIs

    %% Real-time notification flow
    Supabase -->|"notifies"| UI_Mobile

    %% Styles
    classDef frontend fill:#ADD8E6,stroke:#000,stroke-width:1px;
    classDef logic fill:#90EE90,stroke:#000,stroke-width:1px;
    classDef data fill:#FFB6C1,stroke:#000,stroke-width:1px;

    %% Click Events
    click UI_Mobile "https://github.com/muhammadhasaanwaseem/fyp-react-native-social-media-application-name-rabbit-/tree/version-10/app/"
    click UI_Comp "https://github.com/muhammadhasaanwaseem/fyp-react-native-social-media-application-name-rabbit-/tree/version-10/components/ui"
    click Assets "https://github.com/muhammadhasaanwaseem/fyp-react-native-social-media-application-name-rabbit-/tree/version-10/assets"
    click ChatbotUI "https://github.com/muhammadhasaanwaseem/fyp-react-native-social-media-application-name-rabbit-/blob/version-10/app/chatbot.tsx"
    click AuthProvider "https://github.com/muhammadhasaanwaseem/fyp-react-native-social-media-application-name-rabbit-/blob/version-10/providers/AuthProviders.tsx"
    click PostProvider "https://github.com/muhammadhasaanwaseem/fyp-react-native-social-media-application-name-rabbit-/blob/version-10/providers/PostProvider.tsx"
    click VideoPlayerProvider "https://github.com/muhammadhasaanwaseem/fyp-react-native-social-media-application-name-rabbit-/blob/version-10/providers/VideoPlayerProvider.tsx"
    click Hooks "https://github.com/muhammadhasaanwaseem/fyp-react-native-social-media-application-name-rabbit-/tree/version-10/hooks"
    click UtilLib "https://github.com/muhammadhasaanwaseem/fyp-react-native-social-media-application-name-rabbit-/tree/version-10/lib"
    click Prisma "https://github.com/muhammadhasaanwaseem/fyp-react-native-social-media-application-name-rabbit-/blob/version-10/prisma/schema.prisma"
    click Supabase "https://github.com/muhammadhasaanwaseem/fyp-react-native-social-media-application-name-rabbit-/blob/version-10/lib/supabase.ts"
```
