How karanvirheer/statflix works
Project type and purpose
• This is a full-stack web application named “StatFlix.”
• Purpose: Allow users to upload their Netflix viewing history, normalize and enrich the data via TMDb, persist it in PostgreSQL, and display interactive analytics in the browser.
File structure
• Top-level:
• docker-compose.yml – orchestrates frontend, backend, and database containers.
• frontend/ – React app with TailwindCSS; Dockerfile, public and src folders.
• backend/ – Node.js/Express API; Dockerfile, src (api, db, utils), data (csv files & tests).
• Patterns: clear separation of concerns (frontend vs. backend vs. DB).
• Tests: sample CSV files under backend/data/tests to validate parsing/normalization logic.
Extract insights from the README
• Components: React UI, Express API, PostgreSQL, TMDb external service.
• Deploy: Docker, docker-compose, hosting on Vercel/Render.
• Data flow: Upload CSV → backend normalizes/enriches → store in Postgres → analytics served to frontend.
Main components
a. Frontend (React + Tailwind)
b. Backend (Node.js/Express)
c. PostgreSQL database
d. TMDb external API
f. Users (browser client)
Relationships & interactions
• User’s browser ↔ Frontend: HTTP(S) requests, UI flows.
• Frontend ↔ Backend: REST API calls (file upload, fetch analytics endpoints).
• Backend ↔ PostgreSQL: SQL queries to read/write normalized/enriched data.
• Backend ↔ TMDb API: HTTP calls to fetch metadata (genres, runtime).
• Docker-Compose: shows co-located containers and their exposed ports.
Architectural patterns & design principles
• Separation of concerns: UI, business logic, data persistence.
• Layered design:
• API layer (Express routes)
• Service/util layer (helpers, TMDb client, normalization)
• Data access layer (db.js)
• Stateless backend: user session data persisted in Postgres.
• Containerization: each component runs in an isolated Docker container for consistency.
Key technologies/frameworks
• React.js, TailwindCSS (frontend)
• Node.js, Express.js (backend)
• PostgreSQL (database)
• TMDb API (external enrichment)
• Docker & docker-compose (container orchestration)