Open-source analytics you can integrate into your product.
Give your users a beautiful analytics dashboard in 5 minutes.
Live Demo • Quick Start • Packages • Deploy • Docs • Issues
AI Agent Skill: npx skills add metehankurucu/litemetrics
Gives your AI coding agent (Claude Code, Cursor, Windsurf) full knowledge of Litemetrics integration patterns.
| Embed into your product | Drop a full analytics stack into your app — tracker, server, query API, and a pre-built dashboard UI. Your customers get analytics without you building anything. |
| Your brand, your colors | 10 built-in theme presets. CSS custom properties for full control. Dark mode included. Ship analytics that look like they belong in your app. |
| Multi-tenant ready | Each customer gets isolated analytics via site_id. One database, zero cross-contamination. Built for SaaS from day one. |
| Lightweight tracker | ~3 KB gzipped. Auto-tracks pageviews, sessions, scroll depth, button clicks, outbound links — or go fully manual. |
| ClickHouse & MongoDB | Choose the database that fits. ClickHouse for speed at scale, MongoDB for simplicity. Swap with one env var. |
| One-click deploy | Docker Compose, Railway, or a single Docker container. Up and running in under a minute. |
npm install @litemetrics/uiimport { LitemetricsProvider, AnalyticsDashboard } from '@litemetrics/ui';
function CustomerDashboard({ customerId }) {
return (
<LitemetricsProvider baseUrl="/api/stats" siteId={customerId}>
<AnalyticsDashboard theme="midnight" />
</LitemetricsProvider>
);
}<script src="https://your-server.com/litemetrics.js"></script>
<script>
Litemetrics.createTracker({
siteId: 'your-site-id',
endpoint: 'https://your-server.com/api/collect'
});
</script>npm install @litemetrics/nodeimport express from 'express';
import { createCollector } from '@litemetrics/node';
const app = express();
app.use(express.json());
const collector = await createCollector({
db: { url: 'http://localhost:8123' },
});
app.all('/api/collect', (req, res) => collector.handler()(req, res));
app.all('/api/stats', (req, res) => collector.queryHandler()(req, res));
app.listen(3002);For MongoDB:
db: { adapter: 'mongodb', url: 'mongodb://localhost:27017/myapp' }
cd apps/mobile
bun install
bun run startFor platform-specific launches:
bun run ios
bun run androidbun add -g @litemetrics/cli# Configure once
export LITEMETRICS_URL=https://your-server.com
export LITEMETRICS_ADMIN_SECRET=your-secret
export LITEMETRICS_SITE_ID=your-site-id
# Overview of all metrics
litemetrics overview -p 7d --compare
# Top pages
litemetrics stats top_pages -p 30d -l 10
# Time series
litemetrics timeseries visitors -p 30d -g day
# JSON output for AI agents
litemetrics overview -p 7d -f jsonSee packages/cli/README.md for all commands.
git clone https://github.com/metehankurucu/litemetrics.git
cd litemetrics
ADMIN_SECRET=your-secret docker compose up -dOpen http://localhost:3002 for the dashboard.
docker build -t litemetrics .
docker run -p 3002:3002 \
-e CLICKHOUSE_URL=http://your-clickhouse:8123 \
-e ADMIN_SECRET=your-secret \
litemetrics- Click the Deploy on Railway button above
- Add a ClickHouse plugin (or MongoDB)
- Set
CLICKHOUSE_URL(orMONGODB_URL) andADMIN_SECRET - Done — dashboard, API, and tracker served from one container
| Variable | Description | Default |
|---|---|---|
DB_ADAPTER |
Database adapter (clickhouse or mongodb) |
clickhouse |
CLICKHOUSE_URL |
ClickHouse connection URL | http://localhost:8123 |
MONGODB_URL |
MongoDB connection string | mongodb://localhost:27017/litemetrics |
ADMIN_SECRET |
Secret for admin access and site management | (none) |
PORT |
Server port | 3002 |
GEOIP |
Enable GeoIP lookup | true |
TRUST_PROXY |
Trust X-Forwarded-For headers | true |
DATABASE_URLandLITEMETRICS_ADMIN_SECRETalso work as aliases.
┌──────────────────┐ ┌──────────────────┐ ┌──────────────────┐
│ │ POST │ │ GET │ │
│ @litemetrics/ │ /collect│ @litemetrics/ │ /stats │ @litemetrics/ │
│ tracker ├────────>│ node │<────────┤ dashboard │
│ │ │ (collector) │ │ │
│ ~3KB, browser │ events │ ClickHouse / │ queries │ React UI │
│ │ │ MongoDB │ │ │
└──────────────────┘ └──────────────────┘ └──────────────────┘
Browser / App Your Server ▲ Dashboard
│
┌────┴─────────────┐
│ @litemetrics/ │
│ cli │
│ Terminal / AI │
└──────────────────┘
The tracker handles session management, visitor IDs, batching, and SPA detection client-side. The server stores events and runs queries. The CLI provides terminal access to all analytics data — designed for both humans and AI agents. The Docker image bundles everything into a single container.
| Package | Description |
|---|---|
@litemetrics/ui |
Pre-built React dashboard components (10 themes, dark mode, CSS variables) |
@litemetrics/tracker |
Browser tracker (~3 KB gzipped) |
@litemetrics/node |
Server collector, ClickHouse/MongoDB adapters, query API |
@litemetrics/react |
React provider and hooks |
@litemetrics/react-native |
React Native / Expo provider |
@litemetrics/client |
Typed client for reading analytics data |
@litemetrics/cli |
CLI tool for querying analytics and managing sites |
@litemetrics/core |
Shared types and constants |
| App | Description |
|---|---|
@litemetrics/dashboard |
Analytics dashboard (React + Vite + Tailwind) |
@litemetrics/server |
Self-hosted server (serves dashboard + API) |
@litemetrics/mobile |
Native mobile analytics app (Expo Router + React Native) |
@litemetrics/landing |
Landing page (React + Vite + Tailwind) |
pageviews · visitors · sessions · events · conversions · top_pages · top_referrers · top_countries · top_cities · top_events · top_conversions · top_exit_pages · top_transitions · top_scroll_pages · top_button_clicks · top_link_targets · top_devices · top_browsers · top_os · top_os_versions · top_device_models · top_app_versions · top_utm_sources · top_utm_mediums · top_utm_campaigns · top_utm_terms · top_utm_contents · top_channels · timeseries · retention
- Auto events are tagged with
event_source=autoand a subtype (scroll_depth,button_click,link_click,outbound_click). - Manual
track()events default toevent_source=manualandevent_subtype=custom. - All metrics and time series support segmentation filters (geo, device, UTM, referrer, event metadata).
- The dashboard Insights view surfaces exit pages, transitions, scroll-heavy pages, and click hotspots.
- Getting Started
- Integration Guide — React, React Native, Next.js, Vue, Python, PHP, Ruby, Go
- API Reference
- Dashboard
- CLI
- Mobile App
- Self-Hosting
- Scaling
git clone https://github.com/metehankurucu/litemetrics.git
cd litemetrics
bun install
bun run buildMIT

