# prathameshsaraf/babynama architecture

> Architecture diagram of the GitHub repository prathameshsaraf/babynama, 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/prathameshsaraf/babynama
- Repository: https://github.com/prathameshsaraf/babynama

## Overview

##### Main Components
- UI Layer (Views): Represented by the screens and widgets (located in lib/Views). This is where the user interacts with the application.
- Business Logic Layer (ViewModels): Found in lib/viewModel. These components handle the logic, listen to user input from the UI, and update the state.
- Service Layer: Although the folder is named “servies” in the file tree, these provide external services management (e.g., local_storage_service.dart, snackbar_service.dart). They are responsible for operations like API calls, storage, and notifications.
- Data Models: Found in lib/Model. These are classes representing the data structures (e.g., service_model.dart, vaccine_model.dart).
- App Configuration and Routing: The lib/app folder includes files such as app.dart, app.router.dart, and dependency injector setup (app.locator.dart) which orchestrate dependency management and app-level routing logic.

##### Relationships and Data Flow
- The UI (Views) interacts directly with the respective ViewModels.
- ViewModels retrieve and manipulate data by interacting with the Service layer and update corresponding Models.
- The Service layer may handle tasks like reading/writing to local storage (using get_storage) or managing snackbars for feedback.
- Dependency injection (via packages like injectable) links these components together, ensuring that each component receives its required dependencies seamlessly.
- Routing and navigation are managed by auto_route and defined in the app/router files, coordinating transitions between various views.

##### Architectural Patterns and Principles
- The Stacked architecture pattern emphasizes separation of concerns, ensuring that the presentation layer (views) is cleanly separated from the business logic (viewmodels) and external services.
- Dependency injection is used for loose coupling between components.
- The auto_route package indicates a clear separation of the navigation layer.
- The project also uses reactive programming patterns with state management, an essential part of the Stacked pattern.

##### How to Represent This
- UI Layer (Views): List the key screens (Home, Account, Autism, Track Vaccination, Profile).
- Service Layer: Represent services like local storage and snackbar functionalities.
- Data Models: Show the data abstraction layer used by the viewmodels and services.
e. Label external libraries and frameworks (like auto_route for navigation, stacked_services for additional utilities, get_storage for local persistence) in separate annotations or legends.
- Rectangles for layers (UI, Business Logic, Services, Data Models).
- Ovals or circles for external integrations (e.g., dependency injection container, build_runner).

## Diagram (Mermaid)

```mermaid
flowchart TD
    P["Flutter Engine / Platform Abstraction"]:::platform
    C["App Configuration & Routing"]:::config

    subgraph "Application Core"
        UI["UI Layer (Views): HomeView, AccountView, AutismView, TrackVaccinationView, ProfileView"]:::core
        BL["Business Logic (ViewModels)"]:::core
        SL["Service Layer (Local Storage, Snackbar)"]:::service
        DM["Data Models"]:::core
    end

    P -->|"MultiPlatform"| C
    C -->|"Injects"| UI
    C -->|"Injects"| BL
    C -->|"Injects"| SL
    C -->|"Injects"| DM
    UI -->|"UserInteraction"| BL
    BL -->|"UpdatesUI"| UI
    BL -->|"ServiceCall"| SL
    SL -->|"Response"| BL
    BL -->|"ModelUpdate"| DM

    click UI "https://github.com/prathameshsaraf/babynama/tree/master/lib/Views"
    click BL "https://github.com/prathameshsaraf/babynama/tree/master/lib/viewModel"
    click SL "https://github.com/prathameshsaraf/babynama/tree/master/lib/servies"
    click DM "https://github.com/prathameshsaraf/babynama/tree/master/lib/Model"
    click C "https://github.com/prathameshsaraf/babynama/tree/master/lib/app"

    classDef platform fill:#ffcc00,stroke:#333,stroke-width:2px;
    classDef core fill:#99ccff,stroke:#333,stroke-width:2px;
    classDef service fill:#ff9999,stroke:#333,stroke-width:2px;
    classDef config fill:#ccffcc,stroke:#333,stroke-width:2px;
```
