# ayan-bain/project-rif architecture

> Architecture diagram of the GitHub repository ayan-bain/project-rif, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-02-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ayan-bain/project-rif
- Repository: https://github.com/ayan-bain/project-rif

## Overview

##### Project type and purpose
- This is a full-stack mobile application (React Native + Expo) named “Smart Subscription Manager.”
- It enables users to track digital subscriptions, sync data via Firebase, fetch brand metadata via Brandfetch API, and schedule renewal reminders offline or online.

##### File structure
- Top-level files:
- App.js, index.js (entry points)
- google-services.json, eas.json (Expo & Firebase setup)
- babel.config.js, tsconfig.json (build configs)
- package.json (dependencies)
- assets/: font files and static assets
- src/components/:
- screens (HomeScreen.tsx, Details.tsx, AccountStatus.tsx)
- partials (AddSubscriptionForm, MoreMenu, UniversalLogoHandler)
- services (AuthHandler, RetrieveData, NotificationManager, Brandfetch integration, RenewalDate, NotificationRegistry)
- custom-components (CustomButton)
- constants/types
- src/subscriptions/: domain models/subscription.ts

##### README for additional insights
- Key features: automated brand discovery (Brandfetch), universal logo support (SVG/PNG), cloud sync (Firebase Auth & Firestore), smart notifications (expo-notifications), offline-first (AsyncStorage), dynamic theming.
- Tech stack: Expo/React Native, Firebase Auth & Firestore, AsyncStorage, react-native-svg, expo-notifications.

##### Main components & their relationships
A. Mobile App (React Native + Expo container)
- UI Layer
– Screens (Home, Details, AccountStatus)
– Partials & Custom Components (AddSubscriptionForm, UniversalLogoHandler, CustomButton)
- Service Layer
– AuthHandler (Firebase Auth)
– DataService (RetrieveData → AsyncStorage & Firestore sync)
– NotificationManager & NotificationRegistry (expo-notifications scheduling)
– DetailsHelper & RenewalDate logic
- Local Persistence
– AsyncStorage for offline caching
- Asset Management
– UniversalLogoHandler + react-native-svg + local assets/fonts

B. External Services
- Brandfetch API (HTTP calls for logos & metadata)
- Firebase Auth (user identity)
- Firebase Firestore (cloud database)
- Expo Notifications (push/local notifications)

##### Architectural patterns & design principles
- Offline-First Pattern: local cache (AsyncStorage) is the primary data source, then sync to Firestore.
- Service Abstraction: all network & storage interactions encapsulated in src/components/services.
- Modular UI: screens vs. partials vs. custom components.
- Dependency Injection points: services can be swapped (e.g., mocking Firebase).

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Mobile App Container
    subgraph "Mobile App (React Native + Expo)"
        direction TB
        %% UI Layer
        subgraph "UI Layer"
            direction TB
            HomeScreen["HomeScreen"]:::client
            DetailsScreen["DetailsScreen"]:::client
            AccountStatus["AccountStatusScreen"]:::client
            AddSubscriptionForm["AddSubscriptionForm"]:::client
            MoreMenu["MoreMenu"]:::client
            UniversalLogoHandler["UniversalLogoHandler"]:::client
            CustomButton["CustomButton"]:::client
        end
        %% Service Layer
        subgraph "Service Layer"
            direction TB
            AuthHandler["AuthHandler"]:::client
            RetrieveData["RetrieveDataService"]:::client
            NotificationManager["NotificationManager"]:::client
            NotificationRegistry["NotificationRegistry"]:::client
            DetailsHelper["DetailsHelper"]:::client
            RenewalDate["RenewalDateLogic"]:::client
        end
        %% Asset Manager
        subgraph "Asset Manager"
            direction TB
            FontsAssets["Fonts & Static Assets"]:::client
        end
    end

    %% External & Platform & Storage
    AsyncStorage["AsyncStorage (Local Cache)"]:::storage
    FirebaseAuth["Firebase Auth"]:::cloud
    Firestore["Firebase Firestore"]:::cloud
    BrandfetchAPI["Brandfetch API"]:::external
    ExpoNotifications["Expo Notifications"]:::platform

    %% Domain Model
    SubscriptionModel["Subscription Model"]:::client

    %% Connections: UI -> Services
    AddSubscriptionForm -->|"calls save()"| RetrieveData
    HomeScreen -->|"auth/status"| AuthHandler
    DetailsScreen -->|"fetch details"| DetailsHelper
    DetailsHelper -->|"compute renewal"| RenewalDate
    DetailsScreen -->|"schedule notif"| NotificationManager

    %% Services -> Storage & Cloud & External
    RetrieveData -->|"read/write"| AsyncStorage
    RetrieveData -->|"sync"| Firestore
    AuthHandler -->|"login/logout"| FirebaseAuth
    NotificationManager -->|"track"| NotificationRegistry
    NotificationManager -->|"schedule"| ExpoNotifications
    DetailsHelper -->|"fetch metadata"| BrandfetchAPI

    %% Domain Model usage
    RetrieveData -->|"uses"| SubscriptionModel

    %% Asset Manager to UI
    UniversalLogoHandler -->|"load assets"| FontsAssets

    %% Click Events
    click HomeScreen "https://github.com/ayan-bain/project-rif/blob/master/src/components/HomeScreen.tsx"
    click DetailsScreen "https://github.com/ayan-bain/project-rif/blob/master/src/components/Details.tsx"
    click AccountStatus "https://github.com/ayan-bain/project-rif/blob/master/src/components/AccountStatus.tsx"
    click AddSubscriptionForm "https://github.com/ayan-bain/project-rif/blob/master/src/components/partials/AddSubscriptionForm.tsx"
    click MoreMenu "https://github.com/ayan-bain/project-rif/blob/master/src/components/partials/MoreMenu.tsx"
    click UniversalLogoHandler "https://github.com/ayan-bain/project-rif/blob/master/src/components/partials/UniversalLogoHandler.tsx"
    click CustomButton "https://github.com/ayan-bain/project-rif/blob/master/src/components/custom-components/CustomButton.tsx"
    click AuthHandler "https://github.com/ayan-bain/project-rif/blob/master/src/components/services/AuthHandler.tsx"
    click RetrieveData "https://github.com/ayan-bain/project-rif/blob/master/src/components/services/RetrieveData.tsx"
    click NotificationManager "https://github.com/ayan-bain/project-rif/blob/master/src/components/services/NotificationManager.ts"
    click NotificationRegistry "https://github.com/ayan-bain/project-rif/blob/master/src/components/services/NotificationRegistry.ts"
    click DetailsHelper "https://github.com/ayan-bain/project-rif/blob/master/src/components/services/DetailsHelper.ts"
    click RenewalDate "https://github.com/ayan-bain/project-rif/blob/master/src/components/services/RenewalDate.ts"
    click SubscriptionModel "https://github.com/ayan-bain/project-rif/blob/master/src/subscriptions/subsciption.ts"
    click FontsAssets "https://github.com/ayan-bain/project-rif/tree/master/assets/fonts/"

    %% Styles
    classDef client fill:#cfe2f3,stroke:#0366d6,color:#000
    classDef storage fill:#d9ead3,stroke:#6aa84f,color:#000
    classDef cloud fill:#f9cb9c,stroke:#e69138,color:#000
    classDef external fill:#ffe599,stroke:#b45f06,color:#000
    classDef platform fill:#d9d2e9,stroke:#8e7cc3,color:#000
```
