# satishkumarkolamudi/taskmanager architecture

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

- Interactive diagram: https://gitdiagram.com/satishkumarkolamudi/taskmanager
- Repository: https://github.com/satishkumarkolamudi/taskmanager

## Overview

##### Project type and purpose
- This is a full-stack (monolithic) Python service with two interfaces:
a) A FastAPI HTTP service exposing task management endpoints.
b) A CLI client (`clinet.py`) that calls these endpoints.
- It simulates Unix-style `ls`/`fork` on tasks, persists tasks in a JSON file, manages lifecycles via a background worker, and secures calls via JWT.

##### File structure
- Top-level:
- Dockerfile / requirements.txt / main.py – entry points & containerization
- app/ – main service code, organized by function:
– api/routes.py – HTTP endpoints
– core/task.py & task_manager.py – domain model & business logic
– db/file_store.py – persistence layer to `tasks/tasks.json`
– services/background_worker.py – lifecycle simulator
– utils/auth.py & logger.py – cross-cutting concerns
- cli/clinet.py – command-line client
- tasks/tasks.json – persistent store
- tests/ – unit/integration tests
- Patterns: layered (API → service/core → storage), background worker, token-based auth, file‐based persistence.

##### Key README insights
- Exposes REST endpoints: GET/POST/DELETE on `/tasks`, plus `/token`.
- Uses JWT for auth.
- CLI wraps these endpoints.
- Background worker simulates state changes.

##### Components
a. Main components:
- Client Layer
– CLI tool (`clinet.py`)
– Optional: any third-party HTTP client (curl, Postman)
- API Layer (FastAPI Service)
– Router / Controllers (app/api/routes.py)
– Auth middleware (app/utils/auth.py)
– Logger (app/utils/logger.py)
- Business Logic Layer
– Task Manager & Task domain (app/core/*.py)
- Persistence Layer
– FileStore (app/db/file_store.py) → `tasks/tasks.json`
- Background Worker
– Lifecycle simulator (app/services/background_worker.py)
b. Relationships & data flow:
1. CLI / HTTP client sends request → FastAPI router
2. Router authenticates via JWT util → passes to controller
3. Controller calls TaskManager (core)
4. TaskManager uses FileStore to read/write `tasks.json`
5. Controller returns JSON response
6. Background Worker periodically reads from FileStore, updates task status via TaskManager, writes back
c. Architectural patterns & principles:
- Layered architecture (Presentation → Business → Data)
- Separation of concerns (API vs core vs DB vs utils)
- Single‐process background worker (no external queue)
- File‐based persistence for simplicity
- JWT auth as cross-cutting middleware
d. Key technologies & frameworks:
- Python 3.7+
- FastAPI + Uvicorn
- JSON file store
- PyJWT (or similar) for token handling
- CLI built on standard argparse or click

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Layer
    CLI["CLI Client"]:::client
    HTTP["HTTP Client"]:::client

    %% Service Container
    subgraph "FastAPI App"
        API_Main["FastAPI Entry Point"]:::compute
        Router["Router / Controllers"]:::compute
        Auth["Auth Middleware"]:::middleware
        Log["Logger Utility"]:::compute
        Core["TaskManager Core"]:::compute
        Domain["Task Domain Model"]:::compute
        Store["FileStore"]:::storage
        JSON["tasks.json"]:::storage
    end

    %% Background Worker
    Worker["Background Worker"]:::compute

    %% Connections
    CLI -->|HTTP call| API_Main
    HTTP -->|HTTP call| API_Main
    API_Main -->|routes to| Router
    Router -->|"auth check"| Auth
    Auth -->|"log request"| Log
    Router -->|"calls TaskManager"| Core
    Core -->|"uses domain"| Domain
    Core -->|"read/write"| Store
    Store -->|"persists"| JSON

    Worker -->|"reads/writes"| Store
    Worker -->|"uses TaskManager"| Core

    %% Click Events
    click CLI "https://github.com/satishkumarkolamudi/taskmanager/blob/main/cli/clinet.py"
    click API_Main "https://github.com/satishkumarkolamudi/taskmanager/blob/main/main.py"
    click Router "https://github.com/satishkumarkolamudi/taskmanager/blob/main/app/api/routes.py"
    click Auth "https://github.com/satishkumarkolamudi/taskmanager/blob/main/app/utils/auth.py"
    click Log "https://github.com/satishkumarkolamudi/taskmanager/blob/main/app/utils/logger.py"
    click Domain "https://github.com/satishkumarkolamudi/taskmanager/blob/main/app/core/task.py"
    click Core "https://github.com/satishkumarkolamudi/taskmanager/blob/main/app/core/task_manager.py"
    click Store "https://github.com/satishkumarkolamudi/taskmanager/blob/main/app/db/file_store.py"
    click JSON "https://github.com/satishkumarkolamudi/taskmanager/blob/main/tasks/tasks.json"
    click Worker "https://github.com/satishkumarkolamudi/taskmanager/blob/main/app/services/background_worker.py"

    %% Styles
    classDef client fill:#FCF3CF,stroke:#E2B007;
    classDef compute fill:#D6EAF8,stroke:#2874A6;
    classDef storage fill:#D5F5E3,stroke:#239B56;
    classDef middleware fill:#FADBD8,stroke:#CD6155;
```
