# nimastic/nus-orbital-spa-gemini-intermediate architecture

> Architecture diagram of the GitHub repository nimastic/nus-orbital-spa-gemini-intermediate, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-31). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nimastic/nus-orbital-spa-gemini-intermediate
- Repository: https://github.com/nimastic/nus-orbital-spa-gemini-intermediate

## Overview

##### High-Level Architecture Components

a) Client Layer (Mobile Application)
- Flutter UI Components
- Feature Modules (Tasks, Calendar, Reminders, Assistant)
- State Management (Provider pattern evident from /lib/provider)
- Authentication Bloc

b) Service Layer
- Authentication Service
- Cloud Storage Service
- OpenAI Integration
- Speech Recognition Service
- ML Model Service
- Notification Service

c) External Services
- Firebase (Authentication, Cloud Firestore)
- OpenAI API
- TensorFlow Lite (evident from assets/MLModel.tflite)

##### Component Relationships

Key interactions:

a) Data Flow:
- User Interface → Business Logic → Data Layer
- Authentication Flow
- Cloud Data Synchronization
- Voice Command Processing Pipeline

b) Integration Points:
- Firebase Authentication
- Cloud Firestore
- OpenAI API
- TensorFlow Lite Model

##### Specific Implementation Details

Architectural patterns:

a) BLoC Pattern Implementation:
- Auth Events
- Auth States
- Auth Bloc Controller

b) Repository Pattern:
- Cloud Storage
- Authentication
- Task Management
- Calendar Events

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        UI[Main UI]
        FeatMod[Feature Modules]
        Widgets[UI Widgets]
        
        subgraph Features
            Calendar[Calendar Module]
            Tasks[Tasks Module]
            Reminders[Reminders Module]
            Assistant[Assistant Module]
        end
        
        UI --> Features
        Features --> Widgets
        FeatMod --> Features
    end
    
    subgraph BusinessLogic
        AuthBloc[Authentication Bloc]
        StateManagement[State Management]
        
        subgraph Providers
            ChatProv[Chat Provider]
            ModelsProv[Models Provider]
        end
        
        AuthBloc --> StateManagement
        StateManagement --> Providers
    end
    
    subgraph ServiceLayer
        AuthService[Authentication Service]
        CloudStore[Cloud Storage Service]
        OpenAI[OpenAI Integration]
        Speech[Speech Recognition]
        MLModel[ML Model Service]
        Notify[Notification Service]
    end
    
    subgraph ExternalServices
        Firebase[(Firebase)]
        OpenAIAPI[OpenAI API]
        TFLite[TensorFlow Lite]
    end
    
    subgraph DataModels
        ChatModel[Chat Model]
        CloudDocs[Cloud Documents]
        EventModel[Events Model]
        TaskModel[Tasks Model]
        ReminderModel[Reminders Model]
    end
    
    Client --> BusinessLogic
    BusinessLogic --> ServiceLayer
    ServiceLayer --> ExternalServices
    ServiceLayer --> DataModels
    
    %% Click Events
    click UI "https://github.com/Nimastic/NUS-Orbital-SPA-Gemini-Intermediate/blob/main/lib/views/main_page.dart"
    click Calendar "https://github.com/Nimastic/NUS-Orbital-SPA-Gemini-Intermediate/tree/main/lib/views/features/calendar"
    click Tasks "https://github.com/Nimastic/NUS-Orbital-SPA-Gemini-Intermediate/tree/main/lib/views/features/to-do list"
    click Reminders "https://github.com/Nimastic/NUS-Orbital-SPA-Gemini-Intermediate/tree/main/lib/views/features/reminder"
    click Assistant "https://github.com/Nimastic/NUS-Orbital-SPA-Gemini-Intermediate/tree/main/lib/views/features/assistant"
    click AuthBloc "https://github.com/Nimastic/NUS-Orbital-SPA-Gemini-Intermediate/blob/main/lib/services/auth/bloc/auth_bloc.dart"
    click CloudStore "https://github.com/Nimastic/NUS-Orbital-SPA-Gemini-Intermediate/tree/main/lib/services/cloud"
    click OpenAI "https://github.com/Nimastic/NUS-Orbital-SPA-Gemini-Intermediate/blob/main/lib/services/openai/openai_service.dart"
    click Speech "https://github.com/Nimastic/NUS-Orbital-SPA-Gemini-Intermediate/blob/main/lib/services/speech/sst_listen.dart"
    click MLModel "https://github.com/Nimastic/NUS-Orbital-SPA-Gemini-Intermediate/blob/main/lib/services/model/ml_model.dart"
    click Notify "https://github.com/Nimastic/NUS-Orbital-SPA-Gemini-Intermediate/blob/main/lib/services/notifications/notifications_service.dart"
    click ChatProv "https://github.com/Nimastic/NUS-Orbital-SPA-Gemini-Intermediate/blob/main/lib/provider/chats_provider.dart"
    click ModelsProv "https://github.com/Nimastic/NUS-Orbital-SPA-Gemini-Intermediate/blob/main/lib/provider/models_provider.dart"
    click ChatModel "https://github.com/Nimastic/NUS-Orbital-SPA-Gemini-Intermediate/blob/main/lib/models/chat_model.dart"
    click CloudDocs "https://github.com/Nimastic/NUS-Orbital-SPA-Gemini-Intermediate/blob/main/lib/services/cloud/cloud_doc.dart"
    click EventModel "https://github.com/Nimastic/NUS-Orbital-SPA-Gemini-Intermediate/blob/main/lib/services/cloud/events/cloud_event.dart"
    click TaskModel "https://github.com/Nimastic/NUS-Orbital-SPA-Gemini-Intermediate/blob/main/lib/services/cloud/tasks/cloud_task.dart"
    click ReminderModel "https://github.com/Nimastic/NUS-Orbital-SPA-Gemini-Intermediate/blob/main/lib/services/cloud/reminders/cloud_reminder.dart"
    click TFLite "https://github.com/Nimastic/NUS-Orbital-SPA-Gemini-Intermediate/blob/main/assets/MLModel.tflite"
    
    classDef frontend fill:#3498db
    classDef business fill:#2ecc71
    classDef service fill:#f1c40f
    classDef external fill:#e74c3c
    classDef data fill:#9b59b6
    
    class UI,FeatMod,Widgets,Features,Calendar,Tasks,Reminders,Assistant frontend
    class AuthBloc,StateManagement,Providers,ChatProv,ModelsProv business
    class AuthService,CloudStore,OpenAI,Speech,MLModel,Notify service
    class Firebase,OpenAIAPI,TFLite external
    class ChatModel,CloudDocs,EventModel,TaskModel,ReminderModel data
```
