Ezlytics is open-source, self-hostable analytics focused on traffic-to-revenue attribution.
- Revenue-first analytics (not just pageviews)
- Fast client script (
/js/script.js) - Public ingest endpoint (
/api/v1/ingest) with validation + limits - Built-in first-party tracking path support (
/js/script.js+/p) - Monorepo with Next.js, tRPC, Drizzle, PostgreSQL
- Next.js App Router (
apps/web) - TypeScript + Bun + Turborepo
- Drizzle ORM + PostgreSQL
- Better Auth
- Install deps:
bun install- Configure env:
cp apps/web/.env.example apps/web/.env- Push schema:
bun run db:push- Run dev:
bun run devApp runs at http://localhost:3001.
Use this on tracked sites:
<script
defer
data-website-id="dfid_xxx"
data-domain="example.com"
data-api-key="key_xxx"
src="https://your-analytics-domain.com/js/script.js"
></script>Default event endpoint resolves to /p on the same origin as the script.
Privacy-heavy browsers can block third-party analytics. Best practice is to serve script + ingest on the tracked site's own domain.
Example:
- Script URL:
https://www.client-site.com/js/script.js - Ingest URL:
https://www.client-site.com/p
In this repo:
apps/web/src/app/js/script.js/route.tsserves the client script.- Next.js rewrite maps
/p->/api/v1/ingestinapps/web/next.config.ts.
apps/web # Next.js app (dashboard + APIs + marketing)
packages/api # tRPC + server logic
packages/auth # auth wiring
packages/db # schema + DB tooling
packages/env # env validation
docs # specs + architecture + roadmap
bun run check-types
bun run lint
bun testLaunch roadmap: docs/launch-roadmap.md
PRs welcome. For larger changes, open an issue first with scope and rollout plan.
MIT. See LICENSE.