This guide will help you set up Evidence with Flight SQL HTTP datasource for live dashboard development.
- Node.js 18+ installed
- Your Flight SQL HTTP middleware running (default: http://localhost:8080/api/sql)
- VSCode (recommended for development)
# Install root dependencies
pnpm install
# Install example project dependencies
cd sites/example-project
npm installCreate .env file in project root:
cp .env.example .envEdit .env and set your Flight SQL endpoint:
FLIGHT_SQL_ENDPOINT=http://localhost:8080/api/sqlOption A: Mock Mode (No Flight SQL server required)
./start-mock.shOption B: Real Flight SQL server
./start-dev.shOption C: Manual startup (Mock Mode)
cd sites/example-project
FLIGHT_SQL_MOCK=true npm run devOption D: Manual startup (Real Mode)
cd sites/example-project
FLIGHT_SQL_ENDPOINT=http://localhost:8080/api/sql npm run devOption E: Using VSCode
- Open project in VSCode
- Press F5 or go to Run & Debug
- Select one of:
- "Evidence Dev Server (Mock Mode)" - Uses mock data, no server needed
- "Evidence Dev Server (Flight SQL)" - Connects to localhost:8080
- "Evidence Dev Server (Custom Endpoint)" - Prompts for endpoint
- Click the green play button
- Development Server: http://localhost:3000
- Mock Test Dashboard: http://localhost:3000/mock-test (works without Flight SQL server)
- Real Test Dashboard: http://localhost:3000/flight-sql-test (requires Flight SQL server)
Two VSCode debug configurations are available:
- Evidence Dev Server (Flight SQL) - Uses localhost:8080 endpoint
- Evidence Dev Server (Custom Endpoint) - Prompts for custom endpoint URL
When running in debug mode, you'll see helpful logs:
Real Mode:
[Flight SQL] Initializing datasource with endpoint: http://localhost:8080/api/sql
[Flight SQL] Testing connection to http://localhost:8080/api/sql
[Flight SQL] Connection test successful
[Evidence] Server ready on http://localhost:3000
# On page load:
[Flight SQL] Executing query: SELECT 1 as id, 'Hello Flight SQL' as message...
[Flight SQL] Query completed in 8ms, 1 rows
Mock Mode:
[Flight SQL MOCK] Initializing datasource with endpoint: mock
[Flight SQL MOCK] Testing connection to mock
[Flight SQL MOCK] Connection test successful
[Evidence] Server ready on http://localhost:3000
# On page load:
[Flight SQL MOCK] Executing query: SELECT 1 as id, 'Hello Flight SQL' as message...
[Flight SQL MOCK] Query completed in 12ms, 1 rows (mock data)
You can set breakpoints in:
- Flight SQL datasource:
packages/datasources/flight-sql-http/index.cjs - Query processing:
packages/lib/preprocess/src/ - Component rendering:
packages/ui/core-components/src/
Your Flight SQL middleware should accept POST requests:
POST /api/sql
Content-Type: application/json
{
"sql": "SELECT * FROM table WHERE condition = 'value'",
"timeout": 30000
}{
"data": [
{"id": 1, "name": "John", "created_at": "2024-01-01T10:00:00Z"},
{"id": 2, "name": "Jane", "created_at": "2024-01-02T11:00:00Z"}
],
"columns": [
{"name": "id", "type": "INTEGER"},
{"name": "name", "type": "VARCHAR"},
{"name": "created_at", "type": "TIMESTAMP"}
],
"rowCount": 2
}{
"error": "SQL syntax error: unexpected token 'SELCT'"
}# My Dashboard
```sql my_query
SELECT
product_name,
SUM(sales) as total_sales
FROM sales_table
GROUP BY product_name
ORDER BY total_sales DESCSELECT * FROM orders WHERE order_date >= '2024-01-01'SELECT
COUNT(*) as total_orders,
SUM(amount) as total_revenue
FROM (${base_data})Total Orders: {summary[0].total_orders}
Total Revenue: ${summary[0].total_revenue}
SELECT DISTINCT product_name FROM products ORDER BY product_nameSELECT * FROM sales
WHERE product_name = '${inputs.product.value}'- Markdown file changes trigger automatic page reload
- SQL query changes trigger automatic re-execution
- Component changes use hot module replacement
- SQL errors display in the Evidence UI
- Network errors show in both console and UI
- Connection errors are logged to console
- Queries execute in ~10ms with your optimized backend
- Total dashboard load time: 15-25ms
- No caching needed initially (can add later if needed)
Problem: Cannot connect to Flight SQL endpoint
[Flight SQL] Connection test failed: Error: ECONNREFUSED
Solutions:
- Verify Flight SQL server is running
- Check endpoint URL in configuration
- Verify network connectivity
Problem: SQL syntax errors in queries
[Flight SQL] Query failed: SQL syntax error: unexpected token
Solutions:
- Check SQL syntax in your .sql files or markdown
- Verify table/column names exist in your data
- Use Flight SQL-compatible SQL dialect
If using authentication, ensure headers are passed correctly:
# sources/flight_sql/connection.yaml
options:
endpoint: http://localhost:8080/api/sql
auth: "Bearer ${AUTH_TOKEN}"After Phase 1 is working:
- Phase 2: Add Monaco editor for dashboard authoring
- Deployment: Package as Docker container for production
- Scaling: Add caching and load balancing if needed
Support: For issues, check console logs and verify Flight SQL endpoint is responding correctly.