How sahil-2005/amivre works
Purpose and entry points
AMIVRE is an asynchronous market-intelligence system that turns a submitted venture idea into an evidence-grounded risk and competitor report. The interactive entry point is the Next.js App Router UI; its API boundary is FastAPI, which delegates long-running analysis to Celery.
• frontend/src/app/(dashboard)/new-analysis/page.tsx
• backend/app/main.py
• backend/app/api/routes/analysis.py
Frontend application
The Next.js 14 frontend provides authentication, dashboard/history, analysis submission, and a job-specific report view. It calls the backend through a typed client and uses a WebSocket hook to render live agent progress; report tabs map to each specialist’s result.
• frontend/src/lib/api-client.ts
• frontend/src/hooks/use-websocket-progress.ts
• frontend/src/app/(dashboard)/analysis/[jobId]/page.tsx
API, identity, and persistence boundary
FastAPI exposes versioned analysis, authentication, health, and WebSocket endpoints. SQLAlchemy models represent users and durable analysis-job state/results; Alembic owns schema evolution. This layer should remain request-oriented: creation/status access at the API edge, execution in workers.
• backend/app/api/routes/auth.py
• backend/app/api/websocket.py
• backend/app/models/analysis_job.py
Asynchronous execution and infrastructure
Analysis requests enqueue Celery work rather than executing scraping/LLM calls in the API process. Redis is the Celery broker; PostgreSQL persists application data. Docker Compose provisions backend, worker, PostgreSQL, Redis, and Qdrant; Qdrant is reserved for future RAG-oriented capability.
• backend/app/worker/celery_app.py
• docker/docker-compose.yml
• docker/Dockerfile.celery
Orchestration graph and state
A LangGraph workflow coordinates the analysis lifecycle. The master-query stage first produces focused research queries, then specialized research agents operate, and the risk modeller synthesizes their outputs into the final venture risk score and mitigations. Shared graph state is the key contract between stages.
• backend/app/orchestrator/graph.py
• backend/app/orchestrator/state.py
• backend/app/agents/master_query_node.py
Specialized AI agents
Five focused agents implement market sizing, sentiment, competitor mapping, trend forecasting, and final risk synthesis. Prompt templates are externalized per research persona, enabling behavior changes without changing orchestration code. Gemini Pro 1.5 Flash is the LLM runtime.
• backend/app/agents/market_scout.py
• backend/app/agents/sentiment_analyst.py
• backend/app/agents/risk_modeller.py
Research and external-service boundary
Agents obtain live evidence through the research pipeline: Tavily provides search, while Crawl4AI/headless Chromium renders and extracts web content. Sources include Wikipedia, Hacker News, Reddit, Google Play, and Google Trends. Extracted Markdown is truncated before Gemini prompt injection, creating an explicit scrape-to-LLM size/safety boundary.
• backend/app/scrapers/research_pipeline.py
• backend/app/scrapers/scraper_runner.py
• backend/app/config.py>
Main entry points: research_pipeline.py Evidence pipeline · analysis.py Analysis routes · analysis_job.py Analysis job state · main.py FastAPI service
Components 22
Next.js frontend
- New analysis UI · Submits venture ideas.
frontend/src/app/(dashboard)/new-analysis/page.tsx - Live report view · Renders specialist report tabs and progress.
frontend/src/app/(dashboard)/analysis/[jobId]/page.tsx - Typed API client
frontend/src/lib/api-client.ts - WebSocket progress hook
frontend/src/hooks/use-websocket-progress.ts
API and data
- FastAPI service · Serves versioned analysis, auth, health, and WebSocket endpoints.
backend/app/main.py - Analysis routes · Creates and retrieves analysis jobs.
backend/app/api/routes/analysis.py - Auth routes
backend/app/api/routes/auth.py - Progress WebSocket
backend/app/api/websocket.py - Analysis job state · Durable job status and results contract.
backend/app/models/analysis_job.py - PostgreSQL · Persists users and analysis jobs.
docker/docker-compose.yml
Async analysis
- Celery worker · Executes long-running analysis outside the API process.
backend/app/worker/celery_app.py - Redis broker
docker/docker-compose.yml - Analysis workflow · Coordinates the analysis lifecycle through shared state.
backend/app/orchestrator/graph.py - Shared graph state · Carries queries, research outputs, and synthesis between stages.
backend/app/orchestrator/state.py - Master query stage · Generates focused research queries.
backend/app/agents/master_query_node.py - Research specialists · Market sizing, sentiment, competitor mapping, and trend forecasting.
backend/app/agents/market_scout.py - Risk synthesis · Produces risk score and mitigations from specialist outputs.
backend/app/agents/risk_modeller.py
Research services
- Evidence pipeline · Searches, renders, extracts, and truncates evidence before prompting.
backend/app/scrapers/research_pipeline.py - Web extraction
backend/app/scrapers/scraper_runner.py - Search and web sources · Tavily search plus public web sources.
- Gemini 1.5 Flash
- Qdrant · Reserved for future RAG capability.
docker/docker-compose.yml
Connections 24
- New analysis UI → Typed API client: submit idea
- Typed API client → Analysis routes: HTTP
- Live report view → Typed API client: job and report
- Live report view → WebSocket progress hook: live status
- WebSocket progress hook → Progress WebSocket: WebSocket
- FastAPI service → Analysis routes: serves
- FastAPI service → Auth routes: serves
- FastAPI service → Progress WebSocket: serves
- Analysis routes → Analysis job state: create/read jobs
- Analysis job state → PostgreSQL: persist
- Analysis routes → Redis broker: enqueue
- Celery worker → Redis broker: consume tasks
- Celery worker → Analysis workflow: run workflow
- Analysis workflow → Shared graph state: reads/writes
- Analysis workflow → Master query stage: first stage
- Master query stage → Research specialists: focused queries
- Research specialists → Evidence pipeline: gather evidence
- Evidence pipeline → Search and web sources: search and fetch
- Evidence pipeline → Web extraction: render/extract
- Evidence pipeline → Gemini 1.5 Flash: truncated Markdown
- Research specialists → Risk synthesis: research outputs
- Risk synthesis → Gemini 1.5 Flash: synthesize
- Risk synthesis → Analysis job state: final report
- Celery worker → Analysis job state: update progress