GeoSentinel’s local development environment runs PostgreSQL 16 + PostGIS 3.4 in Docker while the FastAPI backend and React frontend run directly on your machine — giving you fast reloads without rebuilding containers on every change. The backend is managed withDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/danizd/GeoSentinel/llms.txt
Use this file to discover all available pages before exploring further.
uv for deterministic dependency resolution, and the frontend uses Vite for sub-second HMR. Two optional relay microservices (military flights and AIS vessel tracking) can be started independently when you need to test those data layers.
Prerequisites
Before you begin, make sure the following are installed and available on yourPATH:
- Python 3.12+ — managed with
uv(see below) - Node.js 18+ — for the React frontend (
node --version) - Docker + Docker Compose v2 — for the PostgreSQL/PostGIS container (
docker compose version) uvpackage manager — install once with:- API keys for the external data sources you want to enable:
Source Purpose Registration GDELT Cloud v2 Conflict events https://gdeltcloud.com/dashboard ACLED Structured conflict data https://acleddata.com/myacled FIRMS (NASA) Active wildfire hotspots https://firms.modaps.eosdis.nasa.gov/api/map_key/ Mapbox Frontend map rendering https://console.mapbox.com/ OpenSky Network Military flight relay (optional) https://opensky-network.org/my-opensky/account AISStream AIS vessel relay (optional) https://aisstream.io
Step-by-Step Setup
Start PostgreSQL 16 + PostGIS 3.4
From the project root, spin up the database container defined in The compose file uses the official Data is persisted in a named Docker volume (
docker-compose.yml:postgis/postgis:16-3.4 image and configures a healthcheck that polls pg_isready -U postgres every 5 seconds (5 retries, 5-second timeout). The database will be available on localhost:5432 once the healthcheck passes. You can confirm it is ready with:postgres_data) so it survives container restarts.Install Python dependencies
uv sync reads backend/pyproject.toml and installs an exact, locked environment into the backend/.venv virtualenv:uv run commands target it automatically.Install frontend dependencies
frontend/package.json.Create the .env file
Create a
.env file at the project root (the same directory as docker-compose.yml). The ingestors and API both load this file automatically at startup.Run database migrations
Apply all Alembic migrations to create the full schema (Alembic reads
events_canonical, incidents, aoi, corrections_audit, events_quarantine, sources_metadata):backend/alembic.ini, which sets script_location to backend/alembic and prepends backend to sys.path. Re-running this command is safe — Alembic is idempotent and will skip already-applied revisions.Start the FastAPI backend
Open a dedicated terminal and run Uvicorn in reload mode so the server restarts on every source change:The API will be available at
http://localhost:8000.Start the React frontend
Open a second terminal and start the Vite dev server:The frontend will be available at
http://localhost:5173 with hot module replacement enabled.Optional: Military Relay
The military flight relay is a separate FastAPI microservice that connects to the OpenSky Network API, filters for military aircraft using a monthly ICAO24 hex database (~10,000 entries), and exposes them on port 8002. It is only needed when testing theGET /v1/military-flights endpoint or the Mapbox military layer in the frontend.
PowerShell (Windows):
http://localhost:8002. At startup it checks data/military_hex.txt and automatically downloads the latest monthly OpenSky aircraft database (~108 MB from S3) if the file does not exist, is older than 30 days, or contains fewer than 1,000 entries. This background download does not block the relay from starting. A /debug endpoint is available at http://localhost:8002/debug for diagnosing filter coverage.
Optional: AIS Relay
The AIS relay microservice subscribes to the AISStream WebSocket feed and exposes real-time vessel positions on port 8003. It falls back to a mock data generator automatically whenAISSTREAM_API_KEY is missing or the WebSocket connection drops.
http://localhost:8003. The frontend polls this relay for vessel data displayed in the AIS map layer.
Seeding Test Data
To quickly populate the database with three representative incidents (a conflict event, an earthquake, and a wildfire) along with thesources_metadata entries for all configured ingestors, call the seed endpoint:
Running Ingestors
Each ingestor is a standalone Python script that loads.env from the project root automatically. Run them from inside the backend/ directory so that uv picks up the correct virtual environment and all backend dependencies are available:
| Ingestor | Command | Notes |
|---|---|---|
| USGS Earthquakes | uv run python scripts/run_usgs.py | Pulls last 24 h, minmagnitude=4.0, polling every 3 min |
| FIRMS Wildfires | uv run python scripts/run_firms.py | Requires FIRMS_MAP_KEY; filters by active AOI bounding boxes |
| GDELT Conflicts | uv run python scripts/run_gdelt.py | Requires GDELT_API_KEY; 5-min window via GDELT Cloud v2 |
| ACLED Conflicts | uv run python scripts/run_acled.py | Requires ACLED_USERNAME + ACLED_PASSWORD; backfills 48 h |
| Clustering | uv run python scripts/run_clustering.py | DBSCAN spatio-temporal clustering; run after any ingestor |
Always run the clustering job after ingesting new events. The clustering step is what groups raw
events_canonical rows into the incidents that the API and frontend display.Running Tests
Tests live in thetests/ directory at the project root. Run them from inside backend/ so that uv picks up the correct virtual environment:
Service URLs
| Service | URL | Notes |
|---|---|---|
| FastAPI REST API | http://localhost:8000 | Main backend |
| Swagger UI | http://localhost:8000/docs | Interactive API explorer |
| ReDoc | http://localhost:8000/redoc | OpenAPI schema browser |
| React Frontend | http://localhost:5173 | Vite dev server with HMR |
| Military Relay | http://localhost:8002 | Optional; requires OpenSky credentials |
| AIS Relay | http://localhost:8003 | Optional; requires AISStream API key |
