# tkhwang/what-todo architecture

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

- Interactive diagram: https://gitdiagram.com/tkhwang/what-todo
- Repository: https://github.com/tkhwang/what-todo

## Overview

##### Main Components Identification

The system consists of three main applications and a shared package:
- Mobile App (React Native/Expo)
- Web App (Next.js)
- Backend (Nest.js)
- Shared Models Package

##### Connection Flows

- API calls between clients and backend
- Authentication flows
- Database operations
- Real-time updates using Firestore listeners

##### Specific Implementation Details

Technical details such as:
- Firebase integration points
- Authentication strategies
- API endpoints structure
- Real-time data flow

**┌─────────────────────────────────────────────────────┐**
- Client Layer                                        │
- ┌─────────────┐                  ┌──────────────┐   │
- Mobile App │                  │   Web App    │   │
- (Expo)     │                  │   (Next.js)  │   │
- ┘                  └──────────────┘   │
- ┤
- Shared Models Package                               │
- ┤
- Backend Layer                                       │
- ┌─────────────────────────────────────────────┐    │
- Nest.js Backend                │    │
- ┌─────────┐ ┌────────┐ ┌──────────────┐   │    │
- Auth   │ │ Users  │ │    Tasks     │   │    │
- ┘ └────────┘ └──────────────┘   │    │
- ┘    │
- ┤
- External Services                                   │
- ┌─────────────────────────────────────────────┐    │
- Firebase Services              │    │
- ┌─────────┐ ┌────────┐ ┌──────────────┐   │    │
- Auth   │ │Firestore│ │   Admin     │   │    │
- ┘ └────────┘ └──────────────┘   │    │
- ┘    │
- ┘

##### Key Features to Highlight

- Expert/Supervisor interaction flows
- Todo management lifecycle
- Real-time updates system
- Cross-platform compatibility
- Shared type system through the models package

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles and Classes
    classDef client fill:#a8d1ff,stroke:#000
    classDef backend fill:#ffb3b3,stroke:#000
    classDef database fill:#c2f0c2,stroke:#000
    classDef shared fill:#ffecb3,stroke:#000
    classDef firebase fill:#ffd9b3,stroke:#000

    %% Client Layer
    subgraph ClientLayer["Client Applications"]
        MobileApp["Mobile App\n(React Native/Expo)"]
        MobileAuth["Auth Components"]
        MobileTask["Task Management"]
        MobileNav["Navigation"]
        
        WebApp["Web App\n(Next.js)"]
        WebAuth["Auth Features"]
        WebWorkspace["Workspace Features"]
        
        MobileApp --> MobileAuth
        MobileApp --> MobileTask
        MobileApp --> MobileNav
        
        WebApp --> WebAuth
        WebApp --> WebWorkspace
    end

    %% Shared Models Layer
    subgraph SharedModels["Shared Models Package"]
        TaskModels["Task Models"]
        UserModels["User Models"]
        ListModels["List Models"]
        TodoModels["Todo Models"]
    end

    %% Backend Layer
    subgraph BackendLayer["Backend (Nest.js)"]
        AuthModule["Auth Module"]
        UsersModule["Users Module"]
        ListsModule["Lists Module"]
        TasksModule["Tasks Module"]
        StepsModule["Steps Module"]
        TodosModule["Todos Module"]
        FirebaseModule["Firebase Module"]
        FirebaseConfig["Firebase Config"]
        FirebaseStrategy["Firebase Auth Strategy"]
    end

    %% Firebase Services Layer
    subgraph FirebaseServices["Firebase Services"]
        FirebaseAuth["Firebase Auth"]
        Firestore["Firestore Database"]
        FirebaseAdmin["Firebase Admin"]
    end

    %% Connections
    ClientLayer --> SharedModels
    ClientLayer --> BackendLayer
    BackendLayer --> FirebaseServices
    BackendLayer --> SharedModels

    %% Styling
    class MobileApp,WebApp client
    class AuthModule,UsersModule,ListsModule,TasksModule,StepsModule,TodosModule,FirebaseModule backend
    class FirebaseAuth,Firestore,FirebaseAdmin firebase
    class TaskModels,UserModels,ListModels,TodoModels shared

    %% Click Events
    click MobileApp "https://github.com/tkhwang/WHAT-todo/tree/main/apps/mobile-app/"
    click MobileAuth "https://github.com/tkhwang/WHAT-todo/tree/main/apps/mobile-app/components/Auth/"
    click MobileTask "https://github.com/tkhwang/WHAT-todo/tree/main/apps/mobile-app/components/Task/"
    click MobileNav "https://github.com/tkhwang/WHAT-todo/tree/main/apps/mobile-app/app/(auth)/(tabs)/"
    
    click WebApp "https://github.com/tkhwang/WHAT-todo/tree/main/apps/web/"
    click WebAuth "https://github.com/tkhwang/WHAT-todo/tree/main/apps/web/src/features/auth/"
    click WebWorkspace "https://github.com/tkhwang/WHAT-todo/tree/main/apps/web/src/features/workspaces/"
    
    click AuthModule "https://github.com/tkhwang/WHAT-todo/tree/main/apps/backend/src/auth/"
    click UsersModule "https://github.com/tkhwang/WHAT-todo/tree/main/apps/backend/src/users/"
    click ListsModule "https://github.com/tkhwang/WHAT-todo/tree/main/apps/backend/src/lists/"
    click TasksModule "https://github.com/tkhwang/WHAT-todo/tree/main/apps/backend/src/tasks/"
    click StepsModule "https://github.com/tkhwang/WHAT-todo/tree/main/apps/backend/src/steps/"
    click TodosModule "https://github.com/tkhwang/WHAT-todo/tree/main/apps/backend/src/todos/"
    click FirebaseModule "https://github.com/tkhwang/WHAT-todo/tree/main/apps/backend/src/firebase/"
    click FirebaseConfig "https://github.com/tkhwang/WHAT-todo/blob/main/apps/backend/src/config/firebase.config.ts"
    click FirebaseStrategy "https://github.com/tkhwang/WHAT-todo/blob/main/apps/backend/src/auth/firebase-auth.strategy.ts"
    
    click TaskModels "https://github.com/tkhwang/WHAT-todo/tree/main/packages/models/src/task/"
    click UserModels "https://github.com/tkhwang/WHAT-todo/tree/main/packages/models/src/user/"
    click ListModels "https://github.com/tkhwang/WHAT-todo/tree/main/packages/models/src/list/"
    click TodoModels "https://github.com/tkhwang/WHAT-todo/tree/main/packages/models/src/todo/"
```
