Skip to content

AnishNehete/TheSphere

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

9 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŒ Sphere

https://thesphere.icu/

A search-first global intelligence platform for understanding what is happening in the world, why it matters, and what it could impact next.

Sphere is a full-stack investigation platform that combines a photorealistic 3D globe, live global signals, market intelligence, calibrated retrieval, causal reasoning, and portfolio-impact analysis.

It is designed around one simple interaction:

Ask a question โ†’ resolve the entity โ†’ retrieve scoped evidence โ†’ explain the cause โ†’ show market/portfolio impact โ†’ save/share the investigation

Example questions:

  • Why is TSLA down?
  • Compare oil yesterday vs today
  • Compare Japan vs Korea
  • What does a Red Sea disruption mean for energy markets?
  • What changed in Japan in the last 24 hours?

๐Ÿ“ธ Demo Preview

Add screenshots or GIFs here before publishing.

View Placeholder
๐ŸŒ Hero Globe image />
๐Ÿ”Ž Search Investigation image
๐Ÿ”— Causal Chain image
๐Ÿ“ˆ Market Tape + Charts image
๐Ÿงญ Compare Mode image

๐Ÿง  What Sphere Does

Sphere turns open-ended questions into structured investigations.

Instead of showing weather, markets, news, flights, health, and conflict as isolated widgets, Sphere connects them into one intelligence workflow.

Core loop

query
  โ†’ intent classification
  โ†’ entity resolution
  โ†’ scoped retrieval
  โ†’ calibrated ranking
  โ†’ causal chain generation
  โ†’ market posture
  โ†’ portfolio impact
  โ†’ evidence + caveats
  โ†’ save / share / alert

Example

A user asks:

Why is oil up?

Sphere can resolve the query as a commodity question, retrieve oil-related evidence, rank the top drivers, build causal chains, and explain the possible transmission path.

Shipping disruption โ†’ supply-chain pressure โ†’ oil supply risk โ†’ commodity posture changes

The goal is not just to answer what happened.

The goal is to explain:

  • what changed
  • why it matters
  • what it affects
  • how confident the system is
  • what evidence supports it

๐ŸŽฏ Why This Matters

For individuals

  • Understand market moves beyond price charts
  • Connect global news to financial risk
  • Track countries, commodities, FX, and equities in one place
  • Save and share structured investigations

For companies

  • Monitor geopolitical, weather, health, and logistics risk
  • Track exposure to countries, sectors, commodities, and currencies
  • Build operational dashboards for supply-chain and market risk
  • Convert scattered signals into decision-ready intelligence

For analysts and operators

Sphere acts like a lightweight intelligence workstation:

  • live global context
  • evidence-backed summaries
  • causal drivers
  • risk posture
  • portfolio impact
  • alerts
  • shareable briefs

๐ŸŒ Photorealistic Globe

Sphere uses a custom Three.js + React Three Fiber globe as the spatial context layer.

The globe is not just decoration. It is designed to visualize live signals and investigation context.

Globe features

  • ๐ŸŒŠ Ocean shader with darker navy tones and controlled specular response
  • โ˜๏ธ Cloud shell / volumetric cloud layer for atmospheric depth
  • ๐ŸŒ… Atmosphere rim and twilight shading
  • ๐ŸŒƒ Night-side city lights and shadow-side ambient visibility
  • ๐ŸŒŒ Dense starfield for cinematic space context
  • โ˜€๏ธ Real-time sun direction and lighting driver
  • ๐Ÿงญ Camera focus controller for country/entity search
  • ๐Ÿ“ Domain markers for events, conflicts, health signals, markets, and news
  • โœˆ๏ธ Planned / experimental support for 3D flight arcs and route visualizations

Shader and rendering goals

Sphereโ€™s rendering direction is inspired by:

  • cinematic Earth visualization
  • operational command-center interfaces
  • dark glass UI systems
  • premium geospatial intelligence tools

The globe is tuned for:

  • depth
  • atmosphere
  • spatial context
  • readable overlays
  • restrained visual drama

It is not intended to be a scientific Earth simulator. It is a premium intelligence surface.


โœจ UI / Product Design Philosophy

Sphere follows an operator-first interface.

The UI is built around dense but readable intelligence surfaces:

  • ๐Ÿ”Ž top command bar
  • ๐ŸŒ globe stage
  • ๐Ÿ“ก awareness rail
  • ๐Ÿ“Š right-side investigation panel
  • ๐Ÿ“ˆ market tape
  • ๐Ÿงพ evidence cards
  • ๐Ÿ”— causal chain cards
  • ๐Ÿ’ผ portfolio impact cards

Design direction

The intended visual language is:

Palantir-style seriousness
+ Bloomberg-style density
+ Apple-level dark glass polish
+ cinematic globe context

UI principles

  • Search first, not menu first
  • Evidence before claims
  • Confidence and caveats always visible
  • Compact signals, not long prose dumps
  • No hidden synthetic/live data ambiguity
  • Visual hierarchy should guide the analyst from answer โ†’ why โ†’ evidence

๐Ÿ“ก Live Indicators and Signal Types

Sphere supports multiple signal domains.

Domain What it represents Example use
๐Ÿ“ˆ Markets Equities, ETFs, market posture TSLA, NVDA, SPY
๐Ÿ’ฑ FX Currency pairs and currency pressure USDJPY, EURUSD
๐Ÿ›ข Commodities Oil, gold, energy/material signals crude oil, gold
๐Ÿ“ฐ News Geolocated global events GDELT-style event feeds
๐ŸŒฆ Weather Storms, alerts, operational disruptions severe weather near logistics regions
๐Ÿฆ  Health outbreak or health-risk signals regional health pressure
โš ๏ธ Conflict geopolitical and regional risk conflict markers, risk posture
โœˆ๏ธ Flights mobility and route disruption signals flight arcs, airport disruption markers

Each signal can carry:

  • timestamp
  • severity
  • domain
  • location
  • source health
  • confidence
  • freshness
  • related entities

๐Ÿค– Intelligence Engine

Sphere is built around a hybrid intelligence architecture.

It does not let the LLM invent facts.

Instead, it separates deterministic truth from language generation.

Deterministic layer

The deterministic layer handles:

  • entity resolution
  • query intent classification
  • time-window parsing
  • scoped retrieval
  • evidence ranking
  • confidence calibration
  • causal chain construction
  • market posture scoring
  • portfolio impact mapping

LLM / agentic layer

The LLM layer is optional and bounded.

It is used for:

  • rewriting grounded explanations
  • summarizing evidence
  • improving narrative clarity
  • producing analyst-style language

It is not used as the source of truth for:

  • prices
  • candles
  • risk scores
  • causal edges
  • portfolio impact
  • provider health
  • confidence values

๐Ÿ”Ž Retrieval, Ranking, and Calibration

Sphereโ€™s retrieval flow is designed to avoid vague global fallback answers.

The system performs:

  1. query classification
  2. entity resolution
  3. domain scoping
  4. time-window parsing
  5. evidence retrieval
  6. reranking
  7. confidence calibration
  8. caveat generation

Calibration inputs

Confidence is based on interpretable inputs such as:

  • evidence count
  • evidence agreement
  • recency
  • source diversity
  • entity-resolution confidence
  • feedback signals from query logs

Query log and reranking

Sphere includes a query logging and calibration system that can capture:

  • query text
  • intent
  • resolved entities
  • evidence IDs
  • confidence score
  • result count
  • latency
  • user feedback action

This allows future tuning of ranking weights and confidence formulas.


๐Ÿ”— Causal Chain Engine

Sphere includes a deterministic causal-chain engine.

It converts evidence into structured paths like:

event / signal โ†’ mechanism โ†’ affected domain โ†’ downstream asset / region / portfolio exposure

Example:

Red Sea disruption
  โ†’ shipping route pressure
  โ†’ supply-chain risk
  โ†’ oil risk premium
  โ†’ energy portfolio exposure

Causal chain components

  • Causal nodes
  • Causal edges
  • Mechanisms
  • Impact direction
  • Impact strength
  • Confidence
  • Caveats
  • Source evidence IDs

Every causal chain must be grounded in evidence. Unsupported causality returns caveats instead of fake explanations.


๐Ÿ’ผ Portfolio Impact Linkage

Sphere can map causal chains to a demo or user portfolio.

Example:

Oil supply pressure โ†’ energy sector โ†’ XOM exposure

The system classifies exposure as:

  • Direct โ€” affected symbol matches a holding
  • Indirect โ€” affected domain matches sector/asset metadata
  • Weak โ€” broad country or macro exposure

The system does not fake P&L or pretend to provide financial advice.

It shows directional exposure and caveats.


๐Ÿ“ˆ Market Posture and Charts

Sphere supports market posture analysis using a combination of:

  • technical indicators
  • semantic/news pressure
  • macro/entity relevance
  • confidence and caveats

The posture output can include:

  • Strong Sell
  • Sell
  • Neutral
  • Buy
  • Strong Buy

Provider honesty

Sphere clearly distinguishes between:

  • LIVE
  • CACHED
  • SYNTHETIC DEMO
  • UNAVAILABLE
  • RATE LIMITED

If no live provider key is configured, charts run with deterministic synthetic demo data and are labeled accordingly.


๐Ÿงฑ Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Frontend                            โ”‚
โ”‚ Next.js + React + TypeScript        โ”‚
โ”‚ React Three Fiber / Three.js Globe  โ”‚
โ”‚ Zustand State Stores                โ”‚
โ”‚ Lightweight Charts                  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                   โ”‚
                   โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Backend                             โ”‚
โ”‚ FastAPI + Pydantic                  โ”‚
โ”‚ Intelligence Runtime                โ”‚
โ”‚ Retrieval Orchestrator              โ”‚
โ”‚ Calibration + Reranker              โ”‚
โ”‚ Causal Chain Builder                โ”‚
โ”‚ Portfolio Impact Engine             โ”‚
โ”‚ Alert Evaluator                     โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                   โ”‚
                   โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Storage                             โ”‚
โ”‚ PostgreSQL + PostGIS                โ”‚
โ”‚ Redis                               โ”‚
โ”‚ Alembic Migrations                  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                   โ”‚
                   โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Optional External Providers         โ”‚
โ”‚ Alpha Vantage                       โ”‚
โ”‚ GDELT                               โ”‚
โ”‚ Open-Meteo                          โ”‚
โ”‚ USGS                                โ”‚
โ”‚ Frankfurter                         โ”‚
โ”‚ Anthropic Claude                    โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿงฐ Tech Stack

Layer Technology
Frontend Next.js, React, TypeScript
Globe Three.js, React Three Fiber, custom shaders
State Zustand
Charts Lightweight charting surface
Backend FastAPI, Python, Pydantic
Persistence PostgreSQL, PostGIS, Alembic
Cache / Alerts Redis
AI Narrative Anthropic Claude, optional
Market Data Alpha Vantage, Polygon
Testing Pytest, Vitest, Playwright
Infra Docker Compose, health checks
Deployment Railway relay, Cloudfare https://thesphere.icu/

๐Ÿงช Testing

# Backend
cd backend
uv run pytest

# Frontend
cd frontend
pnpm test

# Frontend typecheck
cd frontend
pnpm tsc --noEmit

# Optional Playwright
cd frontend
pnpm playwright test

The project includes tests for:

  • retrieval
  • entity resolution
  • compare mode
  • time-window parsing
  • causal chain generation
  • market posture
  • portfolio impact
  • alerts
  • saved investigations
  • frontend panels
  • globe interaction paths

๐Ÿš€ Local Setup

Docker setup

cp .env.example .env
# Add optional API keys if available

docker compose up --build

Frontend:

http://localhost:3000

Backend:

http://localhost:8000

Useful commands

# Rebuild frontend only
docker compose up -d --build frontend

# Rebuild backend only
docker compose up -d --build backend

# Check Redis
docker compose exec redis redis-cli ping

# Check Postgres tables
docker compose exec postgres psql -U sphere -d sphere -c "\dt"

# Backend logs
docker compose logs backend --tail=200

๐Ÿ” Environment Variables

Variable Purpose Required
INTELLIGENCE_DATABASE_URL Postgres DSN for investigations/query logs Recommended
INTELLIGENCE_REDIS_URL Redis URL for alerts/rate limits Recommended
INTELLIGENCE_MARKET_DATA_PROVIDER Market provider selection Optional
INTELLIGENCE_ALPHA_VANTAGE_API_KEY Live market candles Optional
INTELLIGENCE_ANTHROPIC_API_KEY Claude narrative layer Optional
NEXT_PUBLIC_API_BASE_URL Frontend backend URL Required
NEXT_PUBLIC_WS_BASE_URL WebSocket base URL if enabled Optional

Sphere can run without provider keys, but live functionality improves when keys are configured.


๐Ÿงญ Full Phase Breakdown

Phase Name What was built Status
1 Foundation Project setup, initial architecture, frontend/backend skeleton โœ… Done
2 Globe Prototype Early 3D Earth surface and basic scene setup โœ… Done
3 Workspace Shell Initial command-center layout and panels โœ… Done
4 Signal Ingestion Early global signal/event ingestion concepts โœ… Done
5 Event Modeling Normalized event structures and domain concepts โœ… Done
6 UI Panels Early right-panel and rail surfaces โœ… Done
7 Globe Visuals Atmosphere, borders, markers, lighting experiments โœ… Done
8 Search Flow Search-first interaction model โœ… Done
9 Intelligence Workspace Query panel, focus behavior, workspace state โœ… Done
10 Globe Shader System Ocean, atmosphere, clouds, night side, tone mapping โœ… Done
11 Live Feeds Weather, news, markets, health/conflict/feed adapters โœ… Done
12 Agentic Investigation Early agent query service and grounded answer flow โœ… Done
12.3 Geographic Trust Repair Better city/country scoping and fallback honesty โœ… Done
13 Portfolio Intelligence Portfolio surface, holdings context, valuation/posture basics โœ… Done
13B Signal Engines Technical indicators, charting, replay foundation โœ… Done
14 Operator UI Mode system, shell refinement, panel grammar โœ… Done
15A Workflow Repair Onboarding, rail improvements, better demo flow โœ… Done
15B Chart Surface Indicators, technical rating, chart wrapper โœ… Done
15C Timeline Intelligence Trend deltas, what-changed logic, feed warming โœ… Done
16 Motion + Market Surface Ticker tape, replay cursor, hydration fixes โœ… Done
16.7 Universal Market Charts Decoupled charts from portfolio membership โœ… Done
17A Posture Engine Deterministic market posture and provider contracts โœ… Done
17A.2 Semantic Market Layer Semantic/news pressure blended into posture โœ… Done
17A.3 Agentic Narrative Bounded LLM narrative over deterministic posture โœ… Done
17B Saved Investigations Save/restore/share investigation snapshots โœ… Done
17C Alerts MVP Alert rules, alert events, bell surface, rate limits โœ… Done
18A Retrieval Orchestrator EvidenceBundle, time windows, compare planning โœ… Done
18B Calibration Query logs, reranking, confidence calibration โœ… Done
18C Scope Enforcement Entity-first routing, no global fallback, compare fixes โœ… Done
18D Causal Chains Deterministic causal chain engine and top drivers โœ… Done
19A Demo Polish Search examples, story ordering, causal card emphasis โœ… Done
19B Portfolio Impact Causal chain to portfolio/demo-book linkage โœ… Done
19C Globe Revamp Clouds, starfield, real-time sun, marker fixes โœ… Done
19D Visual System Design tokens, gradients, premium dark glass polish โœ… Done
19E Launch Verification Infra audit, provider honesty, chart reliability checks ๐Ÿšง Finalizing
20A Domain Globe Layers Flights, health, conflict, news markers/arcs/hotspots ๐Ÿšง In progress / planned

๐Ÿง  What Makes This Different

Most dashboards show data.

Sphere tries to explain meaning.

signal โ†’ evidence โ†’ cause โ†’ impact โ†’ confidence โ†’ action

This makes it closer to a lightweight intelligence system than a standard analytics dashboard.


โš ๏ธ Honest Limitations

Sphere is still a prototype.

Current limitations:

  • Not investment advice
  • Not a replacement for professional terminals
  • Live data depends on provider keys and rate limits
  • Some domains use fallback/demo data when providers are unavailable
  • No multi-user authentication yet
  • No enterprise permission model yet
  • Flight/health/conflict visual layers are still evolving
  • Globe realism is custom-built and still being tuned
  • No CI/CD pipeline yet

๐Ÿ”ฎ Future Work

Product

  • Multi-user workspaces
  • Team investigation sharing
  • Watchlists and saved entities
  • Better onboarding and demo mode
  • Advanced alert rules
  • Investigation export to PDF / Markdown

Data

  • More reliable market providers
  • Better flight route providers
  • More robust health/conflict feeds
  • Historical event replay
  • Provider freshness dashboard

AI / Intelligence

  • Lightweight RAG over saved investigations
  • Deeper causal-chain expansion
  • Better confidence calibration from real usage
  • Analyst feedback loop
  • Domain-specific sub-agents

Globe

  • Improved domain markers
  • 3D flight arcs
  • health/conflict hotspots
  • better marker occlusion
  • improved cloud realism
  • more detailed polar views

Infrastructure

  • CI/CD
  • hosted deployment
  • auth
  • observability
  • backups
  • rate-limit dashboards

๐Ÿงพ Resume-Friendly Summary

Sphere | Real-Time Geospatial Intelligence Platform

Next.js, TypeScript, React Three Fiber, FastAPI, PostgreSQL/PostGIS, Redis, Docker

Sphere is a real-time geospatial intelligence platform that fuses world signals, market data, calibrated retrieval, causal-chain reasoning, and portfolio-impact analysis into a search-first investigation workflow.

It demonstrates:

  • full-stack systems engineering
  • frontend visualization engineering
  • backend intelligence pipelines
  • retrieval and ranking
  • causal reasoning
  • provider honesty
  • production-oriented persistence and caching

๐Ÿ“Œ License

Personal project. Shared for portfolio and review purposes. Not licensed for production redistribution.


๐Ÿ™‹ Author

Built by Anish Nehete.

If you find this project interesting, consider starring the repository โญ

About

A search-first global intelligence platform for understanding what is happening in the world, why it matters, and what it could impact next.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors