How 252627-bhif-syp/terranova works
1. Overall shape
- TerraNova is a three-part monorepo: a React/Vite frontend, an ASP.NET Core backend, and a small Node-based geospatial service.
- The product goal, from the README, is an interactive climate-learning platform centered on a 3D globe, country exploration, scenario sliders, and AI-assisted quizzes.
2. Frontend as the main user-facing subsystem
- terranova/frontend is the presentation layer, built with TypeScript + React and bundled with Vite.
- App.tsx, main.tsx, and the components/ tree show a componentized UI split into areas like:
- globe visualization (GlobeScene)
- country info overlays/popups (CountryPopup, LanguageFamilyPopup)
- climate narrative panels (ClimateInsightPanel)
- authentication/account UI (AuthModal, AccountPage, UserMenu)
- quiz UX (Quiz/*)
- State is shared through React contexts such as AuthContext and GlobeContext, which are the main client-side coordination points.
3. Client-side data-heavy visualization
- A large portion of the climate and geography content is shipped as static files under frontend/public/data and frontend/src/data.
- This includes GeoJSON, JSON timelines, scenario datasets, species/red-list tables, and historical climate series.
- Architecturally, this means many visualizations are likely data-driven in the browser, with the frontend reading preprocessed assets rather than requesting every chart or map layer from the backend.
4. Data preprocessing and content pipeline
- The frontend contains scripts under frontend/scripts/ for transforming climate and biodiversity datasets before they are served.
- There is also a root fetch_languages.mjs, suggesting some content is generated or refreshed outside the app runtime.
- This creates a clear boundary between offline/prebuild data preparation and runtime UI rendering.
5. Backend API layer
- terranova/backend/TerraNova.Api is an ASP.NET Core Minimal API app exposing the server-side entry points.
- The endpoint groups are explicitly separated by domain:
- AuthEndpoints
- ChatEndpoints
- CountriesEndpoints
- QuizEndpoints
- TeamEndpoints
- UnsplashEndpoints
- This suggests the backend is the orchestration layer for identity, AI/chat, country metadata, quiz persistence, team/community features, and external image lookup.
6. Core domain boundary
- TerraNova.Core holds the shared domain contracts:
- models like Country, Quiz, Question, QuizResult, User, ChatRequest, ChatResponse
- service interfaces like IChatService and IJwtService
- This is the architecture boundary that keeps business concepts independent from web, database, or third-party implementation details.
7. Infrastructure and persistence
- TerraNova.Infrastructure contains the concrete integrations:
- ApplicationDbContext for Entity Framework Core
- DbSeeder for initial data
- EF migrations for evolving the schema
- service implementations like JwtService, GeminiChatService, and UnsplashService
- The migration history indicates the backend persists structured application data such as users, quizzes, and quiz results in a relational database, likely PostgreSQL given the K8s manifest naming.
8. External service integrations
- The backend is the integration point for external APIs:
- Gemini via GeminiChatService for AI-driven chat or quiz generation
- Unsplash via UnsplashService for image content
- JWT for authentication tokens
- These integrations are isolated behind interfaces, so the API layer depends on stable contracts rather than vendor-specific code.
9. Geospatial auxiliary service
- terranova/gee-service is a separate Node.js service with its own Dockerfile and server.js.
- Given the name and the repository’s globe/climate focus, it likely acts as a specialized service for geospatial/earth-engine-style processing or map-related requests.
- Its separate deployment indicates it is treated as an independent runtime boundary, not just a library.
10. Deployment and runtime topology
- The repo includes both docker-compose.yml and Kubernetes manifests under k8s/.
- Kubernetes resources are split by subsystem: frontend, backend, gee-service, plus backend PostgreSQL and ingress.
- This means the production architecture is containerized and routed through an ingress, with each service deployed independently.
11. How requests flow through the system
- The browser loads the React frontend, which reads static climate/geography datasets locally for fast visualization.
- When the user authenticates, asks AI questions, saves quiz progress, or fetches country/team data, the frontend calls the ASP.NET API.
- The API then:
- validates/authenticates with JWT
- reads/writes application data through EF Core
- forwards AI/image requests to Gemini or Unsplash
- optionally coordinates with the geospatial service for specialized map data
12. Supporting assets and project documentation
- The Docs/ folder contains personas, research, user stories, testing feedback, and vector DB research, which shows the repo is both a product implementation and an evolving project definition.
- The .agents/skills directory is developer tooling/documentation for consistent implementation patterns, but it does not change runtime architecture.
Main entry points: App.tsx App shell · Program.cs API host · climate_zones.json Static data · docker-compose.yml Compose
Components 20
Frontend
React/Vite client and its browser-side data and UI layers
- App shell · Top-level client composition and bootstrapping
terranova/frontend/src/App.tsx - Main entry · Client startup and React rendering
terranova/frontend/src/main.tsx - Globe scene · Primary interactive globe and map interaction surface
terranova/frontend/src/components/GlobeScene/GlobeScene.tsx - Info panels · Country, climate, and language popups and insights
terranova/frontend/src/components/CountryPopup/CountryPopup.tsx - Auth UI · Login, account, and user menu flows
terranova/frontend/src/components/AuthModal/AuthModal.tsx - Quiz UI · Quiz creation, play, and dashboard experience
terranova/frontend/src/components/Quiz/QuizDashboard.tsx - Client state · Shared globe and authentication state
terranova/frontend/src/contexts/GlobeContext.tsx - Static data · Preloaded climate, geography, and biodiversity assets
terranova/frontend/public/data/climate_zones.json - Data scripts · Offline transforms for climate and biodiversity content
terranova/frontend/scripts/process_co2_data.cjs
Backend
ASP.NET Core API, core domain, and infrastructure
- API host · ASP.NET Core server and endpoint composition
terranova/backend/TerraNova.Api/Program.cs - Endpoint groups · Domain-routed API surface for auth, chat, countries, quiz, team, and images
terranova/backend/TerraNova.Api/Endpoints/AuthEndpoints.cs - Core models · Shared entities, requests, and service interfaces
terranova/backend/TerraNova.Core/Models/Country.cs - Persistence · DbContext, seeding, migrations, and relational schema evolution
terranova/backend/TerraNova.Infrastructure/Data/ApplicationDbContext.cs - Integrations · JWT, Gemini chat, and Unsplash adapters
terranova/backend/TerraNova.Infrastructure/Services/GeminiChatService.cs
Services
Standalone auxiliary runtime
- GEE service · Separate geospatial runtime for specialized map processing
terranova/gee-service/server.js
Deployment
Container and cluster manifests
- Compose · Multi-service local runtime wiring
terranova/docker-compose.yml - Backend deploy · Backend, database, and service resources
terranova/k8s/backend/deployment.yaml - Frontend deploy · Frontend service and deployment resources
terranova/k8s/frontend/deployment.yaml - GEE deploy · Standalone deployment for the geospatial service
terranova/k8s/gee-service/deployment.yaml - Ingress · External traffic entrypoint and routing
terranova/k8s/ingress.yaml
Connections 27
- Main entry → App shell: boots · Entry point renders the app shell
- App shell → Globe scene: hosts · App embeds the interactive globe scene
- App shell → Info panels: shows · App coordinates overlay content
- App shell → Auth UI: shows · App opens authentication and account flows
- App shell → Quiz UI: shows · App routes into quiz experience
- App shell → Client state: shares state · UI composition depends on client-side contexts
- Globe scene → Static data: reads · Visualization is driven by static geo and climate assets
- Info panels → Static data: reads · Popups and insights consume bundled datasets
- Quiz UI → Static data: reads · Quiz UI consumes preprocessed content where available
- Data scripts → Static data: builds · Offline scripts generate or normalize served datasets
- App shell → API host: calls · Client requests server-side features and persisted data
- API host → Endpoint groups: exposes · Program wires domain endpoint groups
- Endpoint groups → Core models: uses · Routes operate on shared domain contracts
- API host → Integrations: depends on · API delegates external integrations to infrastructure services
- API host → Persistence: persists via · API reads and writes through EF-backed persistence
- Integrations → Core models: implements · Infrastructure fulfills shared service interfaces
- Persistence → Core models: stores · Database persists domain entities
- API host → GEE service: coordinates · API can delegate specialized geospatial work
- Compose → App shell: runs · Local composition includes the frontend runtime
- Compose → API host: runs · Local composition includes the backend runtime
- Compose → GEE service: runs · Local composition includes the geospatial service
- Ingress → Frontend deploy: routes to · Ingress sends browser traffic to the frontend service
- Ingress → Backend deploy: routes to · Ingress sends API traffic to the backend service
- Ingress → GEE deploy: routes to · Ingress can expose the geospatial service
- Backend deploy → API host: deploys · Kubernetes backend manifests package the API and database
- Frontend deploy → App shell: deploys · Kubernetes frontend manifests package the client
- GEE deploy → GEE service: deploys · Kubernetes manifests package the Node geospatial service