# dulaedu0912/tourist-day-planner architecture

> Architecture diagram of the GitHub repository dulaedu0912/tourist-day-planner, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dulaedu0912/tourist-day-planner
- Repository: https://github.com/dulaedu0912/tourist-day-planner

## Overview

Ganemulla Local Tourist Day-Visit Planner is a full-stack tourism catalogue and one-day itinerary planner. Visitors browse and search attractions, inspect mapped details, and assemble a persistent ordered plan; administrators log in to maintain the catalogue. The graph follows the React pages through the JSON API to MongoDB, with separate place-management and authentication stages. README statements establish the HTTP and external-service links; unsampled frontend and seeding details are represented only where the file index or README supports them.

Main entry points: [`client/src/pages/HomePage.jsx`](https://github.com/dulaedu0912/tourist-day-planner/blob/main/client/src/pages/HomePage.jsx) (Place discovery), [`client/src/pages/AdminPage.jsx`](https://github.com/dulaedu0912/tourist-day-planner/blob/main/client/src/pages/AdminPage.jsx) (Admin dashboard), [`client/src/App.jsx`](https://github.com/dulaedu0912/tourist-day-planner/blob/main/client/src/App.jsx) (Page selector), [`server/config/db.js`](https://github.com/dulaedu0912/tourist-day-planner/blob/main/server/config/db.js) (MongoDB connection)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_visitor["Visitor experience"]
  node_app["Page selector<br/>[App.jsx]"]
  node_home["Place discovery<br/>[HomePage.jsx]"]
  node_place_hooks["Place loading<br/>[usePlaces.js]"]
  node_catalogue_api["API client<br/>[api.js]"]
  node_place_cards["Place cards<br/>[PlaceCard.jsx]"]
  node_category_filter["Category filter<br/>[CategoryFilter.jsx]"]
  node_place_details["Place details<br/>[PlaceDetails.jsx]"]
  node_map_view["Map view<br/>[MapView.jsx]"]
  node_day_plan["Plan state<br/>[useDayPlan.js]"]
  node_plan_drawer["Plan editor<br/>[PlanDrawer.jsx]"]
end

subgraph group_admin["Administration"]
  node_admin_page["Admin dashboard<br/>[AdminPage.jsx]"]
  node_auth_client["Auth client<br/>[auth.js]"]
  node_login_form["Login form<br/>[LoginForm.jsx]"]
  node_place_form["Place editor<br/>[PlaceForm.jsx]"]
  node_place_table["Place directory<br/>[PlaceTable.jsx]"]
end

subgraph group_server["API and domain"]
  node_place_routes["Place routes<br/>[placeRoutes.js]"]
  node_place_controller["Place operations<br/>[placeController.js]"]
  node_place_model["Place validation<br/>[place.js]"]
  node_distance["Distance calculation<br/>[distance.js]"]
  node_auth_routes["Login route<br/>[authRoutes.js]"]
  node_auth_controller["Credential check<br/>[authController.js]"]
  node_auth_middleware["JWT protection<br/>[auth.js]"]
end

subgraph group_data["Persistence and integrations"]
  node_database["MongoDB connection<br/>[db.js]"]
  node_seed["Initial catalogue<br/>[seedDatabase.js]"]
  node_seed_places["Seed attractions<br/>[seedPlaces.js]"]
end

node_visitor_actor(("Visitor"))
node_admin_actor(("Administrator"))
node_osm["OpenStreetMap"]
node_image_host["Photo host"]
node_mongo[("MongoDB")]

node_visitor_actor -->|"opens"| node_app
node_admin_actor -->|"opens admin"| node_app
node_app -->|"selects"| node_home
node_app -->|"selects"| node_admin_page
node_home -->|"loads places"| node_place_hooks
node_place_hooks -->|"requests data"| node_catalogue_api
node_home -->|"renders"| node_place_cards
node_home -->|"renders"| node_category_filter
node_home -->|"opens"| node_place_details
node_home -->|"manages plan"| node_day_plan
node_home -->|"renders"| node_plan_drawer
node_place_details -->|"renders"| node_map_view
node_map_view -->|"loads map tiles"| node_osm
node_plan_drawer -->|"edits stops"| node_day_plan
node_day_plan -.->|"persists plan"| node_plan_drawer
node_place_cards -.->|"loads photos"| node_image_host
node_admin_page -->|"uses"| node_auth_client
node_admin_page -->|"manages places"| node_catalogue_api
node_admin_page -->|"renders"| node_login_form
node_admin_page -->|"renders"| node_place_form
node_admin_page -->|"renders"| node_place_table
node_catalogue_api -->|"HTTP requests"| node_place_routes
node_auth_client -->|"submits credentials"| node_auth_routes
node_place_routes -->|"dispatches"| node_place_controller
node_place_routes -->|"guards writes"| node_auth_middleware
node_place_controller -->|"reads and writes"| node_database
node_place_controller -->|"validates changes"| node_place_model
node_place_model -->|"calculates distance"| node_distance
node_auth_routes -->|"dispatches login"| node_auth_controller
node_auth_controller -->|"checks admin"| node_database
node_auth_controller -->|"signs token"| node_auth_middleware
node_database -->|"connects"| node_mongo
node_seed -.->|"initializes data"| node_database
node_seed -->|"loads records"| node_seed_places

click node_app "https://github.com/dulaedu0912/tourist-day-planner/blob/main/client/src/App.jsx"
click node_home "https://github.com/dulaedu0912/tourist-day-planner/blob/main/client/src/pages/HomePage.jsx"
click node_place_hooks "https://github.com/dulaedu0912/tourist-day-planner/blob/main/client/src/hooks/usePlaces.js"
click node_catalogue_api "https://github.com/dulaedu0912/tourist-day-planner/blob/main/client/src/services/api.js"
click node_place_cards "https://github.com/dulaedu0912/tourist-day-planner/blob/main/client/src/components/PlaceCard.jsx"
click node_category_filter "https://github.com/dulaedu0912/tourist-day-planner/blob/main/client/src/components/CategoryFilter.jsx"
click node_place_details "https://github.com/dulaedu0912/tourist-day-planner/blob/main/client/src/components/PlaceDetails.jsx"
click node_map_view "https://github.com/dulaedu0912/tourist-day-planner/blob/main/client/src/components/MapView.jsx"
click node_day_plan "https://github.com/dulaedu0912/tourist-day-planner/blob/main/client/src/hooks/useDayPlan.js"
click node_plan_drawer "https://github.com/dulaedu0912/tourist-day-planner/blob/main/client/src/components/PlanDrawer.jsx"
click node_admin_page "https://github.com/dulaedu0912/tourist-day-planner/blob/main/client/src/pages/AdminPage.jsx"
click node_auth_client "https://github.com/dulaedu0912/tourist-day-planner/blob/main/client/src/services/auth.js"
click node_login_form "https://github.com/dulaedu0912/tourist-day-planner/blob/main/client/src/components/admin/LoginForm.jsx"
click node_place_form "https://github.com/dulaedu0912/tourist-day-planner/blob/main/client/src/components/admin/PlaceForm.jsx"
click node_place_table "https://github.com/dulaedu0912/tourist-day-planner/blob/main/client/src/components/admin/PlaceTable.jsx"
click node_place_routes "https://github.com/dulaedu0912/tourist-day-planner/blob/main/server/routes/placeRoutes.js"
click node_place_controller "https://github.com/dulaedu0912/tourist-day-planner/blob/main/server/controllers/placeController.js"
click node_place_model "https://github.com/dulaedu0912/tourist-day-planner/blob/main/server/models/place.js"
click node_distance "https://github.com/dulaedu0912/tourist-day-planner/blob/main/server/utils/distance.js"
click node_auth_routes "https://github.com/dulaedu0912/tourist-day-planner/blob/main/server/routes/authRoutes.js"
click node_auth_controller "https://github.com/dulaedu0912/tourist-day-planner/blob/main/server/controllers/authController.js"
click node_auth_middleware "https://github.com/dulaedu0912/tourist-day-planner/blob/main/server/middleware/auth.js"
click node_database "https://github.com/dulaedu0912/tourist-day-planner/blob/main/server/config/db.js"
click node_seed "https://github.com/dulaedu0912/tourist-day-planner/blob/main/server/seed/seedDatabase.js"
click node_seed_places "https://github.com/dulaedu0912/tourist-day-planner/blob/main/server/data/seedPlaces.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_home,node_place_hooks,node_catalogue_api,node_place_cards,node_category_filter,node_place_details,node_map_view,node_day_plan,node_plan_drawer toneBlue
class node_admin_page,node_auth_client,node_login_form,node_place_form,node_place_table,node_mongo toneAmber
class node_place_routes,node_place_controller,node_place_model,node_distance,node_auth_routes,node_auth_controller,node_auth_middleware toneMint
class node_database,node_seed,node_seed_places toneRose
class node_visitor_actor,node_admin_actor,node_osm,node_image_host toneIndigo
```

## Components

### Visitor experience

- [Page selector](https://github.com/dulaedu0912/tourist-day-planner/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [Place discovery](https://github.com/dulaedu0912/tourist-day-planner/blob/main/client/src/pages/HomePage.jsx): `client/src/pages/HomePage.jsx`
- [Place loading](https://github.com/dulaedu0912/tourist-day-planner/blob/main/client/src/hooks/usePlaces.js): `client/src/hooks/usePlaces.js`
- [API client](https://github.com/dulaedu0912/tourist-day-planner/blob/main/client/src/services/api.js): `client/src/services/api.js`
- [Place cards](https://github.com/dulaedu0912/tourist-day-planner/blob/main/client/src/components/PlaceCard.jsx): `client/src/components/PlaceCard.jsx`
- [Category filter](https://github.com/dulaedu0912/tourist-day-planner/blob/main/client/src/components/CategoryFilter.jsx): `client/src/components/CategoryFilter.jsx`
- [Place details](https://github.com/dulaedu0912/tourist-day-planner/blob/main/client/src/components/PlaceDetails.jsx): `client/src/components/PlaceDetails.jsx`
- [Map view](https://github.com/dulaedu0912/tourist-day-planner/blob/main/client/src/components/MapView.jsx): `client/src/components/MapView.jsx`
- [Plan state](https://github.com/dulaedu0912/tourist-day-planner/blob/main/client/src/hooks/useDayPlan.js): `client/src/hooks/useDayPlan.js`
- [Plan editor](https://github.com/dulaedu0912/tourist-day-planner/blob/main/client/src/components/PlanDrawer.jsx): `client/src/components/PlanDrawer.jsx`

### Administration

- [Admin dashboard](https://github.com/dulaedu0912/tourist-day-planner/blob/main/client/src/pages/AdminPage.jsx): `client/src/pages/AdminPage.jsx`
- [Auth client](https://github.com/dulaedu0912/tourist-day-planner/blob/main/client/src/services/auth.js): `client/src/services/auth.js`
- [Login form](https://github.com/dulaedu0912/tourist-day-planner/blob/main/client/src/components/admin/LoginForm.jsx): `client/src/components/admin/LoginForm.jsx`
- [Place editor](https://github.com/dulaedu0912/tourist-day-planner/blob/main/client/src/components/admin/PlaceForm.jsx): `client/src/components/admin/PlaceForm.jsx`
- [Place directory](https://github.com/dulaedu0912/tourist-day-planner/blob/main/client/src/components/admin/PlaceTable.jsx): `client/src/components/admin/PlaceTable.jsx`

### API and domain

- [Place routes](https://github.com/dulaedu0912/tourist-day-planner/blob/main/server/routes/placeRoutes.js): `server/routes/placeRoutes.js`
- [Place operations](https://github.com/dulaedu0912/tourist-day-planner/blob/main/server/controllers/placeController.js): `server/controllers/placeController.js`
- [Place validation](https://github.com/dulaedu0912/tourist-day-planner/blob/main/server/models/place.js): `server/models/place.js`
- [Distance calculation](https://github.com/dulaedu0912/tourist-day-planner/blob/main/server/utils/distance.js): `server/utils/distance.js`
- [Login route](https://github.com/dulaedu0912/tourist-day-planner/blob/main/server/routes/authRoutes.js): `server/routes/authRoutes.js`
- [Credential check](https://github.com/dulaedu0912/tourist-day-planner/blob/main/server/controllers/authController.js): `server/controllers/authController.js`
- [JWT protection](https://github.com/dulaedu0912/tourist-day-planner/blob/main/server/middleware/auth.js): `server/middleware/auth.js`

### Persistence and integrations

- [MongoDB connection](https://github.com/dulaedu0912/tourist-day-planner/blob/main/server/config/db.js): `server/config/db.js`
- [Initial catalogue](https://github.com/dulaedu0912/tourist-day-planner/blob/main/server/seed/seedDatabase.js): `server/seed/seedDatabase.js`
- [Seed attractions](https://github.com/dulaedu0912/tourist-day-planner/blob/main/server/data/seedPlaces.js): `server/data/seedPlaces.js`

### Other components

- **Visitor**
- **Administrator**
- **OpenStreetMap**
- **Photo host**
- **MongoDB**

## Connections

- Visitor → Page selector: opens (evidence: `README.md`)
- Administrator → Page selector: opens admin (evidence: `README.md`)
- Page selector → Place discovery: selects (evidence: `client/src/App.jsx`)
- Page selector → Admin dashboard: selects (evidence: `client/src/App.jsx`)
- Place discovery → Place loading: loads places (evidence: `client/src/pages/HomePage.jsx`)
- Place loading → API client: requests data (evidence: `client/src/hooks/usePlaces.js`)
- Place discovery → Place cards: renders (evidence: `client/src/pages/HomePage.jsx`)
- Place discovery → Category filter: renders (evidence: `client/src/pages/HomePage.jsx`)
- Place discovery → Place details: opens (evidence: `client/src/pages/HomePage.jsx`)
- Place discovery → Plan state: manages plan (evidence: `client/src/pages/HomePage.jsx`)
- Place discovery → Plan editor: renders (evidence: `client/src/pages/HomePage.jsx`)
- Place details → Map view: renders (evidence: `client/src/components/PlaceDetails.jsx`)
- Map view → OpenStreetMap: loads map tiles (evidence: `README.md`)
- Plan editor → Plan state: edits stops (evidence: `client/src/pages/HomePage.jsx`)
- Plan state → Plan editor: persists plan
- Place cards → Photo host: loads photos (evidence: `README.md`)
- Admin dashboard → Auth client: uses (evidence: `client/src/pages/AdminPage.jsx`)
- Admin dashboard → API client: manages places (evidence: `client/src/pages/AdminPage.jsx`)
- Admin dashboard → Login form: renders (evidence: `client/src/pages/AdminPage.jsx`)
- Admin dashboard → Place editor: renders (evidence: `client/src/pages/AdminPage.jsx`)
- Admin dashboard → Place directory: renders (evidence: `client/src/pages/AdminPage.jsx`)
- API client → Place routes: HTTP requests (evidence: `README.md`)
- Auth client → Login route: submits credentials (evidence: `README.md`)
- Place routes → Place operations: dispatches (evidence: `server/routes/placeRoutes.js`)
- Place routes → JWT protection: guards writes (evidence: `server/routes/placeRoutes.js`)
- Place operations → MongoDB connection: reads and writes (evidence: `server/controllers/placeController.js`)
- Place operations → Place validation: validates changes (evidence: `server/controllers/placeController.js`)
- Place validation → Distance calculation: calculates distance (evidence: `server/models/place.js`)
- Login route → Credential check: dispatches login (evidence: `server/routes/authRoutes.js`)
- Credential check → MongoDB connection: checks admin (evidence: `server/controllers/authController.js`)
- Credential check → JWT protection: signs token (evidence: `server/controllers/authController.js`)
- MongoDB connection → MongoDB: connects (evidence: `README.md`)
- Initial catalogue → MongoDB connection: initializes data
- Initial catalogue → Seed attractions: loads records (evidence: `server/seed/seedDatabase.js`)
