Start
Getting started
Runlight is web analytics that installs into your app. It takes five minutes to get from npm install to your first visit.
Runlight runs inside an app you already have, as a server of its own, or as a plugin in WordPress, Drupal, or Craft CMS. It keeps its numbers in your own database and serves its dashboard from your own domain, so there is no Runlight account to create and your data never passes through a server of ours.
Choose how to run it
Pick the way that fits, copy its line, and follow its guide.
In your app
Runlight runs inside the app that serves your pages, from one route, and keeps its numbers in that app’s database.
npm install @runlight/sdk better-sqlite3
Then create the instance, mount the routes, and add the script, as the steps below show for Next.js. Install has the lines for every other framework.
Read the guidepnpm add @runlight/sdk better-sqlite3
Then create the instance, mount the routes, and add the script, as the steps below show for Next.js. Install has the lines for every other framework.
Read the guideyarn add @runlight/sdk better-sqlite3
Then create the instance, mount the routes, and add the script, as the steps below show for Next.js. Install has the lines for every other framework.
Read the guidebun add @runlight/sdk
Bun uses its own SQLite through @runlight/sdk/bun, as Install shows.
composer require runlight/runlight
Laravel, Symfony, and plain PHP apps on PHP 8.2 or later each take a few lines, which the PHP docs show.
Read the guidepip install runlight
Django, Flask, FastAPI, and any other WSGI or ASGI app on Python 3.11 or later take a few lines each, which the Python docs show.
Read the guidebundle add runlight
A Rails app then runs bin/rails generate runlight:install, as the Rails docs show. Sinatra, Hanami, Roda, and other Rack apps on Ruby 3.2 or later add a database driver such as sqlite3, as the Ruby docs show.
go get runlight.sh/go modernc.org/sqlite
Any net/http app, chi, or Echo on Go 1.25 or later takes a few lines, and Postgres, MySQL, or MariaDB can stand in for SQLite, as the Go docs show.
implementation("sh.runlight:runlight:0.6.2")
That line is for Gradle, and Maven takes the same coordinates. It serves Runlight from the JDK’s own server on Java 21 or later, and servlet containers and Spring Boot each add an artifact of their own, as the Java docs show.
Read the guidedotnet add package Runlight.AspNetCore
An ASP.NET Core app on .NET 10 or later adds a driver such as Microsoft.Data.Sqlite and calls app.MapRunlight(), as the .NET docs show.
{:runlight, "~> 0.6"}
Add that line to the deps in mix.exs. A Phoenix or Plug app on Elixir 1.18 or later keeps Runlight’s tables in its own Ecto repo, as the Elixir docs show.
cargo add runlight runlight-sqlx --features runlight/axum,runlight-sqlx/sqlite
Runlight runs on tokio behind axum, hyper, or any server that takes a tower service, as the Rust docs show.
Read the guideIts own server
One process with a dashboard of its own, for several sites at once, or for a site that cannot run Runlight itself, such as a Webflow site.
docker run -d --name runlight -p 3000:3000 -v runlight:/data ghcr.io/runlightsh/runlight
It listens on port 3000 and prints a link that makes your account, as Standalone server shows.
Read the guidenpx @runlight/server
It listens on port 3000 and prints a link that makes your account, as Standalone server shows.
Read the guidecomposer require runlight/runlight && cp -r vendor/runlight/runlight/standalone public
Run it in a new folder beside your web root, point a domain at public, and add one cron line, as the PHP docs show. It needs nothing but PHP.
pip install runlight && runlight
The runlight command starts the server on port 3000 and prints a link to make your account, as the Python docs show.
bundle add runlight sqlite3 puma rackup && bundle exec runlight serve
Run it in a new folder after bundle init, as the Ruby docs show.
go install runlight.sh/go/cmd/runlight@latest
Then run runlight, which starts the server on port 3000, as the Go docs show.
java -cp "*" sh.runlight.server.Cli
Download the runlight jar and your database’s JDBC driver from Maven Central into an empty folder first, as the Java docs show.
dotnet tool install --global Runlight.Server
Then run runlight serve in an empty folder, as the .NET docs show.
A CMS plugin
A plugin runs Runlight inside WordPress, Drupal, or Craft CMS, or sends the site’s visits to a Runlight you run elsewhere.
wp plugin install runlight --activate
Or install it from WordPress.org under Plugins, Add New Plugin in WordPress.
Read the guidecomposer require drupal/runlight
Composer brings the Runlight library the module needs to run Runlight inside Drupal. Then enable it under Extend or with drush pm:install runlight.
composer require runlight/craft
Then run php craft plugin/install runlight, or install it from the Plugin Store in your Craft control panel.
1. Install
These steps set up the TypeScript library in an app that serves routes, such as Next.js, Nuxt, SvelteKit, Astro, Remix, Express, NestJS, Fastify, Koa, Hono, or anything else that handles a web Request, on Node 22 or later, Bun, Deno, or Cloudflare Workers. Every other language has the same steps on its own page.
bash
npm install @runlight/sdk better-sqlite3better-sqlite3 is the SQLite driver. For Postgres, MySQL, MariaDB, Turso, Cloudflare D1, or Bun’s own SQLite, see Configuration.
2. Create the instance
Create one file and import it wherever you need Runlight.
lib/runlight.ts
import { runlight } from "@runlight/sdk";
import { sqlite } from "@runlight/sdk/sqlite";
export const rl = runlight({
store: sqlite({ path: "./data/runlight.db" }),
site: { name: "example.com", hostnames: ["example.com"], timezone: "Europe/London" },
});The tables are created on first use. The database file is yours, so back it up like any other.
3. Mount the routes
In Next.js (App Router), one catch-all route serves the tracker and the dashboard and receives each visit.
app/runlight/[[...path]]/route.ts
import { rl } from "@/lib/runlight";
export const { GET, POST, PUT, PATCH, DELETE, OPTIONS } = rl.routes();Other frameworks take one or two lines too, as Install shows.
4. Add the script
Put this on every page, just before </head>.
html
<script defer src="/runlight/s.js"></script>The script is under 2 KB gzipped and posts to your own domain without setting any cookies.
5. Sign in
The dashboard is private, so set a long random token in your environment.
bash
RUNLIGHT_TOKEN=a-long-random-stringThen open /runlight/?token=a-long-random-string once. Runlight sets a cookie holding a digest of the token (never the token itself) and sends you on to the dashboard.
With no token set, the dashboard is open only while NODE_ENV is development, as it is under next dev. Everywhere else it answers 503 until you set one.
Visit any page of your site and you will see yourself under “here now” within seconds.
6. Schedule the hourly check
Call a check once an hour. It rotates the daily salt, sends email reports, deletes visits a site no longer keeps, and adds up finished days. Scheduled check shows how to set it up. On Vercel it is four lines of vercel.json.
Next
- Tracking covers custom events, single page apps, clicks with no code, and the settings on the script tag.
- Campaigns shows which newsletter, post, or ad sent each visit.
- Goals & Conversions covers conversions and revenue, and Funnels follows visits through several steps.
- Short links puts links on your own domain and counts them like visits, and Custom domains sets that domain up and loads the script from it.
- Importing history brings your visits over from Plausible, Umami, or a CSV file.
- Privacy lists exactly what Runlight stores and what it leaves out.