How honcito/hong_movies works
Project type and purpose
• This is primarily a backend service for a personal full-stack movie streaming platform (“HONG_MOVIES”).
• Purpose: expose REST endpoints for user authentication/authorization (role-based), user management, movie lookup (via TMDB API), and secure streaming of private video files hosted on an Ubuntu server.
File structure
• Top level:
• README.md, LICENSE, .gitignore
• backend/ (entire Node.js service)
• backend/
• package.json / package-lock.json – Node.js dependencies
• src/
– config/db.js – database connection (likely MongoDB)
– controllers/ – business-logic handlers (auth, user, movie)
– middlewares/ – auth checks, rate limiting, validation, error handling
– models/ – Mongoose schema definitions (User.js, Movie.js)
– routes/ – Express routers (authRoutes, userRoutes, movieRoutes)
– utils/ – JWT generation
– validation/ – request payload schemas
– server.js – Express app setup, middleware registration, route mounting
• No frontend folder in this repo; assume a separate client (web/mobile) consumes the API.
Key insights from README
• Role-based access (admin vs regular users)
• TMDB integration for movie metadata
• Private video streaming from an Ubuntu file store
• Multi-language UI + theme toggling (light/dark) – client-side concerns
Main components
a. Clients
– Web/Mobile App (React/Vue/Flutter): UI layer with routing, theme + language toggle
b. API Server (Node.js / Express)
– Route layer → Controller layer → Model layer
– Middlewares: auth JWT check, isAdmin guard, rate limiter, request validators, error handler
– Utils: JWT generator
c. Database
– MongoDB (hosted or Atlas) storing Users and Movies
d. External Services
– TMDB REST API for fresh movie metadata
e. Video Storage & Streaming
– Ubuntu server (NGINX or custom) hosting video files behind an auth proxy
Relationships & interactions
• Client sends HTTP(S) requests to API Gateway (Express server)
• AuthController issues JWTs; middleware protects movie/user routes
• MovieController fetches and caches metadata from TMDB, or reads from MongoDB
• When streaming, API either issues a signed URL or proxies the video request to the Ubuntu server
• All persistent reads/writes go to MongoDB
• RateLimiter middleware caps abusive request patterns
Architectural patterns & design principles
• Layered architecture (Routes → Controllers → Models)
• RESTful API design
• Middleware pipeline for cross-cutting concerns (auth, validation, errors)
• Single Responsibility: each controller handles one resource type
• Extensibility: external TMDB integration via a service adapter
Technologies & frameworks
• Node.js, Express.js
• MongoDB + Mongoose
• JSON Web Tokens (JWT)
• TMDB external REST service
• NGINX or custom streaming proxy on Ubuntu