How thesysdev/openui-sales-dashboard works
Sales Dashboard turns a user’s sentence or chat request into a live, editable dashboard: the chat tools create or edit a dashboard definition, and the rendered dashboard queries sales data through the server interpreter. The app also provides dashboard history, follow-up suggestions, token-savings status, activity, and a connected-data browser. Relationships shown are documented in the README or visible in the supplied excerpts and source index; unsampled implementation details are not inferred.
Main entry points: app.tsx App runtime · db.ts SQL access and helpers · dashboard.tsx Dashboard panel · route.ts Chat endpoint
Components 27
User experience
- Request builder
src/components/home-sentence.tsx - App runtime
src/components/app.tsx - Chat thread
src/components/assistant-ui/elements/thread.aui.tsx - Dashboard panel
src/components/dashboard.tsx - Dashboard history
src/components/dashboard-sidebar.tsx - Chat associations
src/components/threads.tsx - Connected data browser
src/components/database-view.tsx - Status notch
src/components/notch.tsx
Dashboard generation
- Dashboard tools
src/lib/toolkit.tsx - Dashboard definition
src/lib/openui.ts
Sales data
- Sales query tools
src/lib/data/sales.ts - SQL access and helpers
src/lib/data/db.ts - Cache and query helpers
src/lib/data/fetch.ts
API services
- Chat endpoint
src/app/api/chat/route.ts - Follow-up suggestions
src/app/api/followups/route.ts - Activity endpoint
src/app/api/activity/route.ts - Database browsing API
src/app/api/db/route.ts - Database summary API
src/app/api/db/summary/route.ts - Dashboard interpreter
src/app/api/interpreter/route.ts - Token savings API
src/app/api/token-savings/route.ts - Frontend token API
src/app/api/frontend-token/route.ts
Visitor context
- Visitor identity
src/lib/visitor.ts - Activity recording
src/lib/data/activity.ts
Other components
- Browser user
- OpenUI Cloud
- Retail Postgres
- Chat and dashboard models
Connections 32
- Browser user → Request builder: enters request
- Request builder → App runtime: submits request
src/components/app.tsx - App runtime → Chat thread: hosts thread
src/components/app.tsx - Chat thread → Chat endpoint: sends messages
- Chat endpoint → Chat and dashboard models: streams completion
src/app/api/chat/route.ts - Chat endpoint → Dashboard tools: dispatches tools
src/app/api/chat/route.ts - Dashboard tools → Dashboard definition: creates or edits
src/lib/toolkit.tsx - Dashboard definition → OpenUI Cloud: defines dashboards
src/lib/openui.ts - Dashboard tools → Dashboard panel: renders tool card
src/lib/toolkit.tsx - Dashboard panel → OpenUI Cloud: streams artifact
- OpenUI Cloud → Dashboard interpreter: requests queries
- Dashboard interpreter → Sales query tools: runs sales tools
- Sales query tools → SQL access and helpers: queries data
src/lib/data/sales.ts - SQL access and helpers → Cache and query helpers: uses helpers
src/lib/data/db.ts - SQL access and helpers → Retail Postgres: executes SQL
src/lib/data/db.ts - App runtime → Dashboard history: shows dashboard rail
src/components/app.tsx - Dashboard history → Dashboard panel: opens dashboard
src/components/dashboard-sidebar.tsx - Dashboard panel → Chat associations: remembers chat
src/components/dashboard.tsx - App runtime → Connected data browser: opens data browser
src/components/app.tsx - Connected data browser → Database summary API: loads overview
src/components/database-view.tsx - Connected data browser → Database browsing API: loads table rows
src/components/database-view.tsx - Database browsing API → SQL access and helpers: reads database
src/app/api/db/route.ts - Database summary API → SQL access and helpers: reads summary data
src/app/api/db/summary/route.ts - Chat thread → Follow-up suggestions: requests suggestions
- App runtime → Frontend token API: gets cloud token
src/components/app.tsx - Dashboard panel → Token savings API: measures savings
src/components/dashboard.tsx - App runtime → Status notch: shows work state
src/components/app.tsx - Activity endpoint → Activity recording: reads events
src/app/api/activity/route.ts - SQL access and helpers → Activity recording: records queries
src/lib/data/db.ts - Chat endpoint → Visitor identity: reads visitor
src/app/api/chat/route.ts - Dashboard definition → Visitor identity: scopes dashboards
src/lib/openui.ts - Database browsing API → Visitor identity: checks visitor
src/app/api/db/route.ts