How glg-public/glg-simple-movie-app works
Project type and purpose
• This is a full-stack web application built with React (Vite) on the front end and Node.js/TypeScript on the back end.
• It fetches movie and TV data from The Movie Database (TMDb) API (or from local JSON mocks when offline).
• It’s designed to run in Docker for a consistent development environment.
File structure
• Top level: Docker and environment config files (Dockerfile.dev, docker-compose.yml, .env templates, bin/prepare-docker.sh).
• src/: the client-side React application (components, views, hooks, contexts, MSW mocks, styles).
• server/: the back-end API (controllers, router, service layer for TMDb, server-side mocks).
• public/ and index.html: static assets and the single HTML host page for the SPA.
• package.json, vite.config.ts, tsconfig*.json: build and toolchain configuration.
README for additional insights
• Confirms React + Node + TypeScript tech stack.
• Mentions optional MSW mocks via VITE_MOCK_RESULTS=true.
• Describes database tables (MEDIA, USER, relations) conceptually—even though the current server uses JSON mocks rather than a real database.
Main components
a. Front-end Application Container
• React SPA served by Vite (or Docker-mounted static files in production).
• Client-side MSW (Mock Service Worker) that can intercept API calls when enabled.
b. Back-end API Container
• Node.js + Express (or similar) server in server/index.ts.
• Controllers/routers under server/controllers, service layer in server/services (MovieDB.ts).
• Server-side mocks (server/mocks/data/...) used when external API is unreachable.
c. External Services
• The Movie Database (TMDb) REST API.
• (Optional) Docker daemon or local file system mounts for code and env injection.
d. (Conceptual) Database
Relationships and data flows
• User → Browser → React SPA
• React SPA → (MSW? →) API server
• API server → MovieDB service → TMDb API (or server-side JSON mocks)
• API server → (in future) database
• Docker Compose orchestrates two containers (front-end and back-end), injecting /etc/dev.env.
Architectural patterns and key principles
• SPA architecture (separation of concerns: views, controllers, stores).
• API-First design (REST endpoints in Node).
• Service layer abstraction for external API (MovieDB service).
• Mock-first development enabled via MSW both client- and server-side.
• Containerization for environment parity.