docs(react_frontend): add comprehensive documentation & AGENTS.md

- docs/README.md: overview and table of contents
- docs/tech_stack.md: full dependency inventory and design decisions
- docs/project_structure.md: directory tree with conventions
- docs/architecture.md: data flow, layer responsibilities, key patterns
- docs/routing.md: route table, code splitting, discover categories
- docs/state_management.md: Zustand stores and React Query conventions
- docs/api_layer.md: all API modules with endpoint mappings
- docs/components.md: layout, entries, collections, charts, dialogs, UI primitives
- docs/pages.md: all 16 pages with features and routes
- docs/styling.md: theming, CSS tokens, responsive breakpoints, animations
- AGENTS.md: architecture summary, code conventions, data flow, key files
This commit is contained in:
Mohammed Abad committed 2026-04-10 02:44:06 +01:00
1 parent 6bff2055b4
commit d28b4caa7e
14 files changed
+1266 -78

No files matched your search

+30 -11
View File
@@ -1,6 +1,6 @@
# Agents & Autonomous Logic
> **Last reviewed:** 2026-03-30
> **Last reviewed:** 2026-04-09
---
@@ -109,16 +109,17 @@ GET /people/:id
These are not autonomous but are invoked by the managers above:
| Service | File | Role |
| ------------------------ | ------------------------------------ | ----------------------------------------------------------------------------------------- |
| `tmdbService` | `services/tmdbService.js` | HTTP client wrapping TMDB API v3 (entries, seasons, credits, people, collections, images) |
| `mediaDownloaderService` | `services/mediaDownloaderService.js` | Downloads remote images to local filesystem |
| `mediaOptimizerService` | `services/mediaOptimizerService.js` | Generates low-resolution preview variants (JPEG/PNG) |
| `configService` | `services/configService.js` | Reads/writes `settings.json`; provides TMDB API credentials and data paths |
| `storageService` | `services/storageService.js` | Low-level file write abstraction |
| `networkService` | `services/networkService.js` | Creates or updates TV network records |
| `importerService` | `services/importerService.js` | Bulk-import orchestration with TMDB rate-limit handling (35 req / 10 s) |
| `maintenanceService` | `services/maintenanceService.js` | Detects and cleans orphan files and DB records |
| Service | File | Role |
| ------------------------ | ------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| `tmdbService` | `services/tmdbService.js` | HTTP client wrapping TMDB API v3 (entries, seasons, credits, people, collections, images, trending, popular, top-rated, upcoming, search) |
| `mediaDownloaderService` | `services/mediaDownloaderService.js` | Downloads remote images to local filesystem |
| `mediaOptimizerService` | `services/mediaOptimizerService.js` | Generates low-resolution preview variants (JPEG/PNG) |
| `configService` | `services/configService.js` | Reads/writes `settings.json`; provides TMDB API credentials and data paths |
| `storageService` | `services/storageService.js` | Low-level file write abstraction |
| `networkService` | `services/networkService.js` | Creates or updates TV network records |
| `importerService` | `services/importerService.js` | Bulk-import orchestration with TMDB rate-limit handling (35 req / 10 s) |
| `maintenanceService` | `services/maintenanceService.js` | Detects and cleans orphan files and DB records |
| `statisticsController` | `controllers/statisticsController.js` | Aggregates watch-time, watch-count, and weekday-distribution statistics via raw SQL |
---
@@ -148,3 +149,21 @@ The manager pattern is well-suited for upgrading to a true agentic architecture
- **Observation loop** — The lazy-fetch pattern (`fully_fetched` checks) already implements observe → decide → act semantics.
No such integration exists today. All decision logic is deterministic and rule-based.
---
## TMDB Proxy Layer
The backend exposes a set of **proxy endpoints** under `/api/v1/entries/tmdb/*` and `/api/v1/people/tmdb/*` that forward paginated requests to the TMDB API. This keeps the TMDB API key server-side and provides a uniform interface for the frontend's discover/search features:
| Endpoint | TMDB Operation |
| ----------------------------------- | --------------------- |
| `GET /entries/tmdb/trending/:type` | Trending movies / TV |
| `GET /entries/tmdb/popular/:type` | Popular movies / TV |
| `GET /entries/tmdb/top-rated/:type` | Top-rated movies / TV |
| `GET /entries/tmdb/upcoming/movie` | Upcoming movies |
| `GET /entries/tmdb/search?query=` | Multi-search |
| `GET /people/tmdb/popular` | Popular people |
| `GET /people/tmdb/search?query=` | Search people |
These are stateless pass-through calls — no local data is written.