# rohitkumarsingh0111/3d-interactive-globe architecture

> Architecture diagram of the GitHub repository rohitkumarsingh0111/3d-interactive-globe, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-07-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rohitkumarsingh0111/3d-interactive-globe
- Repository: https://github.com/rohitkumarsingh0111/3d-interactive-globe

## Overview

#### Purpose and entry points
A Next.js App Router application centered on an interactive globe for viewing world events, with an authenticated admin area for managing event data. The main user entry point is `src/app/page.tsx`; shared document styling and shell originate in `src/app/layout.tsx` and `src/app/globals.css`. Admin routes are rooted at `src/app/admin/page.tsx`.

#### Globe visualization layer
The primary presentation system composes a 3D/stylized globe scene with environmental layers and event markers. `src/components/scene/GlobeScene.tsx` is the scene-level integration point, supported by globe render variants and visual effects in:
- `src/components/scene/PhysicalGlobe.tsx`
- `src/components/scene/DottedGlobe.tsx`
- `src/components/scene/EventMarker.tsx`

Textures are served as static assets from `public/textures`.

#### Client state, filtering, and event interaction
Globe-specific client state and domain types are centralized in `src/store/globeStore.ts` and `src/types/globe.ts`. UI components provide filtering, navigation, selected-event detail, and loading/status surfaces:
- `src/components/ui/GlobeFilterBar.tsx`
- `src/components/ui/EventPopup.tsx`
- `src/components/ui/SidePanel.tsx`

The expected control flow is event data → globe store/filter state → visible markers and panels; marker selection drives popup or side-panel presentation.

#### Event data boundary
Event records are exposed through App Router API handlers. Collection and individual-resource operations are separated at:
- `src/app/api/events/route.ts`
- `src/app/api/events/[id]/route.ts`

The application also contains seed/static event content in `src/data/events.ts`, likely supporting initial display, fallback, or development data. Geographic normalization is isolated in `src/lib/geoUtils.ts`, while geocoding is presented as a server API boundary at `src/app/api/geocode/route.ts`.

#### Persistence and world-event ingestion
Prisma defines the durable data model in `prisma/schema.prisma`, with database access concentrated in `src/lib/db.ts`. The checked-in `prisma/dev.db` indicates a local SQLite development database; `scripts/setup-db.mjs` provisions or initializes it. A separate world-events endpoint, `src/app/api/world-events/route.ts`, forms an integration boundary for externally sourced event data rather than coupling that source directly to UI components.

#### Admin authentication and protected operations
Admin sign-in, session verification, and logout are implemented as dedicated server endpoints:
- `src/app/api/admin/login/route.ts`
- `src/app/api/admin/verify/route.ts`
- `src/app/api/admin/logout/route.ts`

Authentication logic is centralized in `src/lib/auth.ts`. Admin UI is partitioned with `src/app/admin/layout.tsx` and `src/app/admin/login/page.tsx`; `src/proxy.ts` is the likely request-level enforcement or routing boundary for protected access.

#### Runtime and deployment boundaries
The application runs on Next.js with TypeScript (`next.config.ts`, `tsconfig.json`) and uses Next’s server route handlers for database, authentication, geocoding, and world-event integration. Prisma is configured through `prisma.config.ts`. The browser handles globe rendering and interaction; server endpoints isolate persistence, credentials/session handling, and external-service calls from that client runtime.

Main entry points: [`src/store/globeStore.ts`](https://github.com/rohitkumarsingh0111/3d-interactive-globe/blob/main/src/store/globeStore.ts) (Globe store), [`src/components/scene/GlobeScene.tsx`](https://github.com/rohitkumarsingh0111/3d-interactive-globe/blob/main/src/components/scene/GlobeScene.tsx) (Globe scene), [`src/lib/db.ts`](https://github.com/rohitkumarsingh0111/3d-interactive-globe/blob/main/src/lib/db.ts) (Database access), [`src/app/page.tsx`](https://github.com/rohitkumarsingh0111/3d-interactive-globe/blob/main/src/app/page.tsx) (Globe page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_browser["Browser UI"]
  node_app_shell["App shell<br/>Next.js layout<br/>[layout.tsx]"]
  node_public_page["Globe page<br/>App Router page<br/>[page.tsx]"]
  node_event_ui["Event controls &amp; detail<br/>UI components<br/>[GlobeFilterBar.tsx]"]
end

subgraph group_scene["Globe scene"]
  node_globe_scene["Globe scene<br/>scene integration<br/>[GlobeScene.tsx]"]
  node_globe_variants["Globe renderers<br/>3D components<br/>[PhysicalGlobe.tsx]"]
  node_event_marker["Event markers<br/>scene component<br/>[EventMarker.tsx]"]
  node_textures["Globe textures<br/>static assets"]
  node_globe_store["Globe store<br/>client state<br/>[globeStore.ts]"]
  node_globe_types["Globe domain types<br/>TypeScript types<br/>[globe.ts]"]
end

subgraph group_api["Server APIs"]
  node_events_api{{"Events API<br/>route handlers<br/>[route.ts]"}}
  node_world_events_api{{"World-events API<br/>integration handler<br/>[route.ts]"}}
  node_geocode_api{{"Geocoding API<br/>integration handler<br/>[route.ts]"}}
end

subgraph group_data["Data &amp; persistence"]
  node_seed_events["Seed event content<br/>static data<br/>[events.ts]"]
  node_geo_utils["Geographic normalization<br/>domain utility<br/>[geoUtils.ts]"]
  node_prisma_model["Prisma event model<br/>ORM schema<br/>[schema.prisma]"]
  node_database[("Local SQLite database<br/>durable storage<br/>[dev.db]")]
  node_db_client["Database access<br/>Prisma client<br/>[db.ts]"]
end

subgraph group_admin["Admin access"]
  node_admin_ui["Admin routes<br/>protected UI<br/>[page.tsx]"]
  node_auth_endpoints{{"Admin auth API<br/>route handlers<br/>[route.ts]"}}
  node_auth_logic["Authentication logic<br/>server auth<br/>[auth.ts]"]
  node_access_proxy{{"Protected-route proxy<br/>request enforcement<br/>[proxy.ts]"}}
end

node_app_shell -->|"hosts"| node_public_page
node_public_page -->|"renders"| node_globe_scene
node_globe_scene -->|"composes"| node_globe_variants
node_globe_scene -->|"renders"| node_event_marker
node_globe_variants -->|"uses"| node_textures
node_public_page -->|"presents"| node_event_ui
node_globe_store -->|"drives visible markers"| node_globe_scene
node_globe_store -->|"drives filters and selection"| node_event_ui
node_event_marker -->|"selects event"| node_globe_store
node_globe_store -->|"uses"| node_globe_types
node_events_api -->|"reads and writes"| node_db_client
node_events_api -.->|"may fall back to"| node_seed_events
node_world_events_api -->|"normalizes locations"| node_geo_utils
node_geocode_api -->|"normalizes locations"| node_geo_utils
node_db_client -->|"uses model"| node_prisma_model
node_db_client -->|"connects to"| node_database
node_access_proxy -->|"guards"| node_admin_ui
node_admin_ui -->|"authenticates through"| node_auth_endpoints
node_auth_endpoints -->|"uses"| node_auth_logic
node_auth_endpoints -.->|"accesses protected data"| node_db_client
node_globe_store -->|"loads event data"| node_events_api

click node_app_shell "https://github.com/rohitkumarsingh0111/3d-interactive-globe/blob/main/src/app/layout.tsx"
click node_public_page "https://github.com/rohitkumarsingh0111/3d-interactive-globe/blob/main/src/app/page.tsx"
click node_globe_scene "https://github.com/rohitkumarsingh0111/3d-interactive-globe/blob/main/src/components/scene/GlobeScene.tsx"
click node_globe_variants "https://github.com/rohitkumarsingh0111/3d-interactive-globe/blob/main/src/components/scene/PhysicalGlobe.tsx"
click node_event_marker "https://github.com/rohitkumarsingh0111/3d-interactive-globe/blob/main/src/components/scene/EventMarker.tsx"
click node_textures "https://github.com/rohitkumarsingh0111/3d-interactive-globe/tree/main/public/textures"
click node_globe_store "https://github.com/rohitkumarsingh0111/3d-interactive-globe/blob/main/src/store/globeStore.ts"
click node_globe_types "https://github.com/rohitkumarsingh0111/3d-interactive-globe/blob/main/src/types/globe.ts"
click node_event_ui "https://github.com/rohitkumarsingh0111/3d-interactive-globe/blob/main/src/components/ui/GlobeFilterBar.tsx"
click node_events_api "https://github.com/rohitkumarsingh0111/3d-interactive-globe/blob/main/src/app/api/events/route.ts"
click node_world_events_api "https://github.com/rohitkumarsingh0111/3d-interactive-globe/blob/main/src/app/api/world-events/route.ts"
click node_geocode_api "https://github.com/rohitkumarsingh0111/3d-interactive-globe/blob/main/src/app/api/geocode/route.ts"
click node_seed_events "https://github.com/rohitkumarsingh0111/3d-interactive-globe/blob/main/src/data/events.ts"
click node_geo_utils "https://github.com/rohitkumarsingh0111/3d-interactive-globe/blob/main/src/lib/geoUtils.ts"
click node_prisma_model "https://github.com/rohitkumarsingh0111/3d-interactive-globe/blob/main/prisma/schema.prisma"
click node_database "https://github.com/rohitkumarsingh0111/3d-interactive-globe/blob/main/prisma/dev.db"
click node_db_client "https://github.com/rohitkumarsingh0111/3d-interactive-globe/blob/main/src/lib/db.ts"
click node_admin_ui "https://github.com/rohitkumarsingh0111/3d-interactive-globe/blob/main/src/app/admin/page.tsx"
click node_auth_endpoints "https://github.com/rohitkumarsingh0111/3d-interactive-globe/blob/main/src/app/api/admin/login/route.ts"
click node_auth_logic "https://github.com/rohitkumarsingh0111/3d-interactive-globe/blob/main/src/lib/auth.ts"
click node_access_proxy "https://github.com/rohitkumarsingh0111/3d-interactive-globe/blob/main/src/proxy.ts"

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_shell,node_public_page,node_event_ui toneBlue
class node_globe_scene,node_globe_variants,node_event_marker,node_textures,node_globe_store,node_globe_types toneAmber
class node_events_api,node_world_events_api,node_geocode_api toneMint
class node_seed_events,node_geo_utils,node_prisma_model,node_database,node_db_client toneRose
class node_admin_ui,node_auth_endpoints,node_auth_logic,node_access_proxy toneIndigo
```

## Components

### Browser UI

Interactive public globe and admin interface.

- [App shell](https://github.com/rohitkumarsingh0111/3d-interactive-globe/blob/main/src/app/layout.tsx): Next.js layout · `src/app/layout.tsx`
- [Globe page](https://github.com/rohitkumarsingh0111/3d-interactive-globe/blob/main/src/app/page.tsx): App Router page · `src/app/page.tsx`
- [Event controls & detail](https://github.com/rohitkumarsingh0111/3d-interactive-globe/blob/main/src/components/ui/GlobeFilterBar.tsx): UI components · Filter bar, popup, and side panel surfaces. · `src/components/ui/GlobeFilterBar.tsx`

### Globe scene

Client-side visualization and event interaction.

- [Globe scene](https://github.com/rohitkumarsingh0111/3d-interactive-globe/blob/main/src/components/scene/GlobeScene.tsx): scene integration · `src/components/scene/GlobeScene.tsx`
- [Globe renderers](https://github.com/rohitkumarsingh0111/3d-interactive-globe/blob/main/src/components/scene/PhysicalGlobe.tsx): 3D components · Physical and dotted globe variants. · `src/components/scene/PhysicalGlobe.tsx`
- [Event markers](https://github.com/rohitkumarsingh0111/3d-interactive-globe/blob/main/src/components/scene/EventMarker.tsx): scene component · `src/components/scene/EventMarker.tsx`
- [Globe textures](https://github.com/rohitkumarsingh0111/3d-interactive-globe/tree/main/public/textures): static assets · `public/textures`
- [Globe store](https://github.com/rohitkumarsingh0111/3d-interactive-globe/blob/main/src/store/globeStore.ts): client state · Holds event, filter, and selection state. · `src/store/globeStore.ts`
- [Globe domain types](https://github.com/rohitkumarsingh0111/3d-interactive-globe/blob/main/src/types/globe.ts): TypeScript types · `src/types/globe.ts`

### Server APIs

Route handlers isolate data, auth, and integrations.

- [Events API](https://github.com/rohitkumarsingh0111/3d-interactive-globe/blob/main/src/app/api/events/route.ts): route handlers · Collection and individual event operations. · `src/app/api/events/route.ts`
- [World-events API](https://github.com/rohitkumarsingh0111/3d-interactive-globe/blob/main/src/app/api/world-events/route.ts): integration handler · Server boundary for external event sources. · `src/app/api/world-events/route.ts`
- [Geocoding API](https://github.com/rohitkumarsingh0111/3d-interactive-globe/blob/main/src/app/api/geocode/route.ts): integration handler · `src/app/api/geocode/route.ts`

### Data & persistence

Event model and local development storage.

- [Seed event content](https://github.com/rohitkumarsingh0111/3d-interactive-globe/blob/main/src/data/events.ts): static data · Initial, fallback, or development events. · `src/data/events.ts`
- [Geographic normalization](https://github.com/rohitkumarsingh0111/3d-interactive-globe/blob/main/src/lib/geoUtils.ts): domain utility · `src/lib/geoUtils.ts`
- [Prisma event model](https://github.com/rohitkumarsingh0111/3d-interactive-globe/blob/main/prisma/schema.prisma): ORM schema · `prisma/schema.prisma`
- [Local SQLite database](https://github.com/rohitkumarsingh0111/3d-interactive-globe/blob/main/prisma/dev.db): durable storage · `prisma/dev.db`
- [Database access](https://github.com/rohitkumarsingh0111/3d-interactive-globe/blob/main/src/lib/db.ts): Prisma client · `src/lib/db.ts`

### Admin access

Authenticated management routes and enforcement.

- [Admin routes](https://github.com/rohitkumarsingh0111/3d-interactive-globe/blob/main/src/app/admin/page.tsx): protected UI · Admin page, layout, and login page. · `src/app/admin/page.tsx`
- [Admin auth API](https://github.com/rohitkumarsingh0111/3d-interactive-globe/blob/main/src/app/api/admin/login/route.ts): route handlers · Login, verification, and logout endpoints. · `src/app/api/admin/login/route.ts`
- [Authentication logic](https://github.com/rohitkumarsingh0111/3d-interactive-globe/blob/main/src/lib/auth.ts): server auth · `src/lib/auth.ts`
- [Protected-route proxy](https://github.com/rohitkumarsingh0111/3d-interactive-globe/blob/main/src/proxy.ts): request enforcement · `src/proxy.ts`

## Connections

- App shell → Globe page: hosts
- Globe page → Globe scene: renders
- Globe scene → Globe renderers: composes
- Globe scene → Event markers: renders
- Globe renderers → Globe textures: uses
- Globe page → Event controls & detail: presents
- Globe store → Globe scene: drives visible markers
- Globe store → Event controls & detail: drives filters and selection
- Event markers → Globe store: selects event
- Globe store → Globe domain types: uses
- Events API → Database access: reads and writes
- Events API → Seed event content: may fall back to
- World-events API → Geographic normalization: normalizes locations
- Geocoding API → Geographic normalization: normalizes locations
- Database access → Prisma event model: uses model
- Database access → Local SQLite database: connects to
- Protected-route proxy → Admin routes: guards
- Admin routes → Admin auth API: authenticates through
- Admin auth API → Authentication logic: uses
- Admin auth API → Database access: accesses protected data
- Globe store → Events API: loads event data
