How nikhil1479/usepopcorn works
Project Type and Purpose
• This is a front-end only, single-page React application (bootstrapped with Create React App) that presents movie data, allows star ratings, and persists user selections in localStorage. There is no traditional backend service in the repo; all logic lives in the client.
Core Architectural Layers
a. CI/CD Layer
• GitHub repository with three workflows:
– node.js.yml (install, lint, test)
– jira-issue-check.yml (PR validation against Jira)
– EmailNotificationonMasterPushorPullRequest.yml (email alerts)
• Artifacts: package.json scripts (start, test, build, eject)
b. Build & Deployment Layer
• “npm run build” invokes react-scripts → Webpack + Babel → outputs static files into /build
• Deployment target: any static host (e.g., GitHub Pages, S3, Netlify)
c. Runtime (Client) Layer
• Browser loads index.html + CSS + JS bundles
• React app bootstraps in src/index.js → renders <App/> into DOM
• Application UI composed of React components and custom hooks
• Data persistence via window.localStorage
• (Optionally) external movie API calls if useMovies hook is extended
Main Components & Interactions
• Browser Client
→ serves HTML/CSS/JS → React runtime
• React Application
• App.js
• UI Components: StarRating.js, MovieData.js, _codux boards
• Custom Hooks:
– useKey.js (keyboard shortcuts)
– useLocalStorage.js (persist state)
– useMovies.js (fetch/serve movie list)
• Styling: App.css, index.css
• Data Store
• Browser localStorage (via useLocalStorage hook)
• External Services (if any)
• Third-party movie API (not in code but common extension)
Data Flow Example:
User clicks rating → StarRating component fires event → useLocalStorage updates persisted state → App re-renders MovieData → UI reflects new rating
Architectural Patterns & Principles
• Component-Based UI (React)
• Unidirectional Data Flow (props & hooks)
• Separation of Concerns:
• UI components vs. data hooks vs. styling
• CI/CD pipelines separated from client runtime
• Progressive Web App readiness (manifest.json, service worker stubs via CRA)