How satishkumarkolamudi/taskmanager works
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