Data Query Tool
What Needed Solving
Three senior managers (the MD, Commercial Director, and myself) needed loan performance answers without knowing SQL or waiting for someone to run a report. The question might be “what’s the approval rate by lender this month?” or “how does February compare to last year?” and the answer would take hours, sometimes days, because it meant someone querying Salesforce, formatting the results, and sending them over.
The BI tools on the market cost £500+ per month and required training nobody had time for. We needed something that understood our specific data model and business terminology, not a generic dashboarding platform.
Technical Decisions
I chose Turso (SQLite at the edge) over Supabase or Postgres because the query patterns are simple reads and aggregations. No joins across large tables, no concurrent write pressure. Turso’s free tier handles the volume with zero cost.
Claude Sonnet generates the SQL, but the system prompt is where the real work went. It includes the exact table schema, column mappings from Salesforce field names to human-readable labels, metric definitions (approval rate = approved divided by submitted, not approved divided by total decisions), and common business terminology. The system prompt is the product. The LLM is the execution layer.
I chose monthly batch data refresh from Salesforce XLS exports rather than a live API connection. The data changes daily, but the questions are about trends and totals. Real-time sync would have added authentication complexity, rate limits, and SOQL governor limits for no real user benefit. NextAuth.js with a simple allowlist of 3 users rather than full role-based access control, because the tool is for 3 people. Over-engineering the auth would have delayed launch by weeks.
How It Works
Users type a question in plain English. Claude translates it to SQL using the constrained system prompt, which includes table schemas, column mappings, metric definitions, and common terminology like “pipeline” (signed but not yet paid) and “rescue rate” (applications declined by one lender but approved by another in the waterfall). The query runs against a Turso SQLite database. Claude then formats the results into a natural language response with tables where the data calls for it.
Monthly data refreshes happen via Excel export from Salesforce, parsed and loaded into Turso. The database holds roughly 190,000 application decision rows per year, covering every lender decision in the waterfall sequence.
What It Changed
Questions that took hours now take seconds. All three users query it multiple times a week without any training. The total infrastructure cost is under £15 per month: Vercel free tier, Turso free tier, Claude API on pay-per-use. That compares to £500+ per month for the cheapest BI platform we evaluated, which would still have required someone to build the dashboards and maintain them.
Try It
This demo uses pre-scripted responses to show the conversational interface. The live tool connects to a real database and generates responses via Claude.