How const-ahmed/vat-liability-checker works
FindVAT is a UK VAT liability research app. A user submits a supply, the app streams a multi-stage evidence pipeline, and the user receives a VAT conclusion with HMRC paragraph citations or a clarifying question before another round. The graph preserves the documented classification, notice selection, retrieval, analysis and answer stages. The README documents the pipeline; sampled source confirms the client’s stream request, routing references and GOV.UK helper relationships, but not every internal model call or prompt detail.
Main entry points: route.ts Flow endpoint · page.tsx Flow controller · resolve.ts Notice retrieval · LoadingScreen.tsx Progress stream UI
Components 23
User experience
- Flow controller
app/page.tsx - VAT screens
components/vat - Progress stream UI
components/vat/LoadingScreen.tsx - Answer and citations
components/vat/AnswerScreen.tsx
VAT analysis pipeline
- Flow endpoint
app/api/flow/route.ts - Supply classification
app/api/flow/route.ts - Notice selection
app/api/flow/route.ts - Evidence analysis
app/api/flow/route.ts - Clarifier generation
app/api/flow/route.ts - Flow data schemas
lib/schemas/flow.ts
Evidence sources
- Notice retrieval
lib/govuk/resolve.ts - Notice index
lib/govuk/vatNoticesIndex.ts - GOV.UK client
lib/govuk/contentApi.ts
Identity and history
- Sign-in interface
components/ui/sign-in-modal.tsx - Auth client
lib/auth-client.ts - Auth endpoint
app/api/auth/[...all]/route.ts - Auth service
lib/auth.ts - PostgreSQL
- History drawer
components/ui/history-drawer.tsx - History endpoint
app/api/history/route.ts
Other components
- User
- GOV.UK Content API
- GPT-4o-mini
Connections 25
- User → Flow controller: submits supply
- Flow controller → VAT screens: renders
app/page.tsx - Flow controller → Progress stream UI: renders
app/page.tsx - Progress stream UI → Flow endpoint: streams request
components/vat/LoadingScreen.tsx - Flow endpoint → Supply classification: classifies supply
app/api/flow/route.ts - Flow endpoint → Notice selection: selects notices
app/api/flow/route.ts - Flow endpoint → Notice retrieval: resolves notices
app/api/flow/route.ts - Notice retrieval → Notice index: uses index
lib/govuk/resolve.ts - Notice retrieval → GOV.UK client: fetches content
lib/govuk/resolve.ts - Notice index → GOV.UK client: loads index data
lib/govuk/vatNoticesIndex.ts - GOV.UK client → GOV.UK Content API: requests content
- Flow endpoint → Evidence analysis: analyses evidence
app/api/flow/route.ts - Flow endpoint → GPT-4o-mini: prompts model
- Flow endpoint → Clarifier generation: may generate question
app/api/flow/route.ts - Flow endpoint → Flow data schemas: uses contracts
app/api/flow/route.ts - Flow endpoint → Progress stream UI: streams stages
- Flow controller → Answer and citations: renders conclusion
app/page.tsx - Flow controller → Sign-in interface: opens sign-in
app/page.tsx - Sign-in interface → Auth client: authenticates
components/ui/sign-in-modal.tsx - Auth client → Auth endpoint: uses auth service
- Auth endpoint → Auth service: dispatches to
app/api/auth/[...all]/route.ts - Auth service → PostgreSQL: stores identity
lib/auth.ts - Flow controller → History drawer: renders
app/page.tsx - History drawer → History endpoint: loads entries
components/ui/history-drawer.tsx - History endpoint → Auth service: checks session
app/api/history/route.ts