How mahmoudrabbas/holy-quran works
Project type and purpose
• This is a single‐page, front‐end React application (no custom backend) that fetches and displays verses (“Ayahs”) and chapters (“Surahs”) from an external Holy Quran API.
• It uses Redux for client‐side state management.
File structure
• Top‐level directories:
• public/ – static assets (index.html, robots.txt)
• src/ – application code
• Under src/:
• api/index.js – encapsulates HTTP calls to the external Quran API
• components/ – React UI components, organized by feature (Surah, home, header, footer)
• redux/ – state management
– actions/ (async calls, action types)
– reducers/ (handle state updates)
– store.js (Redux store configuration)
• Entry points: src/index.js (ReactDOM.render), src/App.js (main layout & routing)
Key insights from README
• Users can fetch random Ayahs or select a specific Surah.
• No server/DB of its own; it relies on an external REST API.
• Built with create‐react‐app (npm start/yarn start).
Main components
a. UI Layer (React Components)
• Header, Home view, Surah view, Footer
b. State Management Layer (Redux)
• Store, Actions, Reducers
c. API Layer
• api/index.js (fetch requests, error handling)
d. External Service
• Quran REST API (hosted externally)
Relationships and data flow
• UI components dispatch Redux actions (e.g., “GET_RANDOM_AYAH” or “GET_SURAH_BY_ID”).
• Actions call the API layer to perform HTTP requests.
• API responses are returned to actions, which then dispatch success/failure actions.
• Reducers update the Redux store.
• Store changes flow back into subscribed components via mapStateToProps (or useSelector), causing re-renders.
Architectural patterns & design principles
• Flux architecture (unidirectional data flow) with Redux
• Container/Presentational split implicitly: components consume store data and dispatch actions
• Separation of concerns: UI vs. state vs. API calls
Technologies / frameworks
• React
• Redux (actions, reducers, store)
• Fetch or Axios (inside src/api/index.js)
• create‐react‐app tooling