source: Klonkt/README.md@ 45271b7

main
Last change on this file since 45271b7 was 45271b7, checked in by Robin Genis <roboburr@…>, 3 months ago

docs: clearer A/B/C for beginners + complete Option C

Add a 'Good if:' line per option and write Option C as a full step-by-step
(clone, config, start, keep running with pm2, HTTPS via Caddy).

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

  • Property mode set to 100644
File size: 6.5 KB
RevLine 
[184393c]1# Klonkt
[7bc636b]2
[bbbfa3c]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.
[7bc636b]6
[bbbfa3c]7## What it does
[7bc636b]8
[bbbfa3c]9- **Solo or hub** — one personal site, or a label/collective with multiple
10 makers under one roof.
11- **Blog & photos** — posts with cover, tags, timeline or grid.
12- **Host your own music** — built-in audio player with tracks, albums and playlists.
13- **Fans & comments** — visitors sign in with Google (optional) and comment.
14- **Grow**: newsletter, download-for-email, EPK/press kit, link-in-bio,
15 show calendar, and **cookie-free statistics**.
16- **Circles** — connect your site with other Klonkt sites and show each other's
17 public posts; decentralized, with no central platform (Ed25519-signed federation).
18- **Themes & languages** — multiple palettes (light + dark), interface in EN/NL/DE.
19- **Installable (PWA)**, **privacy-first** (self-hosted fonts, no tracking).
[7bc636b]20
[bbbfa3c]21### Lite mode (no audio)
[7bc636b]22
[bbbfa3c]23Set `KLONKT_AUDIO=off` in `.env` to disable the entire audio/music feature.
24Klonkt then runs as a lightweight **blog/photo/EPK/links site without ffmpeg** —
25ideal for minimal hosting. Hub, Circles and external embeds
26(YouTube/SoundCloud/Spotify) keep working.
[7bc636b]27
[bbbfa3c]28## Self-hosting
[5a2cb69]29
[bbbfa3c]30Klonkt is a **Node app** — run it on a **VPS, in Docker, or on a Node hosting
31platform (PaaS)**. **Not** on classic shared PHP hosting. The database (SQLite)
32creates itself on first start.
[5a2cb69]33
[6d3e2c1]34### Option A — One-command VPS installer (recommended)
[5a2cb69]35
[45271b7]36**Good if:** you have (or just rented) a fresh, empty Debian/Ubuntu VPS and want
37the easiest path. This single line does everything — installs Node 20, sets up
38Caddy for automatic HTTPS, runs Klonkt as a background service that auto-restarts
39on reboot, and adds an update command. It's coexistence-safe (if the server
40already runs something it picks a free port and skips Caddy), but a clean VPS is
41simplest. Point your domain's DNS (A + AAAA records) at the server first, then run
42as root:
[7bc636b]43
44```bash
[6d3e2c1]45curl -fsSL https://klonkt.com/install.sh | sudo bash -s -- --domain yourdomain.com
[7bc636b]46```
47
[45271b7]48Then open `https://yourdomain.com` and finish setup in the browser. Update anytime
49with `klonkt-update`.
[184393c]50
[6d3e2c1]51### Option B — Docker
[184393c]52
[45271b7]53**Good if:** you already use Docker, or want everything bundled in one isolated
54container. Node, ffmpeg and cwebp are inside the image — you only need Docker +
55Docker Compose.
[5a2cb69]56
57```bash
[45271b7]58git clone https://github.com/roboburr/klonkt.git
59cd klonkt
60cp .env.example .env # then edit .env: set SESSION_SECRET + PUBLIC_BASE_URL
[6d3e2c1]61docker compose up -d
[5a2cb69]62```
63
[45271b7]64Klonkt runs on port 3000 — put your own reverse proxy in front for HTTPS (see
65step 5 of Option C). Data (database + media) stays in the `klonkt-data` volume,
66even across updates. Update: `git pull && docker compose up -d --build`.
[184393c]67
[45271b7]68### Option C — manual (Node 20+), step by step
69
70**Good if:** you want full control, are adding Klonkt to a server you already
71manage, or just want to test it locally.
72
73**1. Get the code & install dependencies**
[5a2cb69]74
75```bash
[45271b7]76git clone https://github.com/roboburr/klonkt.git
77cd klonkt
[5a2cb69]78npm ci
79```
80
[45271b7]81**2. Create your config** — copy the example and edit it; at minimum set a long
82random `SESSION_SECRET` and your `PUBLIC_BASE_URL` (e.g. `https://yourdomain.com`):
83
84```bash
85cp .env.example .env
86nano .env
87```
88
89**3. Start it** — the SQLite database is created automatically on first start:
90
91```bash
92npm start # runs on http://localhost:3000
93```
94
95Just testing locally? Stop here and open `http://localhost:3000`.
96
97**4. Keep it running** across crashes and reboots (easiest is pm2):
98
99```bash
100npm install -g pm2
101pm2 start src/server.js --name klonkt
102pm2 save && pm2 startup # run the one command it prints, once
103```
104
105**5. Add HTTPS** with a reverse proxy in front. With Caddy (automatic
106certificates), put this in `/etc/caddy/Caddyfile` and reload Caddy:
107
108```caddy
109yourdomain.com {
110 reverse_proxy localhost:3000
111}
112```
113
114(`cwebp` is optional — `apt install webp` — for WebP image conversion.)
[5a2cb69]115
[bbbfa3c]116### HTTPS (Docker / bare Node)
[5a2cb69]117
[bbbfa3c]118Put a reverse proxy in front of the app. With **Caddy** (automatic Let's Encrypt):
[5a2cb69]119
120```caddy
[bbbfa3c]121yourdomain.com {
[5a2cb69]122 reverse_proxy localhost:3000
123 encode gzip zstd
124}
125```
126
[bbbfa3c]127(The VPS installer sets up Caddy + HTTPS for you already.)
[184393c]128
[bbbfa3c]129### First run
[5a2cb69]130
[bbbfa3c]131Open your site → you get the **setup wizard**: pick your language, name your site
132and create your admin. The **first user automatically becomes the administrator**;
133registration then closes. Lost your password?
[184393c]134`npm run reset-admin` (Docker: `docker compose exec klonkt npm run reset-admin`).
135
[bbbfa3c]136## Configuration (`.env`)
[184393c]137
[bbbfa3c]138| Variable | Required | What |
[184393c]139|---|---|---|
[bbbfa3c]140| `SESSION_SECRET` | ✅ | Random string of ≥32 characters |
141| `PUBLIC_BASE_URL` | ✅ | Canonical URL (e.g. `https://yourdomain.com`) |
142| `GOOGLE_CLIENT_ID` / `_SECRET` / `_REDIRECT_URI` | — | Google login for listeners (your own OAuth client; never grants admin) |
143| `SMTP_HOST` / `_PORT` / `_USER` / `_PASS` / `_FROM` | — | Email for password reset + newsletter |
144| `KLONKT_DEFAULT_LANG` | — | Default language for visitors (`en`/`nl`/`de`) |
145| `KLONKT_AUDIO` | — | `off` = lite mode (no audio/ffmpeg) |
[7bc636b]146
147## Stack
148
149- **Runtime:** Node 20+
150- **Web:** Express + Helmet + express-session
[bbbfa3c]151- **DB:** better-sqlite3 (WAL), self-migrating on boot
152- **Templates:** EJS (server-rendered) + **htmx 1.9** (vendored, no build step)
153- **Audio:** ffmpeg-static (bundled)
154- **Circles:** Ed25519-signed pull (libsodium via Node crypto)
[184393c]155- **Fonts:** self-hosted variable woff2 (Fraunces / Plus Jakarta Sans)
[7bc636b]156
[bbbfa3c]157## Project structure
[7bc636b]158
159```
160src/
[bbbfa3c]161├── server.js # Express bootstrap + route mounting
162├── config/ # database, mailer, google, feature flags
163├── db/migrations/ # SQLite schema (001-init.sql)
164├── middleware/ # site resolving, auth, render (htmx-aware)
165├── routes/ # per-resource Express routers (posts, auth, admin-*, circle, …)
166├── services/ # domain logic (federation, stats, mailer, permissions, …)
[184393c]167├── views/ # shell.ejs + partials/ + pages/ (EJS)
[bbbfa3c]168└── assets/ # css/ (palette tokens + components), js/ (htmx, player), fonts/
[7bc636b]169```
170
[bbbfa3c]171## License
[7bc636b]172
[bbbfa3c]173**AGPL-3.0-or-later** — see [LICENSE](LICENSE). Klonkt is free software: you may
174use, study, modify and distribute it. The AGPL does require that a modified
175version you offer as a network service makes its source code available to the
176users of that service. Made by robo.burr (Robin Genis) ·
[184393c]177<https://klonkt.com>
Note: See TracBrowser for help on using the repository browser.