# percobain/globetrotter architecture

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

- Interactive diagram: https://gitdiagram.com/percobain/globetrotter
- Repository: https://github.com/percobain/globetrotter

## Overview

Globetrotter is a travel-experience sharing and discovery platform. Travelers authenticate, create location-rich trip stories with maps and photos, optionally use AI assistance, then publish or keep trips private; others browse trips, ask practical questions, and follow social updates. The graph includes the documented discovery, profiles, comments, notifications, and upload capabilities. Source excerpts and the SOURCE INDEX establish many module references, but do not expose every route handler or frontend API call, so uncertain connections are omitted or marked unverified.

Main entry points: [`client/src/App.jsx`](https://github.com/percobain/globetrotter/blob/main/client/src/App.jsx) (App routing), [`client/src/services/api.js`](https://github.com/percobain/globetrotter/blob/main/client/src/services/api.js) (API client), [`server/src/server.js`](https://github.com/percobain/globetrotter/blob/main/server/src/server.js) (Express app), [`client/src/pages/CreateVisualization.jsx`](https://github.com/percobain/globetrotter/blob/main/client/src/pages/CreateVisualization.jsx) (Trip editor)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Travel platform"]
  node_app["App routing<br/>[App.jsx]"]
  node_auth["Auth state<br/>[useAuth.jsx]"]
  node_discover["Discovery feed<br/>[Discover.jsx]"]
  node_feed["Social feed<br/>[Feed.jsx]"]
  node_profile["Public profile<br/>[PublicProfile.jsx]"]
  node_discoveryctrl["Discovery logic"]
end

subgraph group_api["API and identity"]
  node_api["API client<br/>[api.js]"]
  node_server["Express app<br/>[server.js]"]
  node_visualroutes["Trip routes"]
  node_airoutes["AI routes<br/>[aiRoutes.js]"]
  node_middleware["Token verification"]
  node_mongodb[("MongoDB<br/>[db.js]")]
end

subgraph group_stories["Trip stories"]
  node_create["Trip editor"]
  node_location["Location editor<br/>[LocationModal.jsx]"]
  node_map["Globe map<br/>[MapGlobe.jsx]"]
  node_album["Trip album<br/>[Album.jsx]"]
  node_preview["Trip preview"]
  node_publicview["Public trip<br/>[PublicView.jsx]"]
  node_tripctrl["Trip management"]
  node_tripdata[("Trip records<br/>[Visualization.js]")]
end

subgraph group_community["Community features"]
  node_commentsui["Trip Q&amp;A"]
  node_notificationsui["Notifications UI"]
  node_commentctrl["Comment logic"]
  node_commentdata[("Comment records<br/>[Comment.js]")]
  node_notificationdata[("Notification records<br/>[Notification.js]")]
end

subgraph group_services["AI and storage"]
  node_aiassistant["AI assistance<br/>[AIAssistant.jsx]"]
  node_aictrl["AI controller<br/>[aiController.js]"]
  node_gemini["Gemini service<br/>[geminiService.js]"]
  node_r2["Cloudflare R2<br/>[cloudflare.js]"]
end

node_traveler(("Traveler"))

node_traveler -->|"uses"| node_app
node_app -->|"provides auth"| node_auth
node_app -->|"routes to"| node_create
node_app -->|"routes to"| node_album
node_app -->|"routes to"| node_preview
node_app -->|"routes to"| node_publicview
node_app -->|"routes to"| node_discover
node_app -->|"routes to"| node_feed
node_app -->|"routes to"| node_profile
node_auth -->|"verifies via"| node_api
node_auth -->|"authenticates"| node_traveler
node_create -->|"edits locations"| node_location
node_create -->|"renders map"| node_map
node_preview -->|"renders map"| node_map
node_preview -->|"shows details"| node_location
node_create -->|"uses assistance"| node_aiassistant
node_api -.->|"sends API requests"| node_server
node_server -->|"mounts routes"| node_visualroutes
node_server -->|"mounts routes"| node_airoutes
node_visualroutes -->|"protects routes"| node_middleware
node_visualroutes -->|"dispatches to"| node_tripctrl
node_airoutes -->|"protects routes"| node_middleware
node_airoutes -->|"dispatches to"| node_aictrl
node_tripctrl -->|"reads and writes"| node_tripdata
node_tripctrl -->|"uploads images"| node_r2
node_aictrl -->|"delegates generation"| node_gemini
node_discover -->|"requests discovery"| node_api
node_discoveryctrl -->|"reads trips"| node_tripdata
node_discoveryctrl -->|"personalizes feed"| node_traveler
node_commentsui -->|"requests comments"| node_api
node_commentctrl -->|"reads and writes"| node_commentdata
node_commentctrl -->|"creates alerts"| node_notificationdata
node_notificationsui -.->|"requests updates"| node_api
node_server -->|"connects database"| node_mongodb

click node_app "https://github.com/percobain/globetrotter/blob/main/client/src/App.jsx"
click node_auth "https://github.com/percobain/globetrotter/blob/main/client/src/hooks/useAuth.jsx"
click node_create "https://github.com/percobain/globetrotter/blob/main/client/src/pages/CreateVisualization.jsx"
click node_location "https://github.com/percobain/globetrotter/blob/main/client/src/components/LocationModal.jsx"
click node_map "https://github.com/percobain/globetrotter/blob/main/client/src/components/MapGlobe.jsx"
click node_album "https://github.com/percobain/globetrotter/blob/main/client/src/pages/Album.jsx"
click node_preview "https://github.com/percobain/globetrotter/blob/main/client/src/pages/PreviewVisualization.jsx"
click node_publicview "https://github.com/percobain/globetrotter/blob/main/client/src/pages/PublicView.jsx"
click node_discover "https://github.com/percobain/globetrotter/blob/main/client/src/pages/Discover.jsx"
click node_feed "https://github.com/percobain/globetrotter/blob/main/client/src/pages/Feed.jsx"
click node_profile "https://github.com/percobain/globetrotter/blob/main/client/src/pages/PublicProfile.jsx"
click node_commentsui "https://github.com/percobain/globetrotter/blob/main/client/src/components/EnhancedCommentPanel.jsx"
click node_notificationsui "https://github.com/percobain/globetrotter/blob/main/client/src/components/NotificationDropdown.jsx"
click node_api "https://github.com/percobain/globetrotter/blob/main/client/src/services/api.js"
click node_server "https://github.com/percobain/globetrotter/blob/main/server/src/server.js"
click node_visualroutes "https://github.com/percobain/globetrotter/blob/main/server/src/routes/visualizationRoutes.js"
click node_airoutes "https://github.com/percobain/globetrotter/blob/main/server/src/routes/aiRoutes.js"
click node_middleware "https://github.com/percobain/globetrotter/blob/main/server/src/middleware/verifyFirebaseToken.js"
click node_tripctrl "https://github.com/percobain/globetrotter/blob/main/server/src/controllers/visualizationController.js"
click node_tripdata "https://github.com/percobain/globetrotter/blob/main/server/src/models/Visualization.js"
click node_discoveryctrl "https://github.com/percobain/globetrotter/blob/main/server/src/controllers/discoveryController.js"
click node_commentctrl "https://github.com/percobain/globetrotter/blob/main/server/src/controllers/commentController.js"
click node_commentdata "https://github.com/percobain/globetrotter/blob/main/server/src/models/Comment.js"
click node_notificationdata "https://github.com/percobain/globetrotter/blob/main/server/src/models/Notification.js"
click node_aiassistant "https://github.com/percobain/globetrotter/blob/main/client/src/components/AIAssistant.jsx"
click node_aictrl "https://github.com/percobain/globetrotter/blob/main/server/src/controllers/aiController.js"
click node_gemini "https://github.com/percobain/globetrotter/blob/main/server/src/services/geminiService.js"
click node_r2 "https://github.com/percobain/globetrotter/blob/main/server/src/config/cloudflare.js"
click node_mongodb "https://github.com/percobain/globetrotter/blob/main/server/src/config/db.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_auth,node_discover,node_feed,node_profile,node_discoveryctrl toneBlue
class node_api,node_server,node_visualroutes,node_airoutes,node_middleware,node_mongodb toneAmber
class node_create,node_location,node_map,node_album,node_preview,node_publicview,node_tripctrl,node_tripdata toneMint
class node_commentsui,node_notificationsui,node_commentctrl,node_commentdata,node_notificationdata toneRose
class node_aiassistant,node_aictrl,node_gemini,node_r2,node_traveler toneIndigo
```

## Components

### Travel platform

- [App routing](https://github.com/percobain/globetrotter/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [Auth state](https://github.com/percobain/globetrotter/blob/main/client/src/hooks/useAuth.jsx): `client/src/hooks/useAuth.jsx`
- [Discovery feed](https://github.com/percobain/globetrotter/blob/main/client/src/pages/Discover.jsx): `client/src/pages/Discover.jsx`
- [Social feed](https://github.com/percobain/globetrotter/blob/main/client/src/pages/Feed.jsx): `client/src/pages/Feed.jsx`
- [Public profile](https://github.com/percobain/globetrotter/blob/main/client/src/pages/PublicProfile.jsx): `client/src/pages/PublicProfile.jsx`
- [Discovery logic](https://github.com/percobain/globetrotter/blob/main/server/src/controllers/discoveryController.js): `server/src/controllers/discoveryController.js`

### API and identity

- [API client](https://github.com/percobain/globetrotter/blob/main/client/src/services/api.js): `client/src/services/api.js`
- [Express app](https://github.com/percobain/globetrotter/blob/main/server/src/server.js): `server/src/server.js`
- [Trip routes](https://github.com/percobain/globetrotter/blob/main/server/src/routes/visualizationRoutes.js): `server/src/routes/visualizationRoutes.js`
- [AI routes](https://github.com/percobain/globetrotter/blob/main/server/src/routes/aiRoutes.js): `server/src/routes/aiRoutes.js`
- [Token verification](https://github.com/percobain/globetrotter/blob/main/server/src/middleware/verifyFirebaseToken.js): `server/src/middleware/verifyFirebaseToken.js`
- [MongoDB](https://github.com/percobain/globetrotter/blob/main/server/src/config/db.js): `server/src/config/db.js`

### Trip stories

- [Trip editor](https://github.com/percobain/globetrotter/blob/main/client/src/pages/CreateVisualization.jsx): `client/src/pages/CreateVisualization.jsx`
- [Location editor](https://github.com/percobain/globetrotter/blob/main/client/src/components/LocationModal.jsx): `client/src/components/LocationModal.jsx`
- [Globe map](https://github.com/percobain/globetrotter/blob/main/client/src/components/MapGlobe.jsx): `client/src/components/MapGlobe.jsx`
- [Trip album](https://github.com/percobain/globetrotter/blob/main/client/src/pages/Album.jsx): `client/src/pages/Album.jsx`
- [Trip preview](https://github.com/percobain/globetrotter/blob/main/client/src/pages/PreviewVisualization.jsx): `client/src/pages/PreviewVisualization.jsx`
- [Public trip](https://github.com/percobain/globetrotter/blob/main/client/src/pages/PublicView.jsx): `client/src/pages/PublicView.jsx`
- [Trip management](https://github.com/percobain/globetrotter/blob/main/server/src/controllers/visualizationController.js): `server/src/controllers/visualizationController.js`
- [Trip records](https://github.com/percobain/globetrotter/blob/main/server/src/models/Visualization.js): `server/src/models/Visualization.js`

### Community features

- [Trip Q&A](https://github.com/percobain/globetrotter/blob/main/client/src/components/EnhancedCommentPanel.jsx): `client/src/components/EnhancedCommentPanel.jsx`
- [Notifications UI](https://github.com/percobain/globetrotter/blob/main/client/src/components/NotificationDropdown.jsx): `client/src/components/NotificationDropdown.jsx`
- [Comment logic](https://github.com/percobain/globetrotter/blob/main/server/src/controllers/commentController.js): `server/src/controllers/commentController.js`
- [Comment records](https://github.com/percobain/globetrotter/blob/main/server/src/models/Comment.js): `server/src/models/Comment.js`
- [Notification records](https://github.com/percobain/globetrotter/blob/main/server/src/models/Notification.js): `server/src/models/Notification.js`

### AI and storage

- [AI assistance](https://github.com/percobain/globetrotter/blob/main/client/src/components/AIAssistant.jsx): `client/src/components/AIAssistant.jsx`
- [AI controller](https://github.com/percobain/globetrotter/blob/main/server/src/controllers/aiController.js): `server/src/controllers/aiController.js`
- [Gemini service](https://github.com/percobain/globetrotter/blob/main/server/src/services/geminiService.js): `server/src/services/geminiService.js`
- [Cloudflare R2](https://github.com/percobain/globetrotter/blob/main/server/src/config/cloudflare.js): `server/src/config/cloudflare.js`

### Other components

- **Traveler**

## Connections

- Traveler → App routing: uses (evidence: `client/src/App.jsx`)
- App routing → Auth state: provides auth (evidence: `client/src/App.jsx`)
- App routing → Trip editor: routes to (evidence: `client/src/App.jsx`)
- App routing → Trip album: routes to (evidence: `client/src/App.jsx`)
- App routing → Trip preview: routes to (evidence: `client/src/App.jsx`)
- App routing → Public trip: routes to (evidence: `client/src/App.jsx`)
- App routing → Discovery feed: routes to (evidence: `client/src/App.jsx`)
- App routing → Social feed: routes to (evidence: `client/src/App.jsx`)
- App routing → Public profile: routes to (evidence: `client/src/App.jsx`)
- Auth state → API client: verifies via (evidence: `client/src/hooks/useAuth.jsx`)
- Auth state → Traveler: authenticates (evidence: `client/src/hooks/useAuth.jsx`)
- Trip editor → Location editor: edits locations (evidence: `client/src/pages/CreateVisualization.jsx`)
- Trip editor → Globe map: renders map (evidence: `client/src/pages/CreateVisualization.jsx`)
- Trip preview → Globe map: renders map (evidence: `client/src/pages/PreviewVisualization.jsx`)
- Trip preview → Location editor: shows details (evidence: `client/src/pages/PreviewVisualization.jsx`)
- Trip editor → AI assistance: uses assistance (evidence: `client/src/pages/CreateVisualization.jsx`)
- API client → Express app: sends API requests
- Express app → Trip routes: mounts routes (evidence: `server/src/server.js`)
- Express app → AI routes: mounts routes (evidence: `server/src/server.js`)
- Trip routes → Token verification: protects routes (evidence: `server/src/routes/visualizationRoutes.js`)
- Trip routes → Trip management: dispatches to (evidence: `server/src/routes/visualizationRoutes.js`)
- AI routes → Token verification: protects routes (evidence: `server/src/routes/aiRoutes.js`)
- AI routes → AI controller: dispatches to (evidence: `server/src/routes/aiRoutes.js`)
- Trip management → Trip records: reads and writes (evidence: `server/src/controllers/visualizationController.js`)
- Trip management → Cloudflare R2: uploads images (evidence: `server/src/controllers/visualizationController.js`)
- AI controller → Gemini service: delegates generation (evidence: `server/src/controllers/aiController.js`)
- Discovery feed → API client: requests discovery (evidence: `client/src/services/api.js`)
- Discovery logic → Trip records: reads trips (evidence: `server/src/controllers/discoveryController.js`)
- Discovery logic → Traveler: personalizes feed (evidence: `server/src/controllers/discoveryController.js`)
- Trip Q&A → API client: requests comments (evidence: `client/src/components/EnhancedCommentPanel.jsx`)
- Comment logic → Comment records: reads and writes (evidence: `server/src/controllers/commentController.js`)
- Comment logic → Notification records: creates alerts (evidence: `server/src/controllers/commentController.js`)
- Notifications UI → API client: requests updates
- Express app → MongoDB: connects database (evidence: `server/src/server.js`)
