# aayushdai/project_front architecture

> Architecture diagram of the GitHub repository aayushdai/project_front, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-05-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/aayushdai/project_front
- Repository: https://github.com/aayushdai/project_front

## Overview

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: [`src/context/AuthContext.js`](https://github.com/aayushdai/project_front/blob/main/src/context/AuthContext.js) (Auth context), [`src/services/tripService.js`](https://github.com/aayushdai/project_front/blob/main/src/services/tripService.js) (Trip service), [`src/App.js`](https://github.com/aayushdai/project_front/blob/main/src/App.js) (App shell), [`src/pages/KYCForm.jsx`](https://github.com/aayushdai/project_front/blob/main/src/pages/KYCForm.jsx) (KYC workflow)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["React app"]
  node_app["App shell<br/>React SPA<br/>[App.js]"]
  node_ui_shell["UI shell<br/>Layout system<br/>[navbar.jsx]"]
end

subgraph group_access["Access control"]
  node_protected_routes["Protected routes<br/>Route guard"]
  node_auth_context["Auth context<br/>Session state<br/>[AuthContext.js]"]
  node_auth_hook["Auth required<br/>Hook<br/>[useAuthRequired.js]"]
  node_kyc_pages["KYC workflow<br/>Review screens<br/>[KYCForm.jsx]"]
end

subgraph group_travel["Trip planning"]
  node_trip_pages["Trip pages<br/>Route screens<br/>[TripPlanner.jsx]"]
  node_trip_components["Trip UI<br/>Trip widgets<br/>[TripCard.jsx]"]
  node_trip_hooks["Trip hooks<br/>Data hooks<br/>[useTripsData.js]"]
end

subgraph group_discovery["Discovery"]
  node_discovery_pages["Discovery pages<br/>Route screens"]
  node_search_components["Search UI<br/>Search widgets<br/>[SearchBar.jsx]"]
  node_map_view["Map view<br/>Map component<br/>[MapView.jsx]"]
end

subgraph group_engagement["Engagement"]
  node_engagement_ui["Engagement UI<br/>Chat/alerts<br/>[ChatbotWidget.jsx]"]
end

subgraph group_data["Data layer"]
  node_auth_service["Auth service<br/>API client<br/>[authService.js]"]
  node_trip_service["Trip service<br/>API client<br/>[tripService.js]"]
  node_user_service["User service<br/>API client<br/>[userService.js]"]
  node_shared_api["API core<br/>HTTP layer<br/>[api.js]"]
  node_kyc_api["KYC API<br/>API client<br/>[kycApi.js]"]
end

subgraph group_legacy["Legacy assets"]
  node_legacy_assets["Legacy assets<br/>Static scripts/styles<br/>[main.js]"]
end

node_app -->|"uses"| node_protected_routes
node_app -->|"provides"| node_auth_context
node_app -->|"renders"| node_ui_shell
node_protected_routes -->|"checks"| node_auth_hook
node_auth_context -->|"calls"| node_auth_service
node_auth_hook -->|"reads"| node_auth_context
node_trip_pages -->|"loads"| node_trip_hooks
node_trip_hooks -->|"fetches"| node_trip_service
node_trip_components -->|"mutates"| node_trip_service
node_trip_components -->|"used by"| node_trip_pages
node_trip_service -->|"uses"| node_shared_api
node_user_service -->|"uses"| node_shared_api
node_kyc_pages -->|"submits"| node_kyc_api
node_kyc_pages -->|"depends on"| node_auth_context
node_discovery_pages -->|"uses"| node_search_components
node_discovery_pages -->|"visualizes"| node_map_view
node_search_components -->|"queries"| node_user_service
node_engagement_ui -->|"reads"| node_auth_context
node_engagement_ui -->|"updates"| node_trip_service
node_ui_shell -->|"augments"| node_legacy_assets

click node_app "https://github.com/aayushdai/project_front/blob/main/src/App.js"
click node_protected_routes "https://github.com/aayushdai/project_front/blob/main/src/routes/Protectedroutes.jsx"
click node_auth_context "https://github.com/aayushdai/project_front/blob/main/src/context/AuthContext.js"
click node_auth_hook "https://github.com/aayushdai/project_front/blob/main/src/hooks/useAuthRequired.js"
click node_auth_service "https://github.com/aayushdai/project_front/blob/main/src/services/authService.js"
click node_trip_service "https://github.com/aayushdai/project_front/blob/main/src/services/tripService.js"
click node_user_service "https://github.com/aayushdai/project_front/blob/main/src/services/userService.js"
click node_shared_api "https://github.com/aayushdai/project_front/blob/main/src/services/api.js"
click node_trip_pages "https://github.com/aayushdai/project_front/blob/main/src/pages/TripPlanner.jsx"
click node_trip_components "https://github.com/aayushdai/project_front/blob/main/src/components/TripCard.jsx"
click node_trip_hooks "https://github.com/aayushdai/project_front/blob/main/src/hooks/useTripsData.js"
click node_kyc_pages "https://github.com/aayushdai/project_front/blob/main/src/pages/KYCForm.jsx"
click node_kyc_api "https://github.com/aayushdai/project_front/blob/main/src/API/kycApi.js"
click node_discovery_pages "https://github.com/aayushdai/project_front/blob/main/src/pages/ExploreDestination.jsx"
click node_search_components "https://github.com/aayushdai/project_front/blob/main/src/components/SearchBar.jsx"
click node_map_view "https://github.com/aayushdai/project_front/blob/main/src/components/MapView.jsx"
click node_engagement_ui "https://github.com/aayushdai/project_front/blob/main/src/components/ChatbotWidget.jsx"
click node_ui_shell "https://github.com/aayushdai/project_front/blob/main/src/components/navbar.jsx"
click node_legacy_assets "https://github.com/aayushdai/project_front/blob/main/src/assets/js/main.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_ui_shell,node_legacy_assets toneBlue
class node_protected_routes,node_auth_context,node_auth_hook,node_kyc_pages toneAmber
class node_trip_pages,node_trip_components,node_trip_hooks toneMint
class node_discovery_pages,node_search_components,node_map_view toneRose
class node_engagement_ui toneIndigo
class node_auth_service,node_trip_service,node_user_service,node_shared_api,node_kyc_api toneTeal
```

## Components

### React app

Browser-based single-page application and shared UI layer.

- [App shell](https://github.com/aayushdai/project_front/blob/main/src/App.js): React SPA · Top-level application composition and route wiring. · `src/App.js`
- [UI shell](https://github.com/aayushdai/project_front/blob/main/src/components/navbar.jsx): Layout system · Navigation, sidebar, footer, loader, and theme-driven shared chrome. · `src/components/navbar.jsx`

### Access control

Authentication, session state, and protected-route gating.

- [Protected routes](https://github.com/aayushdai/project_front/blob/main/src/routes/Protectedroutes.jsx): Route guard · Authenticated route boundary for private areas. · `src/routes/Protectedroutes.jsx`
- [Auth context](https://github.com/aayushdai/project_front/blob/main/src/context/AuthContext.js): Session state · Centralizes login state and identity context. · `src/context/AuthContext.js`
- [Auth required](https://github.com/aayushdai/project_front/blob/main/src/hooks/useAuthRequired.js): Hook · Guards components and workflows that need authentication. · `src/hooks/useAuthRequired.js`
- [KYC workflow](https://github.com/aayushdai/project_front/blob/main/src/pages/KYCForm.jsx): Review screens · User verification form and admin review dashboard. · `src/pages/KYCForm.jsx`

### Trip planning

Core travel, itinerary, invitation, and social planning flows.

- [Trip pages](https://github.com/aayushdai/project_front/blob/main/src/pages/TripPlanner.jsx): Route screens · Trip planner, creation, and trip detail entry points. · `src/pages/TripPlanner.jsx`
- [Trip UI](https://github.com/aayushdai/project_front/blob/main/src/components/TripCard.jsx): Trip widgets · Reusable trip cards, itinerary, invite, photo, and edit UI. · `src/components/TripCard.jsx`
- [Trip hooks](https://github.com/aayushdai/project_front/blob/main/src/hooks/useTripsData.js): Data hooks · Trip loading and invitation state helpers. · `src/hooks/useTripsData.js`

### Discovery

Destination browsing, search, and map-centric exploration.

- [Discovery pages](https://github.com/aayushdai/project_front/blob/main/src/pages/ExploreDestination.jsx): Route screens · Destination browsing, detail views, and search results. · `src/pages/ExploreDestination.jsx`
- [Search UI](https://github.com/aayushdai/project_front/blob/main/src/components/SearchBar.jsx): Search widgets · Search bars and result-oriented browsing controls. · `src/components/SearchBar.jsx`
- [Map view](https://github.com/aayushdai/project_front/blob/main/src/components/MapView.jsx): Map component · Map-centric destination visualization and exploration. · `src/components/MapView.jsx`

### Engagement

Chat, notifications, and transient feedback surfaces.

- [Engagement UI](https://github.com/aayushdai/project_front/blob/main/src/components/ChatbotWidget.jsx): Chat/alerts · Chatbot, notifications, and toast feedback surfaces. · `src/components/ChatbotWidget.jsx`

### Data layer

API/service boundary for backend interactions.

- [Auth service](https://github.com/aayushdai/project_front/blob/main/src/services/authService.js): API client · Authentication operations and session-related backend calls. · `src/services/authService.js`
- [Trip service](https://github.com/aayushdai/project_front/blob/main/src/services/tripService.js): API client · Trip data access and mutation layer. · `src/services/tripService.js`
- [User service](https://github.com/aayushdai/project_front/blob/main/src/services/userService.js): API client · User profile and user lookup backend access. · `src/services/userService.js`
- [API core](https://github.com/aayushdai/project_front/blob/main/src/services/api.js): HTTP layer · Shared request helpers used by feature services. · `src/services/api.js`
- [KYC API](https://github.com/aayushdai/project_front/blob/main/src/API/kycApi.js): API client · Identity verification backend integration. · `src/API/kycApi.js`

### Legacy assets

Older or auxiliary static scripts and styles kept alongside the React app.

- [Legacy assets](https://github.com/aayushdai/project_front/blob/main/src/assets/js/main.js): Static scripts/styles · Auxiliary CSS and JS assets that complement the React build. · `src/assets/js/main.js`

## Connections

- 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.
