# shubhvarshney30/sheheroes architecture

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

- Interactive diagram: https://gitdiagram.com/shubhvarshney30/sheheroes
- Repository: https://github.com/shubhvarshney30/sheheroes

## Overview

Based on our analysis of the file tree and the README, this is a mobile‐first women safety application (SheHeroes) built principally in Flutter. The application targets both Android and iOS (with platform-specific code under the directories “android”, “ios”, and “Sheheroes_WatchOS”), while also including a web landing page (inside the “SheHeroes-template” folder) that serves as an informational or promotional site. The app leverages external services such as Firestore for backend storage, Google Map API for mapping and location tracking, and CrimeoMeter API for crime statistics; it also includes features for voice assistance, emergency SOS calls, shake-based alerts, camera integration, and more.

##### Main Components
- Mobile Client (Flutter App):
– The “lib” folder contains most of the UI pages (e.g., emergency_dashboard, login_page, several feature pages like camera, map, voice, etc.), along with shared utilities, widgets, and themes.
– “lib/providers” and “lib/services” show that the project uses state management and dependency injection (service_locator) to manage business logic and hardware interactions (e.g., calls_and_messages_service, shake detection).
- Platform-Specific Code:
– “android” and “ios” folders for native builds employing Gradle and Xcode. These include configurations, manifests, and platform assets.
– “Sheheroes_WatchOS” indicates additional client code that might be designed for wearable or extended device interaction, with its own native folders for Android and iOS.
- Web Landing Page:
– The “SheHeroes-template” folder contains HTML, CSS, JavaScript, and media assets. This is structured as a static site to showcase the app.
- External Services & APIs:
– Firestore (as per the README’s tech stack)
– Google Map API & CrimeoMeter API used within the app (likely triggered from the corresponding services in the code)
– Additional native phone functionalities for emergency SMS, calls, and so on.
- DevOps/CI:
– The “.github” directory with workflows (ci.yml) shows integration for continuous integration.
– Gradle files, pubspec.yaml, and various configuration files demonstrate a modern build system and dependency management.

##### Establish Relationships and Interactions
- The Flutter Mobile Client (UI) interacts with its internal Providers and Services. The UI pages (in “lib/pages”) forward user events to Providers (under “lib/providers”) which in turn call the Services (in “lib/services”) to perform tasks like authentication (GoogleAuth), shake detection, camera usage, etc.
- The Services layer manages integration to external APIs (Google Map, Firestore, CrimeoMeter) and platform-specific functionalities (calls, SMS, and media capture).
- There is a clear data flow: User Input (via mobile UI) → UI Widgets → Provider/State Management → Services → (if needed) External API call, and notifications back to the UI.
- For the web landing page, the static site packages provide general information and might link out to app store pages or download links.
- The build system components (Gradle for Android, Xcode for iOS, and Flutter’s pubspec.yaml) ensure that the correct dependencies and configurations are applied across platforms.

##### Architectural Patterns / Design Principles
- The project leverages Flutter’s widget-based model for its cross-platform mobile UI.
- There is a type of separation-of-concerns: UI components are separated from business logic (Providers/Services) as shown by the “lib/providers” and “lib/services” directories.
- Usage of a service locator pattern (in service_locator.dart) for dependency injection improves testability and modularity.
- The overall architecture is modular—each functionality (e.g., voice assistant, emergency map, camera, SOS, etc.) is encapsulated in its own page and/or service, which simplifies scaling and future feature integration.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Mobile App (Flutter)
    subgraph "Mobile App (Flutter)"
        UI["Flutter UI\n(lib/pages, lib/ui, lib/shared, lib/models)"]:::presentation
        Providers["State Providers\n(lib/providers)"]:::businessLogic
        Services["Business Logic & Services\n(lib/services)"]:::businessLogic
    end

    %% Native Platforms
    subgraph "Native Platforms"
        Android["Android Native Code"]:::platform
        iOS["iOS Native Code"]:::platform
        WatchOS["WatchOS Integration"]:::platform
    end

    %% External Services
    subgraph "External Services"
        Firestore["Firestore Backend"]:::external
        GoogleMap["Google Map API"]:::external
        CrimeoMeter["CrimeoMeter API"]:::external
    end

    %% Other Components
    Web["Web Landing Page\n(SheHeroes-template)"]:::presentation
    CI["CI/CD Pipeline\n(.github/workflows/ci.yml)"]:::build

    %% Interactions within Mobile App
    UI -->|"UserAction"| Providers
    Providers -->|"StateUpdate"| Services

    %% Services to External APIs
    Services -->|"API_Call"| Firestore
    Services -->|"API_Call"| GoogleMap
    Services -->|"API_Call"| CrimeoMeter

    %% Services interacting with Native Platforms
    Services -->|"Native_Interaction"| Android
    Services -->|"Native_Interaction"| iOS
    Services -->|"Native_Interaction"| WatchOS

    %% CI/CD triggering builds/deployments
    CI -->|"Build_Trigger"| Android
    CI -->|"Build_Trigger"| iOS
    CI -->|"Build_Trigger"| Web

    %% Click Events
    click UI "https://github.com/shubhvarshney30/sheheroes/tree/main/lib/pages"
    click Providers "https://github.com/shubhvarshney30/sheheroes/tree/main/lib/providers"
    click Services "https://github.com/shubhvarshney30/sheheroes/tree/main/lib/services"
    click Android "https://github.com/shubhvarshney30/sheheroes/tree/main/android"
    click iOS "https://github.com/shubhvarshney30/sheheroes/tree/main/ios"
    click WatchOS "https://github.com/shubhvarshney30/sheheroes/tree/main/Sheheroes_WatchOS"
    click Web "https://github.com/shubhvarshney30/sheheroes/tree/main/SheHeroes-template"
    click CI "https://github.com/shubhvarshney30/sheheroes/blob/main/.github"

    %% Style Definitions
    classDef presentation fill:#fceabb,stroke:#e8a317,stroke-width:2px;
    classDef businessLogic fill:#b3e5fc,stroke:#039be5,stroke-width:2px;
    classDef platform fill:#dcedc8,stroke:#7cb342,stroke-width:2px;
    classDef external fill:#ffccbc,stroke:#ff5722,stroke-width:2px;
    classDef build fill:#d1c4e9,stroke:#673ab7,stroke-width:2px;
```
