# nathan-au/amicae architecture

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

- Interactive diagram: https://gitdiagram.com/nathan-au/amicae
- Repository: https://github.com/nathan-au/amicae

## Overview

##### Main Components
- Mobile App (Flutter)
- This is the core of the system. All UI, business logic, and feature implementations for cross-platform deployment are located in the lib directory.
- Feature Modules
- The lib/features folder contains submodules such as authentication, login, home (which includes the swipe-based matching), profile, events, spots, and user account setup. Each of these modules represents a major area of functionality.
- Platform-specific Layers
- Separate directories for Android and iOS house native configuration, launch files, and platform-specific integrations.
- External Services and Backend Integrations
- Firebase integration (firebase.json, firebase_rules.json, and lib/firebase_options.dart) plays a key role in user authentication, data storage, and possibly notifications.
- Assets and Web
- The assets directory (with logos and temp avatars) and web folder indicate supporting media and a web presence if needed.

##### Relationships and Interactions
- The Flutter Application (UI & Business Logic Layer) is the heart of the system. From here:
- UI modules (for login, home, profile, etc.) call on dedicated services (e.g., auth_service, profile_service) to perform network calls, business logic, or data operations.
- The services may interact with Firebase (either directly through APIs or via Firebase SDK) and possibly other back-end endpoints if expanded.
- Feature Modules interconnect via common components:
- For example, the “Swipe and Study” feature in the home module uses services from both the events and profile modules, and may pull data from a shared resource service.
- Platform-specific projects (in Android and iOS directories) serve as the native embedding layers. They encapsulate platform-specific configurations and manage how the Flutter code is rendered on mobile hardware.

##### Architectural Patterns and Design Principles
- Modular Architecture:
- The separation of features by folders (authentication, home, profile, user account setup, etc.) indicates a modular design approach that improves maintainability.
- Separation of Concerns:
- UI layers, business logic (services), and configuration are clearly separated.
- Platform Abstraction:
- A core Flutter project is used to build a cross-platform app while retaining native setups in Android and iOS directories for platform-specific customizations.
- External Integration:
- Firebase is integrated as a central external service, which is crucial for authentication, data storage, and possibly real-time updates.

##### Emphasizing Detail
- Try to capture every architectural layer and interaction. Don’t over-simplify – include as many distinct components as possible to reflect the modular design of the project.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Mobile App Layer
    subgraph "Flutter Application (UI & Business Logic)"
        FlutterApp["Flutter App Core"]:::app
        subgraph "Feature Modules"
            Auth["Authentication"]:::module
            Login["Login"]:::module
            Home["Home (Swipe-Based Matching)"]:::module
            Profile["Profile"]:::module
            Events["Events"]:::module
            Spots["Spots"]:::module
            Account["User Account Setup"]:::module
            UserModules["User Modules"]:::module
        end
    end

    %% Services Layer
    subgraph "Service Components"
        AuthService["Auth Service"]:::service
        GeminiService["Gemini Service"]:::service
        ProfileService["Profile Service"]:::service
    end

    %% External and Supporting Components
    subgraph "External & Supporting Components"
        Firebase["Firebase Integration"]:::external
        Assets["Assets"]:::external
        Web["Web Support"]:::external
    end

    %% Platform-Specific Projects
    subgraph "Platform-Specific Projects"
        Android["Android Project"]:::platform
        iOS["iOS Project"]:::platform
    end

    %% Relationships
    %% Flutter App to Feature Modules
    FlutterApp -->|"loads"| Auth
    FlutterApp -->|"loads"| Login
    FlutterApp -->|"loads"| Home
    FlutterApp -->|"loads"| Profile
    FlutterApp -->|"loads"| Events
    FlutterApp -->|"loads"| Spots
    FlutterApp -->|"loads"| Account
    FlutterApp -->|"loads"| UserModules

    %% Feature Modules interacting with Services
    Auth -->|"calls"| AuthService
    Home -->|"calls"| GeminiService
    Home -->|"calls"| ProfileService
    Profile -->|"requests"| ProfileService

    %% Feature Modules direct external calls
    Events -->|"fetches"| Firebase
    Spots -->|"fetches"| Firebase
    Account -->|"updates"| Firebase
    UserModules -->|"manages"| Firebase

    %% Services interacting with External Platform
    AuthService -->|"integrates"| Firebase
    GeminiService -->|"integrates"| Firebase
    ProfileService -->|"integrates"| Firebase

    %% Flutter App interactions with supporting components
    FlutterApp -->|"loads"| Assets
    FlutterApp -->|"optional"| Web

    %% Flutter App wrapped by platform specific layers
    FlutterApp -->|"embedded in"| Android
    FlutterApp -->|"embedded in"| iOS

    %% Click Events
    click FlutterApp "https://github.com/nathan-au/amicae/tree/main/lib/"
    click Auth "https://github.com/nathan-au/amicae/tree/main/lib/features/authentication"
    click AuthService "https://github.com/nathan-au/amicae/blob/main/lib/features/authentication/services/auth_service.dart"
    click Login "https://github.com/nathan-au/amicae/tree/main/lib/features/login"
    click Home "https://github.com/nathan-au/amicae/tree/main/lib/features/home"
    click GeminiService "https://github.com/nathan-au/amicae/blob/main/lib/features/home/swipeFeature/gemini_service.dart"
    click Profile "https://github.com/nathan-au/amicae/tree/main/lib/features/profile"
    click ProfileService "https://github.com/nathan-au/amicae/blob/main/lib/features/profile/service/profile_service.dart"
    click Events "https://github.com/nathan-au/amicae/tree/main/lib/features/events"
    click Spots "https://github.com/nathan-au/amicae/tree/main/lib/features/spots"
    click Account "https://github.com/nathan-au/amicae/tree/main/lib/features/user_account_set_up"
    click UserModules "https://github.com/nathan-au/amicae/tree/main/lib/features/user_modules"
    click Firebase "https://github.com/nathan-au/amicae/blob/main/lib/firebase_options.dart"
    click Android "https://github.com/nathan-au/amicae/tree/main/android/"
    click iOS "https://github.com/nathan-au/amicae/tree/main/ios/"
    click Assets "https://github.com/nathan-au/amicae/tree/main/assets/"
    click Web "https://github.com/nathan-au/amicae/tree/main/web/"

    %% Styles
    classDef app fill:#AED6F1,stroke:#1F618D,stroke-width:2px;
    classDef module fill:#F9E79F,stroke:#B7950B,stroke-width:2px;
    classDef service fill:#F5CBA7,stroke:#884EA0,stroke-width:2px;
    classDef external fill:#D5F5E3,stroke:#28B463,stroke-width:2px;
    classDef platform fill:#FAD7A0,stroke:#E67E22,stroke-width:2px;
```
