How meghanasaivattikuti/tech-demo works
This is a Next.js demo for looking up fictional public disciplinary records and proposing reviewed sanction changes. The main workflow presents cached records and lets a user enter a natural-language search; the search endpoint uses an AI model to extract filters, applies a deterministic minor-safety rule, queries the database, and returns results with a call trace. Separately, users propose sanction updates, which pause for review before an approved change is written. The README documents Vercel AI Gateway and Workflows integrations; unsampled implementation details are shown only where documented.
Main entry points: db.ts Database access · page.tsx Home page · actions.ts Server actions · route.ts Search endpoint
Components 19
Record lookup
- Home page
app/page.tsx - Search panel
components/search-panel.tsx - Records table
components/records-table.tsx
AI search
- Search endpoint
app/api/search/route.ts - Filter and safety rules
lib/pdd-search.ts - Search response types
lib/search-types.ts
Sanction review
- Pending reviews
components/pending-reviews.tsx - Update picker
components/simulate-update.tsx - Proposal form
components/simulate-update-form.tsx - Review form
components/pending-review-form.tsx - Simulation state
components/simulation-session.tsx - Server actions
app/actions.ts - Approval workflow
workflows/sanction-update.ts
Persistence
- Database access
lib/db.ts - Records and audit tables
db/schema.sql
External services
- SQL Server
- AI Gateway
- Vercel Workflows
Other components
- Database user
Connections 28
- Database user → Home page: opens
README.md - Home page → Database access: loads records
app/page.tsx - Home page → Records table: renders
app/page.tsx - Home page → Search panel: renders
app/page.tsx - Home page → Update picker: renders
app/page.tsx - Home page → Pending reviews: renders
app/page.tsx - Search panel → Search endpoint: posts query
components/search-panel.tsx - Search endpoint → AI Gateway: resolves filters
README.md - Search endpoint → Filter and safety rules: checks filters
app/api/search/route.ts - Search endpoint → Database access: queries records
app/api/search/route.ts - Search endpoint → Search response types: returns response
app/api/search/route.ts - Search panel → Records table: renders results
components/search-panel.tsx - Database access → Filter and safety rules: builds predicates
lib/db.ts - Database access → SQL Server: queries and writes
README.md - SQL Server → Records and audit tables: stores records
- Update picker → Database access: loads choices
components/simulate-update.tsx - Update picker → Proposal form: renders
- Proposal form → Server actions: proposes update
components/simulate-update-form.tsx - Proposal form → Simulation state: tracks simulation
components/simulate-update-form.tsx - Pending reviews → Server actions: loads pending entries
components/pending-reviews.tsx - Pending reviews → Review form: renders review
components/pending-reviews.tsx - Pending reviews → Simulation state: tracks status
components/pending-reviews.tsx - Review form → Server actions: submits decision
components/pending-review-form.tsx - Server actions → Database access: reads and updates
app/actions.ts - Server actions → Approval workflow: starts or resumes
app/actions.ts - Approval workflow → Database access: coordinates update
workflows/sanction-update.ts - Approval workflow → Vercel Workflows: runs durably
README.md - Server actions → Records and audit tables: writes on approval
README.md