🧭 DataPilot

AI-powered business intelligence — ask questions, get answers, take action.

DataPilot is a conversational BI assistant that connects to your live business data and answers questions in plain English. No SQL required. Just ask.


✨ What It Does

  • 💬 Chat with your data — "What's our MRR this month?" → instant answer with a table
  • 📊 Live queries — runs real SQL against your database, no stale snapshots
  • 🐙 GitHub intelligence — fetch PRs, issues, and commits in the same conversation
  • 🧠 Agentic reasoning — decides which tools to call, in which order, then explains the answer
  • 🔐 Secure by default — every user session is authenticated; data never leaves your stack

🏗️ Architecture

User → Auth0 (login) → DataPilot Chat UI
                              ↓
                       Agent Loop (TrueFoundry / GLM-5)
                       ┌──────────────────────────────┐
                       │  Tool: query_database         │ → TiDB Cloud MySQL
                       │  Tool: get_schema             │ → schema introspection
                       │  Tool: fetch_github_data      │ → Airbyte Agent Engine → GitHub
                       └──────────────────────────────┘
                              ↓
                       Aerospike (sessions + cache)
                              ↓
                       Streamed response → UI

🧩 Sponsor Integrations

Sponsor What We Use Why
Auth0 Authentication + session management Secure login with Google/social, user profiles stored in Aerospike
Airbyte Agent Engine Real-time GitHub connector Live PR/issue/commit data fetched on demand — no ETL pipeline needed
Aerospike In-memory session store + tool cache Sub-millisecond session reads, tool result caching across requests
TrueFoundry AI Gateway + model routing Routes all LLM calls through TrueFoundry to a self-hosted Featherless model
TiDB Cloud MySQL-compatible business database Scalable, serverless MySQL — the main data source for business analytics

🚀 Getting Started

Prerequisites

  • Node.js 18+
  • pnpm
  • Auth0 account
  • TrueFoundry account with a model configured
  • TiDB Cloud account (or any MySQL instance)

Setup

# Clone and install
git clone <repo>
cd datapilot
pnpm install

# Configure environment
cp .env.local.example .env.local
# Fill in your Auth0, TrueFoundry, TiDB Cloud, Airbyte credentials

# Run in development
pnpm dev

Open http://localhost:3001 — sign in and start asking questions.


💡 Example Questions

"How many active customers do we have?"
"Show me total revenue by product, sorted by MRR"
"Which customers haven't placed an order in the last 30 days?"
"What are the top 5 open support tickets?"
"Show me the open pull requests from our GitHub repo"
"How many issues were closed last week?"

🗄️ Data Model

DataPilot ships with a sample business database:

Table Description
customers Customer profiles with MRR, plan, churn status
products Product catalog with pricing
orders Order history linked to customers and products
support_tickets Support tickets with priority and status

🔧 Tech Stack

  • Frontend: Next.js 14 (App Router), Tailwind CSS
  • Auth: Auth0 (@auth0/nextjs-auth0)
  • AI Gateway: TrueFoundry → Featherless (GLM-5 / Qwen)
  • Database: TiDB Cloud MySQL (mysql2)
  • GitHub Data: Airbyte Agent Engine (api.airbyte.ai)
  • Session Store: Aerospike (with in-memory fallback for dev)
  • Language: TypeScript (strict mode)

🧪 Tests

pnpm test        # unit + integration tests
pnpm build       # production build check

📁 Project Structure

app/
  api/
    auth/         # Auth0 callback handlers
    chat/         # SSE streaming chat endpoint
    sessions/     # Session CRUD
    sources/      # Data source management
    health/       # Service health checks
  chat/           # Chat UI
lib/
  agent.ts        # AI agent loop with tool calling
  airbyte-agent.ts    # Airbyte Agent Engine client
  aerospike.ts    # Aerospike session/cache service
  auth0.ts        # Auth0 service wrapper
  truefoundry.ts  # TrueFoundry AI Gateway client
  mysql-source.ts # TiDB Cloud MySQL query engine
  config.ts       # Environment config with validation
__tests__/        # Vitest tests

Built With

Share this project:

Updates