# nullist0/today_good_words architecture

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

- Interactive diagram: https://gitdiagram.com/nullist0/today_good_words
- Repository: https://github.com/nullist0/today_good_words

## Overview

##### Project Type and Purpose
- This project is a full-stack mobile application developed in Flutter. It displays daily inspirational phrases, gathers user interactions like “likes,” and supports sharing screenshots.
- Firebase is used for backend services (fetching phrases and sending likes) and there is a native file system interface for similar functionalities via filed_service.

##### Analysis of File Structure
- The top-level structure includes directories for Android and iOS configurations (android, ios) confirming the mobile nature.
- There are several directories dedicated to application logic:
- view: Contains Flutter widgets and presentation logic.
- bloc: Defines conversion of domain objects to UI state.
- native_bloc: Provides native implementations interfacing with domain logic.
- domain: Holds core business and value objects.
- firebase_repository: Implements domain repository interfaces via Firebase.
- filed_service: Implements domain interfaces using native file system services.
- Configuration files (such as pubspec.yaml, melos.yaml) and tests (integration_test, native_bloc/test etc.) show continuous integration practices.

##### Main Components and Their Relationships
- view: This is the presentation layer – all Flutter widgets reside here.
- bloc: Acts as an intermediary to convert domain objects into state objects for UI rendering.
- native_bloc: Bridges the bloc and domain components by implementing additional native interfaces.
- domain: Contains the business logic, value objects, and interfaces for the repository.
- firebase_repository: Implements the data access layer by interfacing with Firebase. It provides data for the domain based on repository interfaces.
- filed_service: An alternative or complementary data layer that implements domain interfaces through file system operations.

##### Architectural Patterns and Design Principles
- Layered Architecture: Each component (UI, state management, business logic, and data access) is clearly separated.
- Repository Pattern: Domain interfaces are implemented by repositories (firebase_repository and filed_service) to abstract data source management.
- Dependency Inversion: High-level modules (view, bloc) are decoupled from low-level ones (Firebase, file system) via abstract domain interfaces.
- Use of a state management solution (BLoC pattern) is evident given the references to both bloc and native_bloc components.

##### Extra Details to Highlight
- Mention that native file interactions happen via filed_service.

## Diagram (Mermaid)

```mermaid
graph TD
    %% Presentation Layer
    subgraph "Presentation Layer"
        v["view (Flutter UI Widgets)"]:::presentation
    end

    %% State Management Layer
    subgraph "State Management Layer"
        b["bloc (State Management Logic)"]:::state_management
        nb["native_bloc (Native-specific Implementations)"]:::state_management
    end

    %% Business Logic Layer
    subgraph "Business Logic Layer"
        d["domain (Core Business/Domain Logic)"]:::business_logic
    end

    %% Data Access Layer
    subgraph "Data Access Layer"
        fr["firebase_repository (Firebase Data Access)"]:::data_access
        fs["filed_service (File System Data Access)"]:::data_access
    end

    %% Dependencies
    v -->|"depends"| b
    b -->|"depends"| nb
    nb -->|"depends"| d
    d -->|"depends"| fr
    d -->|"depends"| fs

    %% Click Events
    click v "https://github.com/nullist0/today_good_words/tree/master/view/lib"
    click b "https://github.com/nullist0/today_good_words/tree/master/bloc/lib"
    click nb "https://github.com/nullist0/today_good_words/tree/master/native_bloc/lib"
    click d "https://github.com/nullist0/today_good_words/tree/master/domain/lib"
    click fr "https://github.com/nullist0/today_good_words/tree/master/firebase_repository/lib"
    click fs "https://github.com/nullist0/today_good_words/tree/master/filed_service/lib"

    %% Styles
    classDef presentation fill:#ffe599,stroke:#333,stroke-width:2px,rx:10,ry:10;
    classDef state_management fill:#a4c2f4,stroke:#333,stroke-width:2px,rx:5,ry:5;
    classDef business_logic fill:#b6d7a8,stroke:#333,stroke-width:2px,rx:5,ry:5;
    classDef data_access fill:#f4cccc,stroke:#333,stroke-width:2px,rx:5,ry:5;
```
