How mahbubk/photo-gallery works
Project Type and Purpose
• This is a single-page React application bootstrapped with Create React App.
• It uses Redux for client-side state management and a simple JSON Server (in the SERVER folder) as a mock backend.
File Structure
• Top-level:
• public/ – static assets and HTML template for the React app.
• src/ – React source code, CSS, Redux logic, tests, and entry point (index.js).
• SERVER/ – holds db.json (the mock “database”) and a small public/images directory for static images served by the JSON server.
• Inside src/:
• Components/ – subdivided into Auth, Header, Body, Footer.
• redux/ – action types, action creators (including auth), store configuration, base URL constants, and reducer(s).
• Configuration and scripts in package.json coordinate running both the React dev server and JSON server.
Key Insights from the README
• Standard Create React App commands (npm start, npm run build, etc.)
a. Client Side (React/Redux)
• Browser / React Dev Server (port 3000)
• React Application:
• UI Components (Header, Body, Footer, Auth)
• Redux Store & Middleware
• Action Creators & Reducers
• Static assets served from public/ (index.html, manifest, CSS)
b. Server Side (Mock JSON Server)
• JSON Server (port 3001 or similar)
• db.json file as the data store
• Static images under SERVER/public/images
c. External (if any in real deployment)
• Replace JSON Server with a real REST API / Database
Relationships and Interactions
• User interacts with the React UI → dispatches Redux actions.
• Redux middleware triggers HTTP calls to the JSON Server.
• JSON Server reads/writes to db.json and serves image assets.
• Responses are fed back into Redux reducers → React re-renders.
Architectural Patterns and Design Principles
• Component-based UI (React).
• Unidirectional data flow (Redux).
• Separation of concerns:
• Presentation (Components)
• State management (Redux store, action creators, types)
• Data persistence (JSON Server).
Relevant Technologies & Frameworks
• React, ReactDOM
• Redux (store, reducers, actions)
• Create React App toolchain (Webpack, Babel)
• JSON Server for mock REST API
• Fetch or axios (in actionCreators) for HTTP requests