How rohitkumarsingh0111/3d-interactive-globe works
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: globeStore.ts Globe store · GlobeScene.tsx Globe scene · db.ts Database access · page.tsx Globe page
Components 21
Browser UI
Interactive public globe and admin interface.
- App shell
src/app/layout.tsx - Globe page
src/app/page.tsx - Event controls & detail · Filter bar, popup, and side panel surfaces.
src/components/ui/GlobeFilterBar.tsx
Globe scene
Client-side visualization and event interaction.
- Globe scene
src/components/scene/GlobeScene.tsx - Globe renderers · Physical and dotted globe variants.
src/components/scene/PhysicalGlobe.tsx - Event markers
src/components/scene/EventMarker.tsx - Globe textures
public/textures - Globe store · Holds event, filter, and selection state.
src/store/globeStore.ts - Globe domain types
src/types/globe.ts
Server APIs
Route handlers isolate data, auth, and integrations.
- Events API · Collection and individual event operations.
src/app/api/events/route.ts - World-events API · Server boundary for external event sources.
src/app/api/world-events/route.ts - Geocoding API
src/app/api/geocode/route.ts
Data & persistence
Event model and local development storage.
- Seed event content · Initial, fallback, or development events.
src/data/events.ts - Geographic normalization
src/lib/geoUtils.ts - Prisma event model
prisma/schema.prisma - Local SQLite database
prisma/dev.db - Database access
src/lib/db.ts
Admin access
Authenticated management routes and enforcement.
- Admin routes · Admin page, layout, and login page.
src/app/admin/page.tsx - Admin auth API · Login, verification, and logout endpoints.
src/app/api/admin/login/route.ts - Authentication logic
src/lib/auth.ts - Protected-route proxy
src/proxy.ts
Connections 21
- 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