TL;DR
Tinybird is a real-time analytics platform built on ClickHouse. Ingest billions of events, query in milliseconds, and publish API endpoints — all from SQL. Free tier: 10 GB storage, unlimited queries.
What Is Tinybird?
Tinybird turns data into APIs:
- Real-time ingestion — millions of events per second
- Millisecond queries — ClickHouse engine under the hood
- SQL to API — write SQL, get a REST endpoint
- Materialized views — pre-compute aggregations
- Git-based workflows — version control your data pipes
- Free tier — 10 GB, unlimited reads
Quick Start
# Install CLI
pip install tinybird-cli
# Authenticate
tb auth --token YOUR_TOKEN
# Push data
tb datasource push events.csv --name events
Ingest Data
# HTTP Events API (real-time ingestion)
curl -X POST 'https://api.tinybird.co/v0/events?name=page_views' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-d '{"timestamp":"2024-01-15T10:30:00","page":"/home","user_id":"u123","country":"US"}'
// Node.js SDK
import { Tinybird } from "@chronark/zod-bird";
const tb = new Tinybird({ token: "YOUR_TOKEN" });
// Ingest events
await tb.publish({
datasource: "page_views",
data: [
{ timestamp: new Date(), page: "/home", user_id: "u123" },
{ timestamp: new Date(), page: "/about", user_id: "u456" },
],
});
Create API Endpoints (Pipes)
-- pipes/top_pages.pipe
-- This SQL becomes a REST API endpoint!
NODE top_pages
SQL >
SELECT
page,
count() as views,
uniq(user_id) as unique_users
FROM page_views
WHERE timestamp >= now() - interval {{period:String}}
GROUP BY page
ORDER BY views DESC
LIMIT {{limit:Int32}}
# Query the API
curl 'https://api.tinybird.co/v0/pipes/top_pages.json?period=7 day&limit=10' \
-H 'Authorization: Bearer YOUR_READ_TOKEN'
# Response:
# {"data": [{"page": "/home", "views": 15234, "unique_users": 8721}, ...]}
Real-Time Dashboard
// Frontend: query Tinybird API directly
async function fetchMetrics(period: string) {
const response = await fetch(
`https://api.tinybird.co/v0/pipes/dashboard_metrics.json?period=${period}`,
{ headers: { Authorization: `Bearer ${READ_TOKEN}` } }
);
return response.json();
}
// Real-time: poll every 5 seconds
setInterval(async () => {
const { data } = await fetchMetrics("1 hour");
updateDashboard(data);
}, 5000);
Materialized Views
-- Pre-compute hourly aggregations
NODE hourly_stats
SQL >
SELECT
toStartOfHour(timestamp) as hour,
page,
count() as views,
uniq(user_id) as users,
avg(load_time) as avg_load_time
FROM page_views
GROUP BY hour, page
TYPE materialized
DATASOURCE hourly_stats_mv
Tinybird vs Alternatives
| Feature | Tinybird | BigQuery | Elasticsearch | Mixpanel |
|---|---|---|---|---|
| Query latency | <100ms | Seconds | 100-500ms | Seconds |
| Free tier | 10 GB | 1 TB/mo queries | Self-host | 20M events |
| SQL to API | Built-in | Manual | No | No |
| Real-time ingest | Yes | Streaming insert | Yes | Yes |
| Engine | ClickHouse | Dremel | Lucene | Custom |
| Setup | Instant | Console | Complex | Instant |
Resources
- Tinybird Documentation
- GitHub Examples
- API Reference
- Pricing — free tier 10 GB
Analyzing scraped web data in real-time? My Apify tools extract data from any website — pipe it into Tinybird for instant analytics. Questions? Email spinov001@gmail.com
Top comments (0)