Server
install, configure, deploy.
The server is optional but needed for the console, remote paywall settings, purchase verification, AI summary and the Instagram API module. It never sees an Instagram account, username, follower list or export file.
01Install and run
cd server
cp .env.example .env # set ADMIN_SECRET_KEY
npm ci
npm run build
npm start # listens on :8787
npm start reads .env automatically. Open /admin; with no ADMIN_SETUP_TOKEN the server prints a one-time setup code in its log at start. Enter it to create the owner account, then set up two-factor in the console. Without a session nothing in the console can be read or changed.
Other commands: npm run dev (build and start), npm run check (typecheck, lint, tests, build). Health check: GET /healthz returns {"ok":true}.
02Environment variables
| Variable | Default | Meaning, where to get it |
|---|---|---|
ADMIN_SECRET_KEY | a generated file next to the database | Encrypts the store keys, AI key and Meta tokens saved in the console. Create with openssl rand -hex 32. Back it up: without it saved secrets cannot be read. |
ADMIN_SETUP_TOKEN | one-time code printed in the log | Creates the first owner. Create with openssl rand -hex 24; remove after the owner exists. |
PORT | 8787 | HTTP port. |
DATABASE_PATH | data/followlens.sqlite | SQLite file. The console keeps its own file beside it. |
TRUST_PROXY_HOPS | 0 | Number of reverse proxies you control in front of the server (Caddy or nginx = 1). Used for rate limits and sign-in limits. |
ADMIN_DEMO_PASSWORD | unset | Only for a public read-only demo console on its own empty database. Leave empty on a real install. |
There are no other environment variables. Store credentials, the AI key and the Meta secret are entered in the console, not in .env.
03Deploy
Docker
docker build -t followlens-server .
docker run -p 8787:8787 -v followlens-data:/app/data --env-file .env followlens-server
The volume holds the databases.
Any Node host (VPS, PM2, systemd)
npm ci && npm run build
node dist/src/index.js
Put it behind HTTPS (Caddy or nginx) and set TRUST_PROXY_HOPS=1. Run one process on one disk: SQLite is not for several instances. HTTPS is required by the app stores' networking rules and by the Instagram redirect URL.
Back up the data/ folder and ADMIN_SECRET_KEY.
04API the app uses
| Route | What |
|---|---|
GET /v1/config | public, cached 5 minutes, ETag / 304. Paywall, features, onboarding, announcement, update. |
POST /v1/ping | only if the user switched on "Share anonymous usage counts" (off by default). |
POST /v1/purchases/verify | answers 501 verification_off unless you switch verification on. |
POST /v1/ai/summary | AI summary; 501 ai_off when not configured. |
GET /v1/ig/start, /v1/ig/callback, /v1/ig/insights, DELETE /v1/ig/token | official Instagram API module. |
All /v1 routes are limited to 60 requests a minute per address. Full description: contract/CONTRACT.md.
05What the server stores
No export data and no personal data. A ping keeps a random install id, platform, app version, Pro or not, the time last seen and per-day counts of event names; installs not seen for 400 days are deleted. Purchase verification stores no install id, only the revenue event (store transaction id, price, time).