How css-enjoyer/prism-backend works
Prism receives GitHub pull-request webhooks, verifies them, and schedules in-process review work. The worker fetches the diff, obtains structured feedback from an LLM, persists the analysis, and posts a formatted PR comment; separate authenticated endpoints expose stored analyses. The README documents the major integrations and workflow; the sampled sources show webhook dispatch, review processing, persistence, and retrieval implementation. The database and external services are represented at the integration level.
Main entry points: services/analysis.py Review orchestration · routers/analysis.py Analysis endpoints · webhook.py Webhook verification · session.py Async DB sessions
Components 16
API entry
- FastAPI app
app/main.py - Webhook verification
app/routers/webhook.py
Review processing
- Review orchestration
app/services/analysis.py - Diff retrieval
app/services/analysis.py - LLM review
app/services/analysis.py - Comment formatting
app/services/analysis.py - GitHub API
- OpenRouter LLM
Persistence
- Async DB sessions
app/db/session.py - Analysis model
app/models/analysis.py - PostgreSQL
Analysis retrieval
- Analysis endpoints
app/routers/analysis.py - API-key auth
app/dependencies.py - Analysis response
app/schemas/analysis.py
Other components
- GitHub
- API consumer
Connections 19
- GitHub → Webhook verification: sends webhook
README.md - FastAPI app → Webhook verification: registers route
app/main.py - FastAPI app → Analysis endpoints: registers route
app/main.py - Webhook verification → Review orchestration: queues task
app/routers/webhook.py - Review orchestration → Diff retrieval: calls
app/services/analysis.py - Diff retrieval → GitHub API: fetches diff
README.md - Review orchestration → LLM review: calls
app/services/analysis.py - LLM review → OpenRouter LLM: requests review
app/services/analysis.py - Review orchestration → Async DB sessions: opens sessions
app/services/analysis.py - Review orchestration → Analysis model: reads and writes
app/services/analysis.py - Async DB sessions → PostgreSQL: connects
app/db/session.py - Review orchestration → Comment formatting: formats feedback
app/services/analysis.py - Review orchestration → GitHub API: posts comment
app/services/analysis.py - API consumer → Analysis endpoints: requests analyses
README.md - Analysis endpoints → API-key auth: requires key
app/routers/analysis.py - Analysis endpoints → Async DB sessions: gets DB session
app/routers/analysis.py - Analysis endpoints → Analysis model: queries analyses
app/routers/analysis.py - Analysis endpoints → Analysis response: serializes response
app/routers/analysis.py - Analysis response → Analysis model: maps model fields
app/schemas/analysis.py