# taskemapp/taskem architecture

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

- Interactive diagram: https://gitdiagram.com/taskemapp/taskem
- Repository: https://github.com/taskemapp/taskem

## Overview

##### High-Level Components

a) Client Layer (Flutter Application)
- Into three main sections:
- UI Layer (Features)
- Business Logic Layer (BLoC)
- Data Layer (Repositories)

b) Backend Services Layer (gRPC)
- Three main services identified from the proto files:
- Auth Service
- Task Service
- Team Service

##### Detailed Component Breakdown

Frontend Architecture:
- Feature modules:
- Authorization
- Task Management
- Team Management
- Home
- Initialization

For each feature module, represent:
- Screens
- Controllers (BLoC)
- Models
- Repositories
- Widgets

##### Key Architectural Patterns to Highlight

a) BLoC Pattern Implementation:
- Event/state flow:
- Controllers → Events → States → UI
- Separation between:
- UI Components
- Business Logic
- Data Access

b) Repository Pattern:
- Data flow:
- Repository → gRPC Client → Backend Services

##### Cross-Cutting Concerns

Shared components:
- i18n (Internationalization)
- Theme Management
- Route Management
- Common Widgets
- Core Utilities

##### Platform Support

Multi-platform support:
- iOS
- Android
- Web
- Desktop (Windows, macOS, Linux)

##### Implementation Details

- gRPC Communication:
- Generated protocol buffer classes
- Bi-directional communication

- State Management:
- BLoC pattern implementation
- Event/State flow

##### UI Layer (Screens & Widgets)
↓
##### Business Logic Layer (BLoCs)
↓
##### Repository Layer
↓
##### gRPC Communication Layer
↓
##### Backend Services

- Component types
- Architectural patterns

Keep the abstraction level balanced:
- Detailed enough to show the application's architecture
- Abstract enough to remain comprehensible
- Core task management and team collaboration features

Remember to indicate the cross-platform nature of the application while maintaining focus on the core business logic and data flow.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles and Classes
    classDef ui fill:#3498db,stroke:#2980b9,color:white
    classDef bloc fill:#2ecc71,stroke:#27ae60,color:white
    classDef data fill:#f1c40f,stroke:#f39c12,color:black
    classDef service fill:#9b59b6,stroke:#8e44ad,color:white
    classDef util fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef proto fill:#e74c3c,stroke:#c0392b,color:white

    %% Legend
    subgraph Legend
        UI[UI Components]:::ui
        BL[Business Logic]:::bloc
        DL[Data Layer]:::data
        SV[Services]:::service
        UT[Utilities]:::util
        PR[Proto Files]:::proto
    end

    %% Client Layer
    subgraph ClientLayer[Client Layer]
        %% Features
        subgraph Features
            Auth[Authorization]:::ui
            click Auth "https://github.com/taskemapp/taskem/tree/develop/lib/src/features/authorization/"
            Task[Task Management]:::ui
            click Task "https://github.com/taskemapp/taskem/tree/develop/lib/src/features/task/"
            Team[Team Management]:::ui
            click Team "https://github.com/taskemapp/taskem/tree/develop/lib/src/features/team/"
            Home[Home]:::ui
            click Home "https://github.com/taskemapp/taskem/tree/develop/lib/src/features/home/"
            Init[Initialization]:::ui
            click Init "https://github.com/taskemapp/taskem/tree/develop/lib/src/features/initialization/"
        end

        %% BLoC Layer
        subgraph BusinessLogic[Business Logic Layer]
            AuthBloc[Auth Controller]:::bloc
            click AuthBloc "https://github.com/taskemapp/taskem/tree/develop/lib/src/features/authorization/controllers/"
            TaskBloc[Task Controller]:::bloc
            click TaskBloc "https://github.com/taskemapp/taskem/tree/develop/lib/src/features/task/controller/"
            TeamBloc[Team Controller]:::bloc
            click TeamBloc "https://github.com/taskemapp/taskem/tree/develop/lib/src/features/team/controller/"
            InitBloc[Init Logic]:::bloc
            click InitBloc "https://github.com/taskemapp/taskem/tree/develop/lib/src/features/initialization/logic/"
        end

        %% Data Layer
        subgraph DataLayer[Data Layer]
            AuthRepo[Auth Repository]:::data
            TaskRepo[Task Repository]:::data
            click TaskRepo "https://github.com/taskemapp/taskem/tree/develop/lib/src/features/task/repositories/"
            TeamRepo[Team Repository]:::data
            click TeamRepo "https://github.com/taskemapp/taskem/tree/develop/lib/src/features/team/repositories/"
        end

        %% Cross-Cutting
        subgraph CrossCutting[Cross-Cutting Concerns]
            I18n[Internationalization]:::util
            click I18n "https://github.com/taskemapp/taskem/tree/develop/lib/src/i18n/"
            Theme[Theme Management]:::util
            click Theme "https://github.com/taskemapp/taskem/tree/develop/lib/src/common/theme/"
            Routes[Route Management]:::util
            click Routes "https://github.com/taskemapp/taskem/tree/develop/lib/src/routes/"
            CommonWidgets[Common Widgets]:::util
            click CommonWidgets "https://github.com/taskemapp/taskem/tree/develop/lib/src/core/widgets/"
            CoreUtils[Core Utilities]:::util
            click CoreUtils "https://github.com/taskemapp/taskem/tree/develop/lib/src/core/extensions/"
        end
    end

    %% Proto Definitions
    subgraph ProtoLayer[Proto Definitions]
        AuthProto[Auth Proto]:::proto
        click AuthProto "https://github.com/taskemapp/taskem/blob/develop/proto/auth.proto"
        TaskProto[Task Proto]:::proto
        click TaskProto "https://github.com/taskemapp/taskem/blob/develop/proto/task.proto"
        TeamProto[Team Proto]:::proto
        click TeamProto "https://github.com/taskemapp/taskem/blob/develop/proto/team.proto"
    end

    %% Backend Services
    subgraph BackendLayer[Backend Services Layer]
        AuthService[Auth Service]:::service
        click AuthService "https://github.com/taskemapp/taskem/tree/develop/lib/src/generated/auth/"
        TaskService[Task Service]:::service
        click TaskService "https://github.com/taskemapp/taskem/tree/develop/lib/src/generated/task/"
        TeamService[Team Service]:::service
        click TeamService "https://github.com/taskemapp/taskem/tree/develop/lib/src/generated/team/"
    end

    %% Relationships
    Auth --> AuthBloc
    Task --> TaskBloc
    Team --> TeamBloc
    Home --> TaskBloc
    Home --> TeamBloc
    Init --> InitBloc

    AuthBloc --> AuthRepo
    TaskBloc --> TaskRepo
    TeamBloc --> TeamRepo

    AuthRepo --> AuthService
    TaskRepo --> TaskService
    TeamRepo --> TeamService

    AuthService --> AuthProto
    TaskService --> TaskProto
    TeamService --> TeamProto

    CrossCutting -.-> Features
    CrossCutting -.-> BusinessLogic
```
