| [184393c] | 1 | # Klonkt
|
|---|
| [7bc636b] | 2 |
|
|---|
| [bbbfa3c] | 3 | Your own, **self-hosted** corner of the web — for your story, your visuals and
|
|---|
| 4 | your sound. Built on **Node + SQLite + htmx**: lightweight, server-rendered, and
|
|---|
| 5 | yours. No algorithm, no ads, no platform sitting in between.
|
|---|
| [7bc636b] | 6 |
|
|---|
| [bbbfa3c] | 7 | ## What it does
|
|---|
| [7bc636b] | 8 |
|
|---|
| [7008b28] | 9 | - **Solo** — one personal site, entirely yours, on your own domain.
|
|---|
| [bbbfa3c] | 10 | - **Blog & photos** — posts with cover, tags, timeline or grid.
|
|---|
| 11 | - **Host your own music** — built-in audio player with tracks, albums and playlists.
|
|---|
| [7008b28] | 12 | - **Fediverse-native** — your posts federate over **ActivityPub**: people follow,
|
|---|
| 13 | like, boost and reply from Mastodon (or another Klonkt). You can follow accounts,
|
|---|
| 14 | see a home timeline, and reply/like back — Klonkt is a full fediverse client.
|
|---|
| [bbbfa3c] | 15 | - **Grow**: newsletter, download-for-email, EPK/press kit, link-in-bio,
|
|---|
| 16 | show calendar, and **cookie-free statistics**.
|
|---|
| [ce16d8a] | 17 | - **Circles** — a curated feed of the makers you choose: feature accounts (other Klonkt
|
|---|
| 18 | sites, Mastodon, PeerTube — any fediverse server) and their public posts appear in your
|
|---|
| 19 | Circle. Decentralized, no central platform — built on ActivityPub.
|
|---|
| [bbbfa3c] | 20 | - **Themes & languages** — multiple palettes (light + dark), interface in EN/NL/DE.
|
|---|
| 21 | - **Installable (PWA)**, **privacy-first** (self-hosted fonts, no tracking).
|
|---|
| [7bc636b] | 22 |
|
|---|
| [bbbfa3c] | 23 | ### Lite mode (no audio)
|
|---|
| [7bc636b] | 24 |
|
|---|
| [bbbfa3c] | 25 | Set `KLONKT_AUDIO=off` in `.env` to disable the entire audio/music feature.
|
|---|
| 26 | Klonkt then runs as a lightweight **blog/photo/EPK/links site without ffmpeg** —
|
|---|
| [7008b28] | 27 | ideal for minimal hosting. Circles and external embeds
|
|---|
| [bbbfa3c] | 28 | (YouTube/SoundCloud/Spotify) keep working.
|
|---|
| [7bc636b] | 29 |
|
|---|
| [196e1be] | 30 | It's **fully reversible**: set `KLONKT_AUDIO` back to `on` (or remove the line)
|
|---|
| 31 | and restart — no reinstall. The flag only toggles the audio routes/UI; the
|
|---|
| 32 | database tables are never dropped, so any tracks you had are preserved.
|
|---|
| 33 |
|
|---|
| [bbbfa3c] | 34 | ## Self-hosting
|
|---|
| [5a2cb69] | 35 |
|
|---|
| [bbbfa3c] | 36 | Klonkt is a **Node app** — run it on a **VPS, in Docker, or on a Node hosting
|
|---|
| 37 | platform (PaaS)**. **Not** on classic shared PHP hosting. The database (SQLite)
|
|---|
| 38 | creates itself on first start.
|
|---|
| [5a2cb69] | 39 |
|
|---|
| [c648b04] | 40 | > **Requires [Node.js](https://nodejs.org/) 20 or newer.** The one-command VPS
|
|---|
| 41 | > installer and the Docker image include it; only a manual install needs you to
|
|---|
| 42 | > provide it.
|
|---|
| 43 |
|
|---|
| [6d3e2c1] | 44 | ### Option A — One-command VPS installer (recommended)
|
|---|
| [5a2cb69] | 45 |
|
|---|
| [45271b7] | 46 | **Good if:** you have (or just rented) a fresh, empty Debian/Ubuntu VPS and want
|
|---|
| 47 | the easiest path. This single line does everything — installs Node 20, sets up
|
|---|
| 48 | Caddy for automatic HTTPS, runs Klonkt as a background service that auto-restarts
|
|---|
| 49 | on reboot, and adds an update command. It's coexistence-safe (if the server
|
|---|
| 50 | already runs something it picks a free port and skips Caddy), but a clean VPS is
|
|---|
| 51 | simplest. Point your domain's DNS (A + AAAA records) at the server first, then run
|
|---|
| 52 | as root:
|
|---|
| [7bc636b] | 53 |
|
|---|
| 54 | ```bash
|
|---|
| [6d3e2c1] | 55 | curl -fsSL https://klonkt.com/install.sh | sudo bash -s -- --domain yourdomain.com
|
|---|
| [7bc636b] | 56 | ```
|
|---|
| 57 |
|
|---|
| [45271b7] | 58 | Then open `https://yourdomain.com` and finish setup in the browser. Update anytime
|
|---|
| 59 | with `klonkt-update`.
|
|---|
| [184393c] | 60 |
|
|---|
| [0343a7a] | 61 | Updates track the **`stable`** branch — it only advances to a version that's been verified,
|
|---|
| 62 | so `klonkt-update` never pulls work-in-progress. Want the bleeding edge instead? Install with
|
|---|
| 63 | `--branch main` (or set `KLONKT_BRANCH=main`).
|
|---|
| 64 |
|
|---|
| [6d3e2c1] | 65 | ### Option B — Docker
|
|---|
| [184393c] | 66 |
|
|---|
| [45271b7] | 67 | **Good if:** you already use Docker, or want everything bundled in one isolated
|
|---|
| 68 | container. Node, ffmpeg and cwebp are inside the image — you only need Docker +
|
|---|
| 69 | Docker Compose.
|
|---|
| [5a2cb69] | 70 |
|
|---|
| 71 | ```bash
|
|---|
| [45271b7] | 72 | git clone https://github.com/roboburr/klonkt.git
|
|---|
| 73 | cd klonkt
|
|---|
| [09ee2bd] | 74 | cp .env.example .env # works as-is; optionally set PUBLIC_BASE_URL to your domain
|
|---|
| [6d3e2c1] | 75 | docker compose up -d
|
|---|
| [5a2cb69] | 76 | ```
|
|---|
| 77 |
|
|---|
| [09ee2bd] | 78 | `SESSION_SECRET` is auto-generated on first start, so the defaults work as-is.
|
|---|
| [45271b7] | 79 | Klonkt runs on port 3000 — put your own reverse proxy in front for HTTPS (see
|
|---|
| 80 | step 5 of Option C). Data (database + media) stays in the `klonkt-data` volume,
|
|---|
| 81 | even across updates. Update: `git pull && docker compose up -d --build`.
|
|---|
| [184393c] | 82 |
|
|---|
| [45271b7] | 83 | ### Option C — manual (Node 20+), step by step
|
|---|
| 84 |
|
|---|
| 85 | **Good if:** you want full control, are adding Klonkt to a server you already
|
|---|
| 86 | manage, or just want to test it locally.
|
|---|
| 87 |
|
|---|
| 88 | **1. Get the code & install dependencies**
|
|---|
| [5a2cb69] | 89 |
|
|---|
| 90 | ```bash
|
|---|
| [45271b7] | 91 | git clone https://github.com/roboburr/klonkt.git
|
|---|
| 92 | cd klonkt
|
|---|
| [5a2cb69] | 93 | npm ci
|
|---|
| 94 | ```
|
|---|
| 95 |
|
|---|
| [09ee2bd] | 96 | **2. Create your config.** `SESSION_SECRET` (the key that signs login cookies) is
|
|---|
| 97 | auto-generated on first start, so this works as-is. For production, set
|
|---|
| 98 | `PUBLIC_BASE_URL` to your site address (e.g. `https://yourdomain.com`) so email &
|
|---|
| 99 | login links are correct:
|
|---|
| [45271b7] | 100 |
|
|---|
| 101 | ```bash
|
|---|
| 102 | cp .env.example .env
|
|---|
| [7008b28] | 103 | nano .env # optional: PUBLIC_BASE_URL, plus SMTP if you want it
|
|---|
| [45271b7] | 104 | ```
|
|---|
| 105 |
|
|---|
| 106 | **3. Start it** — the SQLite database is created automatically on first start:
|
|---|
| 107 |
|
|---|
| 108 | ```bash
|
|---|
| 109 | npm start # runs on http://localhost:3000
|
|---|
| 110 | ```
|
|---|
| 111 |
|
|---|
| 112 | Just testing locally? Stop here and open `http://localhost:3000`.
|
|---|
| 113 |
|
|---|
| 114 | **4. Keep it running** across crashes and reboots (easiest is pm2):
|
|---|
| 115 |
|
|---|
| 116 | ```bash
|
|---|
| 117 | npm install -g pm2
|
|---|
| 118 | pm2 start src/server.js --name klonkt
|
|---|
| 119 | pm2 save && pm2 startup # run the one command it prints, once
|
|---|
| 120 | ```
|
|---|
| 121 |
|
|---|
| 122 | **5. Add HTTPS** with a reverse proxy in front. With Caddy (automatic
|
|---|
| 123 | certificates), put this in `/etc/caddy/Caddyfile` and reload Caddy:
|
|---|
| 124 |
|
|---|
| 125 | ```caddy
|
|---|
| 126 | yourdomain.com {
|
|---|
| 127 | reverse_proxy localhost:3000
|
|---|
| 128 | }
|
|---|
| 129 | ```
|
|---|
| 130 |
|
|---|
| [f99bbe8] | 131 | By default the app binds to `127.0.0.1` (via `HOST` in `.env`), so only your
|
|---|
| 132 | reverse proxy can reach it — not the open internet. Local testing on the same
|
|---|
| 133 | machine (`localhost:3000`) still works. Only set `HOST=0.0.0.0` if you need direct
|
|---|
| 134 | external access without a proxy (then open the port in your firewall and add HTTPS
|
|---|
| 135 | yourself).
|
|---|
| 136 |
|
|---|
| [45271b7] | 137 | (`cwebp` is optional — `apt install webp` — for WebP image conversion.)
|
|---|
| [5a2cb69] | 138 |
|
|---|
| [bbbfa3c] | 139 | ### HTTPS (Docker / bare Node)
|
|---|
| [5a2cb69] | 140 |
|
|---|
| [bbbfa3c] | 141 | Put a reverse proxy in front of the app. With **Caddy** (automatic Let's Encrypt):
|
|---|
| [5a2cb69] | 142 |
|
|---|
| 143 | ```caddy
|
|---|
| [bbbfa3c] | 144 | yourdomain.com {
|
|---|
| [5a2cb69] | 145 | reverse_proxy localhost:3000
|
|---|
| 146 | encode gzip zstd
|
|---|
| 147 | }
|
|---|
| 148 | ```
|
|---|
| 149 |
|
|---|
| [bbbfa3c] | 150 | (The VPS installer sets up Caddy + HTTPS for you already.)
|
|---|
| [184393c] | 151 |
|
|---|
| [bbbfa3c] | 152 | ### First run
|
|---|
| [5a2cb69] | 153 |
|
|---|
| [bbbfa3c] | 154 | Open your site → you get the **setup wizard**: pick your language, name your site
|
|---|
| 155 | and create your admin. The **first user automatically becomes the administrator**;
|
|---|
| 156 | registration then closes. Lost your password?
|
|---|
| [184393c] | 157 | `npm run reset-admin` (Docker: `docker compose exec klonkt npm run reset-admin`).
|
|---|
| 158 |
|
|---|
| [bbbfa3c] | 159 | ## Configuration (`.env`)
|
|---|
| [184393c] | 160 |
|
|---|
| [bbbfa3c] | 161 | | Variable | Required | What |
|
|---|
| [184393c] | 162 | |---|---|---|
|
|---|
| [bbbfa3c] | 163 | | `SESSION_SECRET` | ✅ | Random string of ≥32 characters |
|
|---|
| 164 | | `PUBLIC_BASE_URL` | ✅ | Canonical URL (e.g. `https://yourdomain.com`) |
|
|---|
| 165 | | `SMTP_HOST` / `_PORT` / `_USER` / `_PASS` / `_FROM` | — | Email for password reset + newsletter |
|
|---|
| 166 | | `KLONKT_DEFAULT_LANG` | — | Default language for visitors (`en`/`nl`/`de`) |
|
|---|
| 167 | | `KLONKT_AUDIO` | — | `off` = lite mode (no audio/ffmpeg) |
|
|---|
| [897c33b] | 168 | | `HSTS_STRICT` | — | `1` = stricter HTTPS header (`includeSubDomains` + `preload`). Only set this if Klonkt owns the **whole** domain and all its subdomains are HTTPS — it forces every subdomain to HTTPS and can bake your domain into browsers near-permanently. Leave unset otherwise; the default is already safe. |
|
|---|
| [7bc636b] | 169 |
|
|---|
| 170 | ## Stack
|
|---|
| 171 |
|
|---|
| 172 | - **Runtime:** Node 20+
|
|---|
| 173 | - **Web:** Express + Helmet + express-session
|
|---|
| [bbbfa3c] | 174 | - **DB:** better-sqlite3 (WAL), self-migrating on boot
|
|---|
| 175 | - **Templates:** EJS (server-rendered) + **htmx 1.9** (vendored, no build step)
|
|---|
| 176 | - **Audio:** ffmpeg-static (bundled)
|
|---|
| [ce16d8a] | 177 | - **Fediverse / Circles:** ActivityPub (HTTP Signatures) — federates with Mastodon, PeerTube and other Klonkt sites
|
|---|
| [184393c] | 178 | - **Fonts:** self-hosted variable woff2 (Fraunces / Plus Jakarta Sans)
|
|---|
| [7bc636b] | 179 |
|
|---|
| [bbbfa3c] | 180 | ## Project structure
|
|---|
| [7bc636b] | 181 |
|
|---|
| 182 | ```
|
|---|
| 183 | src/
|
|---|
| [bbbfa3c] | 184 | ├── server.js # Express bootstrap + route mounting
|
|---|
| [7008b28] | 185 | ├── config/ # database, mailer, feature flags
|
|---|
| [bbbfa3c] | 186 | ├── db/migrations/ # SQLite schema (001-init.sql)
|
|---|
| 187 | ├── middleware/ # site resolving, auth, render (htmx-aware)
|
|---|
| 188 | ├── routes/ # per-resource Express routers (posts, auth, admin-*, circle, …)
|
|---|
| 189 | ├── services/ # domain logic (federation, stats, mailer, permissions, …)
|
|---|
| [184393c] | 190 | ├── views/ # shell.ejs + partials/ + pages/ (EJS)
|
|---|
| [bbbfa3c] | 191 | └── assets/ # css/ (palette tokens + components), js/ (htmx, player), fonts/
|
|---|
| [7bc636b] | 192 | ```
|
|---|
| 193 |
|
|---|
| [bbbfa3c] | 194 | ## License
|
|---|
| [7bc636b] | 195 |
|
|---|
| [bbbfa3c] | 196 | **AGPL-3.0-or-later** — see [LICENSE](LICENSE). Klonkt is free software: you may
|
|---|
| 197 | use, study, modify and distribute it. The AGPL does require that a modified
|
|---|
| 198 | version you offer as a network service makes its source code available to the
|
|---|
| 199 | users of that service. Made by robo.burr (Robin Genis) ·
|
|---|
| [184393c] | 200 | <https://klonkt.com>
|
|---|