How marianovilla/the-tribunal works
The Tribunal is a web app for submitting a case to a theatrical AI trial, viewing and sharing its verdict, and optionally appealing it. The main flow runs from case entry and tribunal selection through asynchronous trial creation and polling, then displays the verdict, arguments, and panel judgments. Gallery publishing, browsing, profiles, and Google sign-in support the surrounding experience. The README documents the four-stage LLM process and safety checks; sampled server excerpts establish routing and persistence, but not every internal pipeline call, so some subsystem links are omitted.
Main entry points: trials.ts Trial API · src/index.ts HTTP Server · pipeline/index.ts Trial Orchestrator · db/index.ts Database Access
Components 30
Trial Experience
- Case Entry
client/src/pages/HomePage.tsx - Trial View
client/src/pages/TrialPage.tsx - Trial Polling
client/src/hooks/useTrial.ts - Appeal Filing
client/src/components/AppealSelector.tsx - Verdict Card
client/src/components/VerdictCard.tsx - Share Export
client/src/components/ShareButtons.tsx - Gallery
client/src/pages/GalleryPage.tsx - User Profile
client/src/pages/ProfilePage.tsx - Client Routes
client/src/App.tsx
Application Services
- HTTP Server
server/src/index.ts - Trial API
server/src/routes/trials.ts - Gallery API
server/src/routes/gallery.ts - Tribunal API
server/src/routes/tribunals.ts - Auth API
server/src/routes/auth.ts - Profile API
server/src/routes/profile.ts
Trial Pipeline
- Trial Orchestrator
server/src/pipeline/index.ts - LLM Trial Steps
server/src/pipeline/steps.ts - Trial Prompts
server/src/pipeline/prompts.ts - Appeal Context
server/src/pipeline/appeal-context.ts - Safety Review
server/src/pipeline/safety.ts - Tribunal Definitions
server/src/tribunals.ts - LLM Adapter
server/src/pipeline/openrouter.ts
Identity and Storage
- Sign-in Context
client/src/auth/AuthContext.tsx - Session Auth
server/src/auth.ts - Trial and Account Data
server/src/db/schema.ts - Database Access
server/src/db/index.ts - Sample Trials
server/src/seedSamples.ts
Other components
- Visitor
- LLM Provider
- Google OAuth
Connections 34
- Visitor → Case Entry: submits case
README.md - Case Entry → Client Routes: enters app
client/src/App.tsx - Case Entry → Trial API: creates trial
- Trial API → Trial Orchestrator: starts processing
server/src/routes/trials.ts - Trial Orchestrator → LLM Trial Steps: runs stages
README.md - LLM Trial Steps → Trial Prompts: uses prompts
server/src/pipeline/steps.ts - LLM Trial Steps → LLM Adapter: requests completion
server/src/pipeline/steps.ts - LLM Adapter → LLM Provider: sends requests
README.md - Trial Orchestrator → Safety Review: checks submission
README.md - Trial Orchestrator → Appeal Context: builds appeal context
server/src/pipeline/index.ts - LLM Trial Steps → Tribunal Definitions: loads tribunal setup
server/src/pipeline/steps.ts - Appeal Filing → Trial API: files appeal
- Trial API → Tribunal API: gets tribunal choices
- Trial View → Trial Polling: polls status
client/src/pages/TrialPage.tsx - Trial View → Verdict Card: renders result
client/src/pages/TrialPage.tsx - Trial View → Share Export: offers sharing
client/src/pages/TrialPage.tsx - Share Export → Verdict Card: exports card
client/src/components/ShareButtons.tsx - Gallery → Gallery API: loads public trials
- Trial View → Trial API: publishes verdict
- User Profile → Profile API: loads profile
- HTTP Server → Trial API: mounts route
server/src/index.ts - HTTP Server → Gallery API: mounts route
server/src/index.ts - HTTP Server → Tribunal API: mounts route
server/src/index.ts - HTTP Server → Auth API: mounts route
server/src/index.ts - HTTP Server → Profile API: mounts route
server/src/index.ts - HTTP Server → Sample Trials: seeds samples
server/src/index.ts - Sign-in Context → Auth API: requests sign-in
- Auth API → Google OAuth: authenticates with
- Auth API → Session Auth: manages sessions
server/src/routes/auth.ts - Session Auth → Database Access: reads and writes
server/src/auth.ts - Trial Orchestrator → Database Access: stores trial progress
server/src/pipeline/index.ts - Trial API → Database Access: reads and writes trials
server/src/routes/trials.ts - Gallery API → Database Access: reads public trials
server/src/routes/gallery.ts - Database Access → Trial and Account Data: accesses schema
server/src/db/index.ts