How aayushdai/project_front works
1. This repository is primarily a single-page React application bootstrapped with Create React App. The browser is the main runtime, and the app is built as a static front end that talks to backend APIs for application data and user actions.
2. The top-level feature boundary is the src/pages directory. Each file there is a route-level screen such as Home, Dashboard, Trip Planner, Trip Details, Profile, Login/Register, KYC Form/Admin Dashboard, Chat, Search Results, and destination-related views. These pages are the main entry points for user workflows.
3. Routing and access control are separated from the pages themselves. src/routes/Protectedroutes.jsx and the auth context/hooks gate authenticated areas, while public pages like landing, auth, and destination browsing remain open. This suggests the app has both public discovery flows and logged-in product flows.
4. Shared UI is organized in src/components. The notable subsystems here are trip management (TripCard, TripPhotos, TripInviteModal, SuggestPeople, Itinerary, EditModal), navigation/layout (navbar, Sidebar, Footer), feedback/async states (Loader, SkeletonLoaders, Toast, ToastContainer), and communication/engagement (NotificationBell, NotificationPanel, NotificationPoller, ChatbotWidget).
5. The core domain appears to be travel planning and social trip coordination. Trip creation, itinerary building, trip details, invites, suggested people, and trip photos are all first-class features. This is reinforced by the presence of TripPlanner, CreateTrip, TripDetails, Itinerary, and hooks/services specifically for trips and invitations.
6. Authentication and user identity are centralized in src/context/AuthContext.js, with supporting utilities such as useAuthRequired, authService, and auth-specific API modules. The repo includes auth recovery and debugging screens (ForgotPassword, DebugAuth), which indicates the login/session boundary is a major architectural concern.
7. There is a second major subsystem around KYC and admin review. KYCForm, KYCBanner, KYCAdminDashboard, and src/API/kycApi.js indicate that identity verification is not just a UI concern but a distinct workflow with its own backend interactions and admin-facing review path.
8. Data access is abstracted through service and API layers rather than being called directly from pages. src/services holds domain services (tripService, userService, authService, api.js), while src/API contains additional API modules (api.js, authApi.js, kycApi.js). Several hooks consume these services for polling, loading trips, and fetching invitations, which keeps data fetching out of the presentation layer.
9. There is a clear split between reusable data/behavior hooks and UI components. Hooks such as useTripsData, useInvitations, useNotificationPolling, useToast, useTheme, and useScrollbarExpand encapsulate cross-cutting behavior like polling, theme state, and transient notifications.
10. The app includes discovery and map-centric experiences. Destination, DestinationDetail, ExploreDestination, SearchBar, UserSearchBar, SearchResults, and MapView suggest browse/search flows backed by location or destination data. The map feature likely depends on an external mapping provider, although the exact provider is not visible from the tree alone.
11. There is also a chat/assistant surface. Chat.jsx and ChatbotWidget.jsx imply a messaging or AI-assistant capability that is separate from the trip planning flows, likely integrated as a persistent widget plus a dedicated page.
12. Styling is layered rather than centralized in one system. The repo includes global CSS, component CSS, responsive styles, theme documentation, and Tailwind configuration. THEME_SYSTEM.md, tailwind.config.js, and the CSS files in src/styles, src/components, and src/assets/css indicate a mixed styling approach with a theme/responsive layer on top of the React component tree.
13. The src/assets/js and src/assets/css folders look like older or auxiliary front-end assets that coexist with the React app. They likely serve legacy behavior, static helpers, or imported scripts/styles, so they should be treated as a secondary boundary rather than the core application architecture.
14. public/manifest.json, public/index.html, and the CRA build scripts point to a deployable static front end, with environment-driven configuration via .env. The presence of server.py suggests there may also be a Python-based local or deployment server entrypoint, but the dominant architecture in this repo is still the React client.
15. In diagram form, the most important flows are: user interaction in pages/components → shared auth/context/hooks → service/API layer → backend services; and parallel flows for notifications, KYC review, chat, and map/search. The primary architectural boundaries are presentation, session/auth, domain services, and external backend integrations.
Main entry points: AuthContext.js Auth context · tripService.js Trip service · App.js App shell · KYCForm.jsx KYC workflow
Components 19
React app
Browser-based single-page application and shared UI layer.
Access control
Authentication, session state, and protected-route gating.
- Protected routes · Authenticated route boundary for private areas.
src/routes/Protectedroutes.jsx - Auth context · Centralizes login state and identity context.
src/context/AuthContext.js - Auth required · Guards components and workflows that need authentication.
src/hooks/useAuthRequired.js - KYC workflow · User verification form and admin review dashboard.
src/pages/KYCForm.jsx
Trip planning
Core travel, itinerary, invitation, and social planning flows.
- Trip pages · Trip planner, creation, and trip detail entry points.
src/pages/TripPlanner.jsx - Trip UI · Reusable trip cards, itinerary, invite, photo, and edit UI.
src/components/TripCard.jsx - Trip hooks · Trip loading and invitation state helpers.
src/hooks/useTripsData.js
Discovery
Destination browsing, search, and map-centric exploration.
- Discovery pages · Destination browsing, detail views, and search results.
src/pages/ExploreDestination.jsx - Search UI · Search bars and result-oriented browsing controls.
src/components/SearchBar.jsx - Map view · Map-centric destination visualization and exploration.
src/components/MapView.jsx
Engagement
Chat, notifications, and transient feedback surfaces.
- Engagement UI · Chatbot, notifications, and toast feedback surfaces.
src/components/ChatbotWidget.jsx
Data layer
API/service boundary for backend interactions.
- Auth service · Authentication operations and session-related backend calls.
src/services/authService.js - Trip service · Trip data access and mutation layer.
src/services/tripService.js - User service · User profile and user lookup backend access.
src/services/userService.js - API core · Shared request helpers used by feature services.
src/services/api.js - KYC API · Identity verification backend integration.
src/API/kycApi.js
Legacy assets
Older or auxiliary static scripts and styles kept alongside the React app.
- Legacy assets · Auxiliary CSS and JS assets that complement the React build.
src/assets/js/main.js
Connections 20
- App shell → Protected routes: uses · App composes the private route boundary.
- App shell → Auth context: provides · App is wrapped by auth/session state.
- App shell → UI shell: renders · Top-level shell supplies navigation and layout.
- Protected routes → Auth required: checks · Route gating relies on auth-required logic.
- Auth context → Auth service: calls · Session actions delegate to auth API operations.
- Auth required → Auth context: reads · Hook consumes current authentication state.
- Trip pages → Trip hooks: loads · Trip screens pull data through reusable hooks.
- Trip hooks → Trip service: fetches · Hooks coordinate trip and invitation requests.
- Trip UI → Trip service: mutates · Trip widgets trigger trip-related backend actions.
- Trip UI → Trip pages: used by · Reusable trip UI supports route-level trip screens.
- Trip service → API core: uses · Trip requests go through the shared HTTP layer.
- User service → API core: uses · User requests go through the shared HTTP layer.
- KYC workflow → KYC API: submits · KYC screens communicate with verification backend endpoints.
- KYC workflow → Auth context: depends on · Verification flow is tied to the current user session.
- Discovery pages → Search UI: uses · Destination and search screens share search controls.
- Discovery pages → Map view: visualizes · Destination flows can present map-based exploration.
- Search UI → User service: queries · Search UI can rely on user lookup or discovery data.
- Engagement UI → Auth context: reads · Notifications and chat surfaces are session-aware.
- Engagement UI → Trip service: updates · Engagement features can relate to trip activity.
- UI shell → Legacy assets: augments · Older static assets support styling and behavior around the shell.