# trankhanhnamhoccode/screcaap architecture

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

- Interactive diagram: https://gitdiagram.com/trankhanhnamhoccode/screcaap
- Repository: https://github.com/trankhanhnamhoccode/screcaap

## Overview

Screcaap is a Python modular-monolith MVP for interpreting laptop activity from periodic screenshots. Its intended path is screenshot capture through an API, background processing, and timeline/analysis results; however, the README says product endpoints and capture processing are not implemented. The graph therefore shows the documented API and worker runtime alongside the planned service, OCR, LLM, storage, and persistence areas without inventing connections between them. Edges are limited to visible imports/calls or README statements; several product modules were not sampled.

Main entry points: [`server/database/repositories`](https://github.com/trankhanhnamhoccode/screcaap/tree/main/server/database/repositories) (SQL repositories), [`server/storage`](https://github.com/trankhanhnamhoccode/screcaap/tree/main/server/storage) (Image storage adapters), [`server/workers/queue.py`](https://github.com/trankhanhnamhoccode/screcaap/blob/main/server/workers/queue.py) (RQ queue setup), [`server/database/models`](https://github.com/trankhanhnamhoccode/screcaap/tree/main/server/database/models) (User device capture models)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API and product"]
  node_api_app["FastAPI bootstrap<br/>[main.py]"]
  node_capture_routes["Capture routes<br/>[captures.py]"]
  node_timeline_routes["Timeline routes<br/>[timeline.py]"]
  node_capture_service["Capture service<br/>[capture_service.py]"]
  node_timeline_service["Timeline service"]
  node_schemas["Shared schemas"]
end

subgraph group_processing["Processing capabilities"]
  node_analysis_service["Analysis service"]
  node_capture_worker["Capture worker<br/>[capture_worker.py]"]
  node_ocr["OCR adapters"]
  node_llm["LLM adapters"]
end

subgraph group_persistence["Domain and persistence"]
  node_domain["Domain entities<br/>[entities.py]"]
  node_status["Processing status<br/>[enums.py]"]
  node_repositories["SQL repositories"]
  node_models["User device capture models"]
  node_session["Database sessions<br/>[session.py]"]
end

subgraph group_runtime["Runtime infrastructure"]
  node_storage_bootstrap["Storage bootstrap<br/>[bootstrap.py]"]
  node_storage_adapters["Image storage adapters"]
  node_worker_entry["RQ worker entry<br/>[worker.py]"]
  node_queue["RQ queue setup<br/>[queue.py]"]
  node_config["Runtime settings<br/>[config.py]"]
end

node_user(("Laptop user"))
node_postgres[("PostgreSQL")]
node_object_store[("S3 compatible store")]
node_redis[("Redis")]

node_user -->|"uses API"| node_api_app
node_session -->|"loads settings"| node_config
node_models -->|"uses base"| node_session
node_models -->|"uses status"| node_status
node_repositories -->|"maps records"| node_models
node_repositories -->|"maps entities"| node_domain
node_repositories -->|"converts status"| node_status
node_storage_bootstrap -->|"creates client"| node_storage_adapters
node_worker_entry -->|"creates queue"| node_queue
node_queue -->|"loads settings"| node_config
node_queue -->|"connects to"| node_redis
node_storage_adapters -->|"loads settings"| node_config
node_storage_adapters -->|"configures client"| node_object_store

click node_api_app "https://github.com/trankhanhnamhoccode/screcaap/blob/main/server/main.py"
click node_capture_routes "https://github.com/trankhanhnamhoccode/screcaap/blob/main/server/api/routes/captures.py"
click node_timeline_routes "https://github.com/trankhanhnamhoccode/screcaap/blob/main/server/api/routes/timeline.py"
click node_capture_service "https://github.com/trankhanhnamhoccode/screcaap/blob/main/server/services/capture_service.py"
click node_timeline_service "https://github.com/trankhanhnamhoccode/screcaap/blob/main/server/services/timeline_service.py"
click node_analysis_service "https://github.com/trankhanhnamhoccode/screcaap/blob/main/server/services/analysis_service.py"
click node_capture_worker "https://github.com/trankhanhnamhoccode/screcaap/blob/main/server/workers/capture_worker.py"
click node_ocr "https://github.com/trankhanhnamhoccode/screcaap/tree/main/server/ocr"
click node_llm "https://github.com/trankhanhnamhoccode/screcaap/tree/main/server/llm"
click node_schemas "https://github.com/trankhanhnamhoccode/screcaap/tree/main/shared/schemas"
click node_domain "https://github.com/trankhanhnamhoccode/screcaap/blob/main/server/domain/entities.py"
click node_status "https://github.com/trankhanhnamhoccode/screcaap/blob/main/server/domain/enums.py"
click node_repositories "https://github.com/trankhanhnamhoccode/screcaap/tree/main/server/database/repositories"
click node_models "https://github.com/trankhanhnamhoccode/screcaap/tree/main/server/database/models"
click node_session "https://github.com/trankhanhnamhoccode/screcaap/blob/main/server/database/session.py"
click node_storage_bootstrap "https://github.com/trankhanhnamhoccode/screcaap/blob/main/server/storage/bootstrap.py"
click node_storage_adapters "https://github.com/trankhanhnamhoccode/screcaap/tree/main/server/storage"
click node_worker_entry "https://github.com/trankhanhnamhoccode/screcaap/blob/main/server/workers/worker.py"
click node_queue "https://github.com/trankhanhnamhoccode/screcaap/blob/main/server/workers/queue.py"
click node_config "https://github.com/trankhanhnamhoccode/screcaap/blob/main/server/config.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_api_app,node_capture_routes,node_timeline_routes,node_capture_service,node_timeline_service,node_schemas,node_user toneBlue
class node_analysis_service,node_capture_worker,node_ocr,node_llm,node_postgres,node_object_store,node_redis toneAmber
class node_domain,node_status,node_repositories,node_models,node_session toneMint
class node_storage_bootstrap,node_storage_adapters,node_worker_entry,node_queue,node_config toneRose
```

## Components

### API and product

- [FastAPI bootstrap](https://github.com/trankhanhnamhoccode/screcaap/blob/main/server/main.py): `server/main.py`
- [Capture routes](https://github.com/trankhanhnamhoccode/screcaap/blob/main/server/api/routes/captures.py): `server/api/routes/captures.py`
- [Timeline routes](https://github.com/trankhanhnamhoccode/screcaap/blob/main/server/api/routes/timeline.py): `server/api/routes/timeline.py`
- [Capture service](https://github.com/trankhanhnamhoccode/screcaap/blob/main/server/services/capture_service.py): `server/services/capture_service.py`
- [Timeline service](https://github.com/trankhanhnamhoccode/screcaap/blob/main/server/services/timeline_service.py): `server/services/timeline_service.py`
- [Shared schemas](https://github.com/trankhanhnamhoccode/screcaap/tree/main/shared/schemas): `shared/schemas`

### Processing capabilities

- [Analysis service](https://github.com/trankhanhnamhoccode/screcaap/blob/main/server/services/analysis_service.py): `server/services/analysis_service.py`
- [Capture worker](https://github.com/trankhanhnamhoccode/screcaap/blob/main/server/workers/capture_worker.py): `server/workers/capture_worker.py`
- [OCR adapters](https://github.com/trankhanhnamhoccode/screcaap/tree/main/server/ocr): `server/ocr`
- [LLM adapters](https://github.com/trankhanhnamhoccode/screcaap/tree/main/server/llm): `server/llm`

### Domain and persistence

- [Domain entities](https://github.com/trankhanhnamhoccode/screcaap/blob/main/server/domain/entities.py): `server/domain/entities.py`
- [Processing status](https://github.com/trankhanhnamhoccode/screcaap/blob/main/server/domain/enums.py): `server/domain/enums.py`
- [SQL repositories](https://github.com/trankhanhnamhoccode/screcaap/tree/main/server/database/repositories): `server/database/repositories`
- [User device capture models](https://github.com/trankhanhnamhoccode/screcaap/tree/main/server/database/models): `server/database/models`
- [Database sessions](https://github.com/trankhanhnamhoccode/screcaap/blob/main/server/database/session.py): `server/database/session.py`

### Runtime infrastructure

- [Storage bootstrap](https://github.com/trankhanhnamhoccode/screcaap/blob/main/server/storage/bootstrap.py): `server/storage/bootstrap.py`
- [Image storage adapters](https://github.com/trankhanhnamhoccode/screcaap/tree/main/server/storage): `server/storage`
- [RQ worker entry](https://github.com/trankhanhnamhoccode/screcaap/blob/main/server/workers/worker.py): `server/workers/worker.py`
- [RQ queue setup](https://github.com/trankhanhnamhoccode/screcaap/blob/main/server/workers/queue.py): `server/workers/queue.py`
- [Runtime settings](https://github.com/trankhanhnamhoccode/screcaap/blob/main/server/config.py): `server/config.py`

### Other components

- **Laptop user**
- **PostgreSQL**
- **S3 compatible store**
- **Redis**

## Connections

- Laptop user → FastAPI bootstrap: uses API (evidence: `README.md`)
- Database sessions → Runtime settings: loads settings (evidence: `server/database/session.py`)
- User device capture models → Database sessions: uses base (evidence: `server/database/models/capture.py`)
- User device capture models → Processing status: uses status (evidence: `server/database/models/capture.py`)
- SQL repositories → User device capture models: maps records (evidence: `server/database/repositories/capture.py`)
- SQL repositories → Domain entities: maps entities (evidence: `server/database/repositories/capture.py`)
- SQL repositories → Processing status: converts status (evidence: `server/database/repositories/capture.py`)
- Storage bootstrap → Image storage adapters: creates client (evidence: `server/storage/bootstrap.py`)
- RQ worker entry → RQ queue setup: creates queue (evidence: `server/workers/worker.py`)
- RQ queue setup → Runtime settings: loads settings (evidence: `server/workers/queue.py`)
- RQ queue setup → Redis: connects to (evidence: `server/workers/queue.py`)
- Image storage adapters → Runtime settings: loads settings (evidence: `server/storage/s3.py`)
- Image storage adapters → S3 compatible store: configures client (evidence: `server/storage/s3.py`)
