4.1 KiB
4.1 KiB
title, tags
| title | tags | ||
|---|---|---|---|
| Architecture |
|
Architecture
Overview
Showy is a single-user media tracking application with three deployment layers:
| Layer | Technology | Role |
|---|---|---|
| Backend | Node.js + Express + Sequelize + MySQL | REST API, data persistence, TMDB proxy |
| Frontend | React 19 + TypeScript + Vite | SPA with shadcn/ui components |
| Electron | Electron 34 | Desktop wrapper, spawns backend as child process |
See Tech Stack for complete version inventory.
System Diagram
graph TD
subgraph Desktop["Electron (Desktop)"]
E[Main Process] --> B
E --> FE
end
subgraph FE["React Frontend"]
Pages[Pages] --> Hooks
Hooks --> APIClients[API Clients]
Hooks --> LibStore[Zustand Library Store]
APIClients --> |Axios| API
end
subgraph B["Backend"]
API[Express Routes] --> Controllers
Controllers --> Services
Services --> Models[Sequelize Models]
Services --> TMDB[TMDB API]
Models --> DB[(MySQL - Showzy)]
end
Data Flow
Library Loading
- App mounts →
useLibrary()hook firesGET /api/v1/entries - Backend returns all entries with IDs, ratings, genres, networks, media, seasons, seens
- Response normalized by Normalizers (
normalizeEntry) - Entries loaded into Stores as
Map<number, Entry>for O(1) lookup isLoadedflag set → pages render
Adding an Entry
- User searches TMDB → selects result →
POST /api/v1/entrieswith{tmdb_id, is_tvserie} - Services orchestrates the full pipeline:
- Fetch from TMDB → save entry + IDs + ratings + genres + networks
- If TV: fetch all seasons/episodes
- Fetch credits (cast/crew)
- Download media (posters, backdrops, logos) → generate previews
- Fetch collection if applicable
- Response added to Zustand store → UI updates
Lazy Refresh
getEntryByIdcheckslast_fetch— if null or >24h old (and series not ended), triggers TMDB refresh- Same pattern for People via
getUpdatedPerson
Media Serving
- Frontend requests
/api/v1/media/:category/:type/:size/:fileName - Backend reads from
{userDataPath}/images/...directory - Preview files:
{uuid}_preview.jpg— full files:{uuid}.ext
File Structure
Showy/
├── backend/ → [[Backend]]
│ ├── server.js → Express entry point
│ ├── config/ → DB, relations, hooks, initializer
│ ├── controllers/ → Route handlers
│ ├── services/ → Business logic
│ ├── models/ → Sequelize models → [[Models]]
│ ├── routes/ → Express routers → [[API Reference]]
│ ├── errors/ → Custom errors → [[Error Handling]]
│ ├── middleware/ → Error handler
│ ├── mappers/ → Entry mapper
│ └── utils/ → asyncWrapper, moment
├── react_frontend/ → [[Frontend]]
│ └── src/
│ ├── api/ → Axios clients → [[API Clients]]
│ ├── components/ → UI components → [[Components]]
│ ├── hooks/ → TanStack Query hooks → [[Hooks]]
│ ├── lib/ → Utilities, normalizers
│ ├── pages/ → Route pages → [[Pages]]
│ ├── stores/ → Zustand stores → [[Stores]]
│ └── types/ → TypeScript types → [[Types]]
├── electron/ → [[Electron]]
├── frontend/ → Legacy Angular app (unused)
├── docs-vault/ → This documentation
└── docker-compose.yml → [[Deployment]]
Security Model
[!warning] No Authentication Showy is designed as a single-user local application. There is no authentication or authorization. CORS is set to
*. The TMDB API key is stored server-side insettings.json.
See Also
- Backend — Server-side details
- Frontend — Client-side details
- Database — Data layer
- Deployment — Docker setup