Premium, first-party analytics platform with centralized ingestion, dedicated SDK, and a high-performance dashboard. Cookie-free, privacy-first, and self-hosted on Neon Postgres.
| Package | Purpose | Tech |
|---|---|---|
apps/example-dashboard |
Modern analytics UI with ⌘K command palette | Next.js 16.2, React 19, Recharts |
apps/ingestion |
High-throughput Hono ingestion service | Hono, Zod, Vercel Edge |
packages/sdk |
Client-side tracking library (@remcostoeten/analytics) | TypeScript, Fetch/Beacon API |
apps/ingestion/src/db |
Database schema and client | Neon Postgres, Drizzle ORM |
- Framework: Next.js 16.2 (Turbopack), React 19
- Database: Neon Postgres (Serverless)
- ORM: Drizzle
- Styling: Vanilla CSS, Lucide Icons
- Runtime: Bun
- Hosting: Vercel
The ingestion service is the core entry point for all tracking events.
# Clone and install
git clone https://github.com/remcostoeten/analytics.git
cd analytics
bun install
# Configure environment
cp .env.example .env
# Set DATABASE_URL and IP_HASH_SECRET (min 32 chars)
# Setup Database
cd apps/ingestion
bun run db:push
# Start Ingestion
cd ../../apps/ingestion
bun run devGET /health- Service health monitorPOST /ingest- Accepts event payloads (validated via Zod)- Bot detection (40+ patterns)
- Geo-extraction (headers)
- Secure IP hashing (no raw IP storage)
Create a project on Neon.tech and get your DATABASE_URL.
Both apps/example-dashboard and apps/ingestion are designed for Vercel deployment.
# Deploy Dashboard
cd apps/example-dashboard
vercel --prod
# Deploy Ingestion
cd apps/ingestion
vercel --prod| Variable | Description |
|---|---|
DATABASE_URL |
Neon Postgres connection string |
IP_HASH_SECRET |
Secret key for hashing visitor IP addresses |
bun add @remcostoeten/analyticsimport { Analytics } from '@remcostoeten/analytics'
export default function App() {
return (
<>
<Component />
<Analytics projectId="my-app" ingestUrl="https://analytics.yourdomain.com/api/ingest" />
</>
)
}MIT © Remco Stoeten
