How veershah1152/sunhacks- works
1. System boundary
- This repo is a two-tier OSINT intelligence system: a React/Vite frontend and a Python/FastAPI backend.
- The backend is the core of the architecture; it ingests conflict-related sources, stores them in a searchable corpus, runs multi-agent analysis, and returns a structured intelligence report.
2. Frontend subsystem
- The frontend is a dashboard-style SPA built with React and Vite.
- App.jsx is the root composition point, with Dashboard.jsx and LoginPage.jsx indicating a simple authenticated/unauthenticated split.
- AuthContext.jsx and IntelligenceContext.jsx hold session/auth state and the latest analysis payload, which the UI renders into cards such as risk, signals, scenarios, sources, impact, and trend views.
3. Backend API boundary
- backend/main.py is the FastAPI entrypoint and exposes the main contract to the frontend.
- The documented endpoints are:
- GET /health for service/store status
- POST /update for ingesting new OSINT
- GET /analyze for running the intelligence pipeline
- POST /clear for wiping stored data
- This creates a clear separation between the UI and all ingestion/analysis/storage logic.
4. Ingestion subsystem
- External sources are pulled through backend/ingestion/gnews_fetcher.py and backend/ingestion/rss_fetcher.py.
- The system combines a search-style news API source with RSS feeds from major publishers, giving it both query-driven retrieval and continuous feed coverage.
- The update flow is the primary entry point for new evidence entering the system.
5. Text preprocessing boundary
- backend/processing/cleaner.py strips noise/HTML and normalizes article text before storage.
- backend/processing/chunker.py breaks longer text into smaller semantic chunks for embedding and retrieval.
- This preprocessing layer sits between raw source ingestion and vector storage, ensuring the stored corpus is analysis-ready.
6. Persistent data layer
- The main storage design is a dual-store architecture: FAISS for vector similarity search and SQLite for metadata/deduplication.
- StoreManager coordinates both stores and handles incremental merges, so the index grows over time rather than being rebuilt on each update.
- The README emphasizes two deduplication boundaries: URL hash and content hash, which prevents the same article from being embedded twice.
- mongo_store.py exists as an alternate backend, but the documented primary architecture is FAISS + SQLite.
7. Storage lifecycle and cache behavior
- The repo includes a backend/cache/ directory and a cache_manager.py, indicating query/result caching for repeated analysis runs.
- The store is persisted on disk, so startup can restore state rather than starting empty.
- POST /clear is a reset path for development or operational cleanup.
8. Analysis subsystem: multi-agent pipeline
- backend/pipeline/crew_runner.py orchestrates the analysis run as a sequential agent pipeline.
- The agents directory contains multiple specialized roles: ingestion, detection, risk scoring, simulation, report generation, trend analysis, impact analysis, civilian impact, and briefing.
- In architectural terms, the key pattern is: retrieve evidence → assess risk → simulate scenarios → format final report.
9. LLM/runtime dependency
- The analysis layer depends on Ollama with Llama 3.2, which runs locally and is invoked by the agent pipeline.
- This means the backend is not just a search service; it is an AI reasoning system that transforms stored OSINT into a structured intelligence product.
10. End-to-end data flow
- The primary flow is:
- frontend submits a query
- FastAPI calls ingestion on /update
- fetched articles are cleaned, chunked, deduplicated, and stored in FAISS/SQLite
- /analyze retrieves relevant stored evidence
- the agent pipeline generates a JSON intelligence report
- the frontend renders that report into dashboard cards and charts
- This makes the corpus store the main shared boundary between ingestion and analysis.
11. Operational and product shape
- The repo is designed for local/dev deployment rather than cloud-native scaling: Python backend, Node frontend, local Ollama model, disk-persistent vector store.
- The UI components are focused on analyst workflow, not generic CRUD: risk, signals, scenarios, sources, impact, and trends.
- For an architecture diagram, the most important boxes are: React dashboard, FastAPI orchestration, OSINT ingestion, preprocessing, FAISS/SQLite persistence, agent pipeline, and local LLM runtime.
Main entry points: main.py API · App.jsx App · crew_runner.py Crew runner · store_manager.py Store manager
Components 18
Frontend
React/Vite analyst dashboard and session state
- App · Root composition and authenticated dashboard/login split
frontend/src/App.jsx - Auth · Session and login state
frontend/src/context/AuthContext.jsx - Intel state · Latest intelligence payload for the dashboard
frontend/src/context/IntelligenceContext.jsx - Dashboard · Main analyst workspace
frontend/src/Dashboard.jsx - Login · Unauthenticated entry screen
frontend/src/LoginPage.jsx - Analysis cards · Risk, signals, scenarios, sources, impact, trends, briefings
frontend/src/components
Backend
FastAPI orchestration, ingestion, storage, and analysis
- API · HTTP boundary for health, update, analyze, and clear
backend/main.py - News fetcher · Search-style external news retrieval
backend/ingestion/gnews_fetcher.py - RSS fetcher · Publisher feed collection
backend/ingestion/rss_fetcher.py - Cleaner · Noise and HTML normalization
backend/processing/cleaner.py - Chunker · Splits articles into retrievable text chunks
backend/processing/chunker.py - Store manager · Coordinates incremental writes and merges across stores
backend/database/store_manager.py - FAISS · Similarity search index for chunk embeddings
backend/database/faiss_store.py - SQLite · Persistent metadata, hashes, and deduplication
backend/database/sqlite_store.py - Cache · Caches repeated analysis results
backend/pipeline/cache_manager.py - Crew runner · Orchestrates sequential multi-agent intelligence generation
backend/pipeline/crew_runner.py - Agents · Ingestion, detection, risk, simulation, impact, trends, briefing, report
backend/agents
Runtime
Local model dependency used by the analysis pipeline
- Ollama Llama 3.2 · Local model runtime used by the analysis agents
Connections 22
- App → Auth: uses · App consumes session state
- App → Intel state: uses · App consumes current intelligence payload
- App → Dashboard: routes to · Authenticated analyst workspace
- App → Login: routes to · Unauthenticated entry screen
- Dashboard → Analysis cards: renders · Dashboard displays report sections and charts
- Intel state → Analysis cards: feeds · Context provides the structured report data
- Login → API: auth flow · Login initiates backend interaction
- API → News fetcher: update · Fetches search-driven news sources
- API → RSS fetcher: update · Fetches RSS sources
- News fetcher → Cleaner: preprocess · Raw articles are normalized
- RSS fetcher → Cleaner: preprocess · Raw feed items are normalized
- Cleaner → Chunker: prepare · Clean text is segmented for retrieval
- Chunker → Store manager: store · Chunks enter persistent corpus management
- Store manager → FAISS: vectorize · Embeddings stored for similarity search
- Store manager → SQLite: metadata · Hashes, source metadata, and deduplication stored
- SQLite → Cache: supports · Store-backed queries may be cached for reuse
- API → Crew runner: analyze · Analyze endpoint triggers the intelligence pipeline
- Crew runner → Agents: orchestrates · Pipeline coordinates specialized agent roles
- Crew runner → FAISS: retrieve · Pulls relevant evidence from the vector corpus
- Crew runner → Ollama Llama 3.2: reasoning · Agents invoke the local LLM runtime
- Agents → Ollama Llama 3.2: uses · Agent tasks rely on local model inference
- API → Store manager: clear/update · API controls persistence lifecycle