Runlight for

Developers

Add analytics to your app with one route

Runlight is a package in your app’s language that keeps its numbers in your own database and serves its script, dashboard, API, and MCP server from your own domain.

Runlight installs like any other dependency and runs inside your app, so there is no account to create and your data never passes through a server of ours. It is free and open source under the MIT license.

One package, one route, your own database

Runlight runs in the app you already have, with the same dashboard and the same tables in every language.

A package in your app’s language

Runlight comes for TypeScript, PHP, Python, Ruby, Go, Rust, Elixir, Java, and .NET, from Next.js and Laravel to Django, Rails, Phoenix, Spring Boot, and ASP.NET Core. One route under /runlight serves the script, takes each visit, and serves the dashboard, and a script tag in your layout counts every page. Install has the line for each language.

Your own database

Runlight keeps its numbers in a handful of tables prefixed rl_, created on first use, in SQLite, Postgres, MySQL, or MariaDB. The TypeScript library also runs on Turso, Cloudflare D1, and Bun’s SQLite, and it can keep its visits in ClickHouse when you have many millions of them. Stores lists the options.

No third-party script

The script is under 2 KB gzipped, comes from your own domain, and posts back to it, so there is no outside domain to allow in your Content Security Policy, and ad blockers let more visits through. It sets no cookies, never stores an IP address or a user agent, and counts visitors with a daily hash whose salt is deleted after a day. Privacy has the details.

Count what your app does

Pageviews, single page app navigation, outbound links, and downloads count on their own, and anything else is one call.

Events from code or markup

Call runlight("Signup", { plan: "pro" }) from your code, or give an element data-runlight="Signup" and a click on it sends the event, with each data-runlight-* attribute as a property. data-manual hands pageviews to you, and data-before-send names a function that can scrub each payload before it leaves the browser. Tracking covers every setting.

AI agents, with one line of middleware

AI agents that fetch your pages run no JavaScript, so no tracker sees them. Pass each page request to rl.observe(request), and Runlight records the page fetches of known agents, checks each one’s address against the list its company publishes, and ignores everything else. It never throws, so you can leave it unawaited on every request. Agents that read your pages shows where it goes in each language.

Build on your numbers

Everything the dashboard shows is JSON you can fetch, and the same tokens connect AI assistants and the Mac app.

The HTTP API

The dashboard is built on the API at /runlight/api, so anything it shows you can fetch with a bearer token, as JSON, or as CSV for a breakdown. A read-only token can be limited to one site and never changes anything, and a manage token can also change one site’s goals, funnels, and short links. HTTP API lists every endpoint.

An MCP server beside the dashboard

/runlight/mcp is part of the same routes, so Claude, Cursor, or any other MCP client can ask about your stats with a read-only token or through OAuth. Its tools only ever read, whichever token they hold. Ask your AI has the setup for each client.

A prompt for your coding agent

The setup prompt at /prompt.txt walks a coding agent through the install, from the package and the route to the script tag and the hourly check, and points it to the page for your app’s language. It also tells the agent that every docs page can be read as Markdown.

Questions

Is it really open source?

Yes. Runlight is MIT licensed, with no paid plan, and its source is on GitHub. Every language passes the conformance tests the TypeScript library is held to, on SQLite, Postgres, MySQL, and MariaDB, and each language’s page lists the few ways it differs.

Does it run on serverless and edge hosts?

Yes. On a serverless host with no lasting disk, use Postgres or Turso rather than a SQLite file. Cloudflare Workers take D1, and the Edge runtime takes Turso over HTTP. The scheduled check runs from your host’s cron once an hour.

Can I keep it out of my app?

Yes. The standalone server runs the same code as an app of its own, with Docker or npx @runlight/server, and gives several sites one dashboard. Python, Ruby, Go, Java, .NET, and PHP have one of their own too.

More use cases

Install the package, mount the route, and watch your own visit arrive.