How riyan-ai-code/impact-iq works
Purpose and Entry Points
ImpactIQ evaluates GitHub pull requests for deployment risk, combining deterministic static analyzers, ML/risk scoring, and LLM-generated release guidance. The backend FastAPI application starts through backend/main.py and application assembly in backend/app/main.py. The user-facing Next.js application starts from frontend/app/page.tsx, with authenticated product navigation under frontend/app/dashboard/layout.tsx.
Web UI and Client Boundaries
The Next.js 15/React frontend provides dashboard surfaces for analysis, dependency, evidence, risk, reports, integrations, and graph exploration. API access is centralized through frontend/lib/api.ts and frontend/services/api.ts; auth and hosted-data integration are represented by frontend/lib/nhost.ts and frontend/services/nhostAuthService.ts. Dashboard pages are presentation/client boundaries rather than analysis implementations, e.g. frontend/app/dashboard/analysis/page.tsx, frontend/app/dashboard/knowledge-graph/page.tsx.
API, Authentication, and Request Control
FastAPI route modules expose domains including analysis, GitHub, repositories, reports, graph, integrations, and projects: backend/api/analysis.py, backend/api/github.py, backend/api/graph.py. Cross-cutting middleware handles JWT/auth context, webhook processing, CORS, errors, logging, and rate limiting, notably backend/middleware/auth_middleware.py, backend/middleware/github_webhook_middleware.py, and backend/middleware/rate_limit_middleware.py. Shared settings, database lifecycle, security, and dependency injection reside in backend/core/config.py, backend/core/database.py, and backend/core/security.py.
GitHub Intake and Analysis Pipeline
GitHub OAuth, repository/PR retrieval, contributor data, and webhook behavior are encapsulated in backend/services/github/oauth_service.py, backend/services/github/github_service.py, and backend/services/github/webhook_service.py. A pull-request event/diff enters the analysis service layer, where parsing and six analysis domains assess code/API changes, dependencies, security, Docker, and CI/CD: backend/services/analysis/diff_parser.py, backend/services/analysis/dependency_service.py, backend/services/analysis/security_service.py. This is the principal external boundary: GitHub-supplied events and source metadata are normalized before risk decisions.
Risk, Release, and AI Evidence
Analyzer findings feed correlation, conflict resolution, historical context, blast-radius/dependency traversal, and deterministic scoring: backend/services/analysis/correlation_engine.py, backend/services/analysis/risk_engine.py, backend/services/analysis/release_gate_service.py. AI summary generation and RAG evidence construction turn these results into explanations, testing guidance, and checklists via backend/services/analysis/ai_summary.py and backend/services/rag/evidence_builder.py. LangChain brokers Gemini or OpenAI GPT-4; model artifacts for impact-risk evaluation are checked in under backend/ml/model.py and backend/ml/weights/impact_risk_model.pt.
Persistence and Knowledge Graph
SQLAlchemy models and repository classes separate API/service behavior from persistence: backend/models/analysis.py, backend/models/repository.py, backend/repositories/analysis_repository.py. PostgreSQL/Supabase is the intended persistent store, with SQLite fallback locally. Core relational schema and RAG/embedding migrations are in database/schema.sql, database/migrations/001_phase2_rag.sql, and database/migrations/002_chunk_embeddings.sql. Knowledge-graph extraction and traversal support dependency/blast-radius queries through backend/services/graph/extractor.py and backend/services/graph/traversal_service.py.
Deployment Topology
Docker Compose runs frontend and backend locally/production, with Nginx as the production reverse-proxy boundary: docker-compose.yml, docker-compose.prod.yml, nginx/nginx.conf. The backend is containerized by backend/Dockerfile; frontend by frontend/Dockerfile. Deployment targets include Vercel for Next.js, Render, AWS App Runner, and ECS/EC2 via frontend/vercel.json, render.yaml, apprunner.yaml, and aws/cloudformation.yaml. GitHub Actions deployment workflows are in .github/workflows/deploy-aws.yml and .github/workflows/deploy-render.yml.
Components 18
Frontend
- Next.js dashboard · Authenticated analysis and graph product surfaces.
frontend/app/dashboard/layout.tsx - Client API layer
frontend/lib/api.ts - Nhost auth
frontend/lib/nhost.ts
Backend API
- FastAPI application
backend/app/main.py - Domain routes · Analysis, GitHub, graph, reports, and integrations APIs.
backend/api/analysis.py - Auth & request control · JWT context, webhooks, rate limits, and request policy.
backend/middleware/auth_middleware.py - GitHub · OAuth, pull requests, repository metadata, and webhooks.
- GitHub intake · Normalizes GitHub events, PRs, and repository data.
backend/services/github/github_service.py
Analysis Pipeline
- Diff & domain analyzers · Parses changes and evaluates dependency, security, Docker, and CI/CD impact.
backend/services/analysis/diff_parser.py - Correlation engine · Resolves conflicts and combines analysis evidence.
backend/services/analysis/correlation_engine.py - Risk & release gate · Scores risk using history and blast radius, then produces release decisions.
backend/services/analysis/risk_engine.py - AI evidence & guidance · Builds evidence and generates explanations, testing guidance, and checklists.
backend/services/analysis/ai_summary.py - Gemini / GPT-4
Data & Knowledge
- Knowledge graph · Extracts relationships and traverses dependencies for blast-radius queries.
backend/services/graph/traversal_service.py - Repositories & models · SQLAlchemy models and repositories isolate storage access.
backend/repositories/analysis_repository.py - PostgreSQL / Supabase · SQLite is used as a local fallback.
database/schema.sql
Deployment
- Compose & Nginx · Runs frontend and backend behind the production reverse proxy.
docker-compose.prod.yml - Cloud deployment · Vercel, Render, and AWS targets are deployed by GitHub Actions.
aws/cloudformation.yaml
Connections 23
- Next.js dashboard → Client API layer: uses
- Next.js dashboard → Nhost auth: authenticates
- Client API layer → FastAPI application: API requests
- Nhost auth → FastAPI application: JWT context
- FastAPI application → Auth & request control: applies
- Auth & request control → Domain routes: authorizes requests
- Domain routes → GitHub intake: GitHub operations
- GitHub → Auth & request control: webhooks
- GitHub intake → GitHub: OAuth and PR retrieval
- GitHub intake → Diff & domain analyzers: normalized PR diff
- Diff & domain analyzers → Correlation engine: findings
- Correlation engine → Risk & release gate: resolved evidence
- Knowledge graph → Risk & release gate: dependency blast radius
- Risk & release gate → AI evidence & guidance: risk decision
- AI evidence & guidance → Gemini / GPT-4: LLM generation
- AI evidence & guidance → Repositories & models: stores guidance
- Risk & release gate → Repositories & models: stores analyses
- Repositories & models → PostgreSQL / Supabase: SQLAlchemy
- PostgreSQL / Supabase → Knowledge graph: schema and embeddings
- Domain routes → Knowledge graph: graph queries
- Compose & Nginx → Next.js dashboard: serves frontend
- Compose & Nginx → FastAPI application: runs backend
- Cloud deployment → Compose & Nginx: deploys runtime