How saayam-for-all/webapp works
Project type and purpose
• This is a single‐page web application (“Saayam Web Application”) implemented entirely in ReactJS/Vite with Redux Toolkit for state management.
• It provides user authentication, help‐request submission, volunteer registration, donation flows, multilingual support (i18n), and communicates with backend REST endpoints (hosted externally or via AWS).
File structure
• Top-level config files (.babelrc, vite.config.js, netlify.toml, tailwind.config.js, etc.) indicate a Vite+Tailwind+Netlify deployment.
• “src/pages” organizes each route’s UI.
• “src/common/components” holds shared UI widgets (DataTable, Loader, Modal, Navbar, etc.).
• “src/Layout” contains layout scaffolding.
• “src/hooks”, “src/utils”, “src/services” encapsulate custom hooks, utility functions, and HTTP clients/endpoints definitions.
• “src/redux” holds all Redux Toolkit slices and async thunks by feature (authentication, requests, volunteer, admin, etc.).
• “src/routes” contains route definitions and protected‐route logic.
• “src/assets” includes static images.
A. Client Browser
B. React Application (“Saayam Web App”)
1. UI Layer
– Page modules (src/pages/*)
– Common shared components (src/common/components)
– Layout (src/Layout)
2. State Layer
– Redux store (src/redux/store.js)
– Feature slices & async thunks (src/redux/features/**)
3. Service Layer
– HTTP client (src/services/api.js)
– Endpoint definitions (src/services/endpoints.json)
– Feature‐specific service modules (requestServices, volunteerServices, etc.)
4. Utility & Config
– i18n configuration & locale data (src/common/i18n)
– AWS export config (src/utils/config/aws-exports.js)
– Custom hooks (useFetch, usePlacesSearchBox)
– Validation and helpers (src/utils/*.js)
5. Routing
– Route definitions (src/routes/routes.jsx)
– ProtectedRoute wrapper (src/routes/ProtectedRoute.jsx)
C. External Backend/API
– Auth service (Cognito, custom OAuth, etc.)
– Help-request service
– Volunteer service
– Donation/payment gateway
D. Deployment & Hosting
– Netlify (netlify.toml) or other static hosting
– CI/CD pipeline (.github/workflows/CICDPipeline.yaml)
Relationships and interactions
• Browser ←→ React App: user actions trigger UI events.
• UI Layer dispatches Redux actions → handled by async thunks → Service Layer.
• Service Layer uses HTTP client → sends requests to External Backend/API → receives JSON responses.
• Data flows back into Redux store → UI re-renders.
• i18n module intercepts UI rendering with locale strings.
• ProtectedRoute guards certain pages by reading auth state from Redux.
Architectural patterns and design principles
• Component-based UI (React) with separation of pages vs. shared components.
• Unidirectional data flow (Flux pattern via Redux Toolkit).
• Layered architecture: UI → State → Service → External API.
• Feature-based separation in Redux slices.
• Hook-based abstraction for side effects (e.g., network fetch, map/place search).
• Configuration-driven endpoints (endpoints.json) for easy environment switching.
• Internationalization (i18n) organized under a dedicated folder.