source: Klonkt/README.md@ 421046c

main
Last change on this file since 421046c was f3663e5, checked in by roboburr <roboburr@…>, 2 months ago

docs: add THIRD-PARTY-NOTICES.md + README acknowledgements

Credit the open-source software Klonkt bundles/uses — especially the attribution/copyleft ones:
FFmpeg (GPL-3.0 via ffmpeg-static), libwebp (via node-webpmux, LGPL-3.0), resvg (MPL-2.0), SQLite,
htmx, EJS and the SIL OFL fonts (Fraunces, Plus Jakarta Sans, Literata).

Co-Authored-By: Claude <noreply@…>

  • Property mode set to 100644
File size: 8.4 KB
Line 
1# Klonkt
2
3Your own, **self-hosted** corner of the web — for your story, your visuals and
4your sound. Built on **Node + SQLite + htmx**: lightweight, server-rendered, and
5yours. No algorithm, no ads, no platform sitting in between.
6
7## What it does
8
9- **Solo** — one personal site, entirely yours, on your own domain.
10- **Blog & photos** — posts with cover, tags, timeline or grid.
11- **Host your own music** — built-in audio player with tracks, albums and playlists.
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.
15- **Grow**: newsletter, download-for-email, EPK/press kit, link-in-bio,
16 show calendar, and **cookie-free statistics**.
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.
20- **Themes & languages** — multiple palettes (light + dark), interface in EN/NL/DE.
21- **Installable (PWA)**, **privacy-first** (self-hosted fonts, no tracking).
22
23### Lite mode (no audio)
24
25Set `KLONKT_AUDIO=off` in `.env` to disable the entire audio/music feature.
26Klonkt then runs as a lightweight **blog/photo/EPK/links site without ffmpeg** —
27ideal for minimal hosting. Circles and external embeds
28(YouTube/SoundCloud/Spotify) keep working.
29
30It's **fully reversible**: set `KLONKT_AUDIO` back to `on` (or remove the line)
31and restart — no reinstall. The flag only toggles the audio routes/UI; the
32database tables are never dropped, so any tracks you had are preserved.
33
34## Self-hosting
35
36Klonkt is a **Node app** — run it on a **VPS, in Docker, or on a Node hosting
37platform (PaaS)**. **Not** on classic shared PHP hosting. The database (SQLite)
38creates itself on first start.
39
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
44### Option A — One-command VPS installer (recommended)
45
46**Good if:** you have (or just rented) a fresh, empty Debian/Ubuntu VPS and want
47the easiest path. This single line does everything — installs Node 20, sets up
48Caddy for automatic HTTPS, runs Klonkt as a background service that auto-restarts
49on reboot, and adds an update command. It's coexistence-safe (if the server
50already runs something it picks a free port and skips Caddy), but a clean VPS is
51simplest. Point your domain's DNS (A + AAAA records) at the server first, then run
52as root:
53
54```bash
55curl -fsSL https://klonkt.com/install.sh | sudo bash -s -- --domain yourdomain.com
56```
57
58Then open `https://yourdomain.com` and finish setup in the browser. Update anytime
59with `klonkt-update`.
60
61Updates track the **`stable`** branch — it only advances to a version that's been verified,
62so `klonkt-update` never pulls work-in-progress. Want the bleeding edge instead? Install with
63`--branch main` (or set `KLONKT_BRANCH=main`).
64
65### Option B — Docker
66
67**Good if:** you already use Docker, or want everything bundled in one isolated
68container. Node, ffmpeg and cwebp are inside the image — you only need Docker +
69Docker Compose.
70
71```bash
72git clone https://github.com/roboburr/klonkt.git
73cd klonkt
74cp .env.example .env # works as-is; optionally set PUBLIC_BASE_URL to your domain
75docker compose up -d
76```
77
78`SESSION_SECRET` is auto-generated on first start, so the defaults work as-is.
79Klonkt runs on port 3000 — put your own reverse proxy in front for HTTPS (see
80step 5 of Option C). Data (database + media) stays in the `klonkt-data` volume,
81even across updates. Update: `git pull && docker compose up -d --build`.
82
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
86manage, or just want to test it locally.
87
88**1. Get the code & install dependencies**
89
90```bash
91git clone https://github.com/roboburr/klonkt.git
92cd klonkt
93npm ci
94```
95
96**2. Create your config.** `SESSION_SECRET` (the key that signs login cookies) is
97auto-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 &
99login links are correct:
100
101```bash
102cp .env.example .env
103nano .env # optional: PUBLIC_BASE_URL, plus SMTP if you want it
104```
105
106**3. Start it** — the SQLite database is created automatically on first start:
107
108```bash
109npm start # runs on http://localhost:3000
110```
111
112Just 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
117npm install -g pm2
118pm2 start src/server.js --name klonkt
119pm2 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
123certificates), put this in `/etc/caddy/Caddyfile` and reload Caddy:
124
125```caddy
126yourdomain.com {
127 reverse_proxy localhost:3000
128}
129```
130
131By default the app binds to `127.0.0.1` (via `HOST` in `.env`), so only your
132reverse proxy can reach it — not the open internet. Local testing on the same
133machine (`localhost:3000`) still works. Only set `HOST=0.0.0.0` if you need direct
134external access without a proxy (then open the port in your firewall and add HTTPS
135yourself).
136
137(`cwebp` is optional — `apt install webp` — for WebP image conversion.)
138
139### HTTPS (Docker / bare Node)
140
141Put a reverse proxy in front of the app. With **Caddy** (automatic Let's Encrypt):
142
143```caddy
144yourdomain.com {
145 reverse_proxy localhost:3000
146 encode gzip zstd
147}
148```
149
150(The VPS installer sets up Caddy + HTTPS for you already.)
151
152### First run
153
154Open your site → you get the **setup wizard**: pick your language, name your site
155and create your admin. The **first user automatically becomes the administrator**;
156registration then closes. Lost your password?
157`npm run reset-admin` (Docker: `docker compose exec klonkt npm run reset-admin`).
158
159## Configuration (`.env`)
160
161| Variable | Required | What |
162|---|---|---|
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) |
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. |
169
170## Stack
171
172- **Runtime:** Node 20+
173- **Web:** Express + Helmet + express-session
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)
177- **Fediverse / Circles:** ActivityPub (HTTP Signatures) — federates with Mastodon, PeerTube and other Klonkt sites
178- **Fonts:** self-hosted variable woff2 (Fraunces / Plus Jakarta Sans)
179
180## Project structure
181
182```
183src/
184├── server.js # Express bootstrap + route mounting
185├── config/ # database, mailer, feature flags
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, …)
190├── views/ # shell.ejs + partials/ + pages/ (EJS)
191└── assets/ # css/ (palette tokens + components), js/ (htmx, player), fonts/
192```
193
194## License
195
196**AGPL-3.0-or-later** — see [LICENSE](LICENSE). Klonkt is free software: you may
197use, study, modify and distribute it. The AGPL does require that a modified
198version you offer as a network service makes its source code available to the
199users of that service. Made by robo.burr (Robin Genis) ·
200<https://klonkt.com>
201
202## Acknowledgements
203
204Klonkt stands on a lot of open-source work — Node.js, FFmpeg, SQLite, libwebp, resvg, htmx, EJS and
205more, plus the Fraunces, Plus Jakarta Sans and Literata fonts. See
206[THIRD-PARTY-NOTICES.md](THIRD-PARTY-NOTICES.md) for the full list and their licences. Thank you to
207everyone who made them.
Note: See TracBrowser for help on using the repository browser.