How seulnan/movie_server works
Project type and purpose
• This is a RESTful backend service for a movie page, built in Node.js (plain Express/Nest-style structure) that exposes endpoints for “works” (movies) and handles file uploads to Amazon S3.
• Purpose: Provide mentors and mentees with a live API to fetch, create, update movie data, and upload related assets (e.g., images) instead of static JSON.
File structure
• server.js & app.js
• server.js – entry point that starts the HTTP server
• app.js – configures Express, middleware, routes
• config/
• db.js – database connection logic (likely MongoDB or another datastore)
• routes/
• worksRouter.js – routes for CRUD operations on “works”
• upload.js – routes handling file upload requests
• controllers/
• worksController.js – business logic for processing “works” requests
• models/
• work.js – data schema/model definition
• utils/
• test-s3.js – helper for validating S3 connectivity
• upload-data.js – utility to prepare and send files to S3
• package.json & package-lock.json – dependencies (Express, AWS SDK, database ORM)
• .gitignore/.DS_Store – housekeeping
README for additional insights
• Although it lists NestJS, the code structure follows Express; in either case the core is a JavaScript-based HTTP API.
• External dependency: Amazon S3 for asset storage.
• No built-in frontend here; expects consumer (React FE) to call these endpoints.
a. Main components
• Client (React FE)
• HTTP API Server (Node.js + Express)
• Database (e.g., MongoDB)
• Amazon S3 bucket
• Utilities/Helpers (S3 uploader and test scripts)
b. Relationships & interactions
1. Client ► HTTP API Server – sends REST requests (GET/POST/PUT/DELETE)
2. Server ► Database – reads/writes work records
3. Server ► Amazon S3 – uploads/retrieves file assets
4. Server uses utils/test-s3 to verify connectivity at startup
5. Controllers orchestrate calls: routes → controllers → models/utils → external services
c. Architectural patterns/principles
• MVC-lite: Routes (Router) → Controllers → Models (schema + DB adapter)
• Single-process, monolithic service
• Separation of concerns: config, routes, controllers, models, utils
• Externalized configuration (config/db.js)
d. Key technologies
• Node.js / Express
• AWS SDK (S3)
• Database driver or ORM (e.g., Mongoose if MongoDB)
• JavaScript modules (ES5/ES6)
Detail
• Routes
• Controllers
• Models
• Utils
• External dependency (DB, S3) is represented