Files
PIKKIE/README.md
T

249 lines
19 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<p align="center">
<img src="docs/assets/hero.png" alt="PIKKIE: picky issues keeper & knitpick ideas explorer" width="100%">
</p>
<p align="center">
<img alt="MIT license" src="https://img.shields.io/badge/license-MIT-ff2e93?style=flat-square">
<img alt="Node ≥ 22.13" src="https://img.shields.io/badge/node-%E2%89%A522.13-1c1c1f?style=flat-square&logo=nodedotjs">
<img alt="Kotlin + Compose" src="https://img.shields.io/badge/android-kotlin%20%2B%20compose-3ddc97?style=flat-square&logo=android&logoColor=white">
<img alt="MCP" src="https://img.shields.io/badge/MCP-streamable%20http-ffc94a?style=flat-square">
<img alt="No Google Play services needed" src="https://img.shields.io/badge/de--googled-friendly-f4f4f5?style=flat-square">
</p>
<p align="center"><b>stay pikkie 🤘</b><br>
A self-hosted, punk little bug tracker where beta testers report the little things, as fast as they can type bullet points.</p>
---
## Why PIKKIE?
Beta testers notice dozens of tiny things per session. Classic issue trackers make each one a form. PIKKIE makes it a **bullet point**:
```text
- [12g] App crashes when you rotate on the login screen
- Toast covers the save button
- Back button closes the app instead of going back
(indent a line to add details to the bullet above)
```
Paste it and you get three tracked items, each with its own status, discussion and caliber. Screenshots go in with ⌘/Ctrl+V. The project and caliber you picked are remembered, and the form stays put for the next batch.
Got a lot to report? Switch to **⚡ rapid fire**: type, Enter, type, Enter… then ⌘/Ctrl+Enter fires the whole magazine. Or drop in a `.txt` / `.md` file of `- bullet` lines.
## Screenshots
<table>
<tr>
<td width="50%"><img src="docs/screenshots/web-bullets.png" alt="All bullets, heaviest first"><br><sub><b>Every bullet, every tester.</b> Filter by status, project or caliber, or sort heaviest-first. 🤖 marks bot submissions.</sub></td>
<td width="50%"><img src="docs/screenshots/web-rapid.png" alt="Rapid fire reporting"><br><sub><b>⚡ Rapid fire.</b> One line per bullet: Enter for the next, Alt+1…5 for the caliber, ⌘/Ctrl+Enter to fire. Import .txt/.md too.</sub></td>
</tr>
<tr>
<td><img src="docs/screenshots/web-discussion.png" alt="Item with discussion"><br><sub><b>Flag &amp; discuss.</b> Admins set a status with a message and files, and testers reply in threads or hit ✋ me too.</sub></td>
<td><img src="docs/screenshots/web-offtopic.png" alt="Off-topic image board"><br><sub><b>🎸 Off-topic image board.</b> Memes, music and pets, with chat-style link previews (YouTube thumbnails included).</sub></td>
</tr>
<tr>
<td><img src="docs/screenshots/web-profile.png" alt="Profile page"><br><sub><b>Profiles.</b> A picture, a bio, and stats for bullets, fixes, 12 gauges and me-toos.</sub></td>
<td><img src="docs/screenshots/web-inbox.png" alt="Notification inbox"><br><sub><b>🔔 Inbox.</b> Everything lands here. E-mail and phone alerts are opt-in per event.</sub></td>
</tr>
<tr>
<td><img src="docs/screenshots/web-tour.png" alt="Interactive tutorial"><br><sub><b>🎓 Interactive tour.</b> New testers get a 60-second spotlight tour on their first visit, and can replay it from their profile.</sub></td>
<td><img src="docs/screenshots/web-connect.png" alt="Connect your phone with a QR code"><br><sub><b>QR login, both ways.</b> Scan to log in the phone app, or use the app to log in a computer.</sub></td>
</tr>
<tr>
<td><img src="docs/screenshots/web-board.png" alt="Message board with poll"><br><sub><b>The board.</b> Posts, polls and pinned announcements for the tester crew.</sub></td>
<td><img src="docs/screenshots/web-mcp.png" alt="API keys and MCP"><br><sub><b>MCP for bots.</b> Per-user API keys; admin keys let agents fix and flag issues.</sub></td>
</tr>
</table>
<p align="center">
<img src="docs/screenshots/android-login.png" width="15%" alt="Android: QR login">
<img src="docs/screenshots/android-bullets.png" width="15%" alt="Android: bullets">
<img src="docs/screenshots/android-rapid.png" width="15%" alt="Android: rapid fire">
<img src="docs/screenshots/android-board.png" width="15%" alt="Android: off-topic image board">
<img src="docs/screenshots/android-post.png" width="15%" alt="Android: post with image reply">
<img src="docs/screenshots/android-item.png" width="15%" alt="Android: opened from a notification">
<br><sub>The Android companion has full parity for testers and admins: rapid fire, camera and gallery uploads, the image board, phone notifications, QR login, in-app updates and the whole admin cave.</sub>
</p>
## Features
| | |
|---|---|
| ✱ **Bullet reports** | One line per issue, indented lines become details. Attach evidence by pasting, dragging, or using the phone camera or gallery. |
| ⚡ **Rapid fire** | A line-per-bullet mode built for speed: Enter = next bullet, per-line caliber, evidence optional. |
| 📥 **Import** | Drop `.txt` / `.md` files: `- bullet` lines are imported, nested bullets become details, checkboxes and prose are skipped. |
| 🎯 **Calibers** | Weights from `.22` (nitpick) through `9mm` (minor), `.45 ACP` (annoying) and `7.62` (major) to `12 GAUGE` (blocker). Pick a default or tag a line. |
| 🗂 **Projects** | Admins create projects. The last one each tester used is remembered on every device, so nobody re-picks it 40 times a session. |
| 👀 **Public overview** | Everyone sees every bullet and its status: open, needs info, in progress, fixed, finished or declined. |
| 💬 **Discussions** | Threaded comments with files, editing, ✋ "me too", and a "reporter" badge. |
| ⚡ **Admin flagging** | Set a status with a message and files. The reporter is e-mailed for needs info, fixed, finished and declined. |
| 🤖 **MCP** | Bots can read bullets, see what changed, file new ones (flagged *via MCP*), comment, and flag fixes. |
| 🔔 **Notifications** | Inbox for everything. **E-mail and phone alerts are opt-in per event** (resolved, needs info, comments, replies, board…), all off by default. |
| 📮 **E-mail** | SMTP settings with a test button. Used for opted-in alerts and invites. |
| ✉️ **Invites** | Single-use links, valid 7 days, that work even when sign-up is closed. Admins can resend or revoke. Open sign-up is off by default. |
| 🔒 **2FA** | TOTP with recovery codes. Admins can require it for nobody, admins only, or everyone, and users can set it up in the app too. |
| 📱 **QR login** | The web shows a QR and the phone is logged in, or the app scans the login page and the computer is logged in. |
| 📊 **Board** | Posts, polls, replies, pins, plus a 🎸 **off-topic image board** with image posts, a lightbox and link previews. |
| 🧑‍🎤 **Profiles** | Profile pictures, a bio, a website, and a public profile page with stats. Avatars everywhere. |
| 🎓 **Tutorial** | An interactive spotlight tour on the first visit, replayable from the profile (web) or the Me tab (app). |
| 📦 **APK + updates** | `/#/download` always serves the newest `.apk` in the repo, and the app updates itself from it. |
## Quick start
```bash
git clone https://git.autisme.monster/juli/PIKKIE.git && cd PIKKIE/server
npm install
npm start # → http://localhost:1312
```
The first visit creates the admin account. Everything else is set up in **Admin**.
Want a populated playground? Start a fresh instance on another port and seed it:
```bash
PIKKIE_DATA=/tmp/pikkie-demo PORT=1313 node src/index.js &
npm run demo -- http://localhost:1313 # prints a random demo password
```
`npm test` runs the integration suite, which covers auth, 2FA, QR login, reports, projects, calibers, discussions, invites, notifications and opt-in prefs, profiles and avatars, the image board with link previews (including SSRF blocking), MCP, SMTP, APK serving and reverse-proxy behaviour.
## Deploying behind an HTTPS reverse proxy
PIKKIE is built to sit behind Caddy, nginx or Traefik.
- **Trusted proxies:** proxies on loopback and private networks are trusted out of the box, so `X-Forwarded-Proto`, `-Host` and `-For` are honoured. Override with `PIKKIE_TRUST_PROXY`.
- **HTTPS:** sessions get `Secure` cookies and `Strict-Transport-Security` is sent.
- **Bind locally:** run PIKKIE with `HOST=127.0.0.1` so it is only reachable through the proxy. If it must listen on a LAN, set `PIKKIE_TRUST_PROXY` to your proxy's address, because clients on trusted networks could otherwise send their own `X-Forwarded-*` headers.
- **Links:** set **Admin → Sign-up & 2FA → Public site URL** (e.g. `https://pikkie.example.com`). E-mail links and QR codes always use it.
- **Uploads:** one request can carry up to 10 files of 25 MB each, so allow request bodies of about **250 MB**, or lower it to cap uploads.
**Caddy**
```caddyfile
pikkie.example.com {
request_body {
max_size 250MB
}
reverse_proxy 127.0.0.1:1312
}
```
**nginx**
```nginx
server {
listen 443 ssl http2;
server_name pikkie.example.com;
client_max_body_size 250m;
location / {
proxy_pass http://127.0.0.1:1312;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
```
| env var | default | |
|---|---|---|
| `PORT` / `HOST` | `1312` / `0.0.0.0` | |
| `PIKKIE_DATA` | `./data` | SQLite database and uploads. Back this folder up. |
| `PIKKIE_TRUST_PROXY` | `loopback, linklocal, uniquelocal` | `0` = trust nothing, or a hop count, or a list of IPs/CIDRs |
| `PIKKIE_SECURE_COOKIES` | auto | `1` forces `Secure` cookies even if the proxy doesn't send `X-Forwarded-Proto` |
| `PIKKIE_APK_DIRS` | `releases/:android/app/build/outputs/apk` | folders searched for the newest `.apk` |
| `PIKKIE_SECRET_KEY` | – | key for encrypting 2FA secrets and the SMTP password (32+ characters). If unset, a key file is used. |
| `PIKKIE_KEY_FILE` | `pikkie.key` next to the data folder | where that key file lives; created on first start |
| `PIKKIE_SETUP_TOKEN` | – | if set, creating the first admin requires this token. Use it when the instance is reachable before you set it up. |
| `PIKKIE_UPLOAD_MB_PER_HOUR` | `1000` | per-user upload budget, so one account can't fill the disk |
### Encryption key
The two secrets PIKKIE must be able to read back, users' 2FA secrets and the SMTP password, are encrypted in the database. Everything else that is secret (passwords, sessions, API keys, recovery codes, invite and QR codes) is stored as a one-way hash.
- **Where the key comes from:** `PIKKIE_SECRET_KEY` if set (for example `openssl rand -base64 48`), otherwise a key file. The file is created on first start as `pikkie.key` **next to** the data folder, not inside it, so a copy of the data folder alone can't read the secrets.
- **Back the key up separately.** In a container, either set `PIKKIE_SECRET_KEY` or point `PIKKIE_KEY_FILE` at persistent storage; a key file that disappears with the container is a lost key.
- **Wrong or missing key:** PIKKIE refuses to start and says why. It never creates a new key over existing encrypted data.
- **Changing the key:** start once with the new key in `PIKKIE_SECRET_KEY` and the previous one in `PIKKIE_OLD_SECRET_KEY`. Everything is re-encrypted; then remove the old variable. (To move from the key file to a variable, the "old key" is the file's contents.)
- **Lost key:** start once with `PIKKIE_RESET_SECRETS=wipe-2fa-and-smtp-password`. 2FA is switched off for every user (they set it up again) and the SMTP password is cleared.
- **What it protects against:** a leaked database file or data-folder backup. It can't protect against someone who controls the whole server, since they can read the key too.
## MCP: let bots work the backlog
Every user can create **API keys** in their profile, on the web or in the app. A key acts as its owner, and admin-owned keys unlock the admin tools.
```bash
claude mcp add --transport http pikkie https://pikkie.example.com/mcp \
--header "Authorization: Bearer pk_…"
```
| tool | who | |
|---|---|---|
| `list_issues` | everyone | filter by status, project, caliber or text, with `since=<ms>` for what changed, sorted heaviest first |
| `get_issue` | everyone | full detail: text, attachments, the whole discussion including admin fix notes |
| `list_projects`, `stats`, `whoami`, `list_board_posts` | everyone | |
| `submit_bullets` | everyone | file bullets with a project and caliber; they show up with a 🤖 *via MCP · key-name* badge |
| `add_comment` | everyone | threaded via `parent_id`, with files |
| `set_weight` | reporter / admin | re-weigh a bullet |
| `get_attachment` | everyone | small images come back as image content; larger files can be read in base64 chunks with `offset` and `length` (up to 1 MB per call) |
| `set_status` | admin | flag with a message and files; e-mails the reporter |
| `delete_issue` | admin | |
The endpoint is MCP *streamable HTTP* (stateless JSON-RPC) at `POST /mcp`.
## Android app
Kotlin with Jetpack Compose and OkHttp. QR scanning uses CameraX and ZXing, so it **runs fine without Google Play services** (GrapheneOS, LineageOS, /e/).
```bash
./scripts/build-apk.sh # → releases/pikkie-<version>[-debug].apk, served at /#/download
./scripts/build-apk.sh --install # …and install it on the USB-connected phone
```
- **Requirements:** JDK 17 and the Android SDK (`brew install openjdk@17 && brew install --cask android-commandlinetools`, then `sdkmanager "platforms;android-35" "build-tools;35.0.0"`).
- **Publishing a release:** `./scripts/publish-release.sh` tags `v<version>`, creates a release on the Git server and attaches the APK (an F-Droid repo that watches the releases picks it up from there). It needs an access token in `GITEA_TOKEN` or `~/.pikkie/gitea-token`.
- **Release signing:** the script signs release builds with the key described in `~/.pikkie/release.env` (outside the repo):
```bash
# one-time: create the key, keep ~/.pikkie/ private and BACKED UP
mkdir -p ~/.pikkie && keytool -genkeypair -keystore ~/.pikkie/pikkie-release.p12 -storetype PKCS12 \
-alias pikkie -keyalg RSA -keysize 4096 -validity 10000 -dname "CN=PIKKIE"
# ~/.pikkie/release.env exports PIKKIE_KEYSTORE, PIKKIE_KEYSTORE_PASSWORD, PIKKIE_KEY_ALIAS, PIKKIE_KEY_PASSWORD
```
Without a key you get a debug build. Every release must use the **same key**, or installed apps can't update.
- **In-app updates:** the app compares its version with the server's newest APK, shows an update banner, then downloads the APK and hands it to Android's installer. The first time, Android asks to allow installs from PIKKIE. Bump `versionCode`/`versionName` in `android/app/build.gradle.kts` for every release.
- **Phone notifications:** opt-in per event on the Me tab. The app polls about every 15 minutes with WorkManager (no Google push service needed), and right away when it opens.
- **Testing without touching a real install:** debug builds install as `nl.pikkie.app.dev`, next to the real app with their own login. `./gradlew assembleRelease -PdevRelease` gives the same, but minified like a real release.
- **Sharing in:** "Share → Report in PIKKIE" works from any app, for screenshots, logs and text.
- **Developing against a local server:** run `adb reverse tcp:1312 tcp:1312` and use `http://localhost:1312`. Plain HTTP is only allowed for localhost, `.local`, `.lan` and `.test`.
## Security notes
- **Credentials:** passwords use scrypt (N=2¹⁵; older hashes upgrade at login). Session tokens, API keys, invite tokens and QR codes are stored only as SHA-256 hashes.
- **Brute force:** login, sign-up, setup and QR endpoints are rate-limited. Failed logins are counted per account *and* client address, so a stranger can't lock a tester out by typing wrong passwords. Wrong 2FA codes and wrong current-password entries are counted **per user** (8 per 15 minutes), across sessions and login attempts. TOTP codes can't be replayed.
- **Sessions:** cookies are `HttpOnly`, `SameSite=Strict` and `Secure` over HTTPS. Changing a password or switching on 2FA ends all other sessions; an admin password reset also revokes that account's API keys. API answers are sent with `Cache-Control: no-store`.
- **Identity:** display names are unique (case-insensitive) and stripped of invisible and text-direction characters, so nobody can pose as an admin or another tester.
- **Data at rest:** the data folder (database, uploads) is readable by the server's user only. 2FA secrets and the SMTP password are encrypted (AES-256-GCM) with a key kept outside the data folder; see *Encryption key* below.
- **Admins:** the last active admin can't be demoted or disabled.
- **Connect QRs:** single-use and valid for 10 minutes. The app asks before acting on a connect *link*, shows which server it is for, and never sends an existing session to the server named in a link.
- **Computer-login QRs:** valid 2 minutes, only work when scanned inside the app (not as links), need approval from an already-authenticated app, and are bound to a browser-held secret that never appears in the QR.
- **Invite tokens:** sent in request bodies, never in URL paths, so they stay out of proxy logs.
- **MCP:** the API key is checked before the request body is read. Batches are capped, every call counts against the rate limit, and writes share the web's limits.
- **Uploads:** served with `nosniff`, a sandboxing CSP and `Content-Disposition`. Only PNG, JPEG, GIF and WebP render inline; SVG and HTML always download. Per-user hourly upload budget. Evidence is deleted with the last bullet of its report.
- **Strict CSP:** `script-src 'self'`, no `innerHTML` for user content, `form-action 'self'`, no framing.
- **Mail:** SMTP logins require TLS (STARTTLS can't be stripped). With no site URL set, the fallback origin for links comes only from admin requests with a well-formed `Host`.
- **Link previews:** fetched server-side with SSRF protection. Private, loopback, link-local, CGNAT and tunnelling ranges are refused, every DNS answer and redirect is checked, and there is a hard total deadline plus size limits. Preview images are re-hosted, so viewers' browsers never contact third parties.
- **Android:** the session token is encrypted with an Android Keystore key. Links, shares and notification taps are handled exactly once by a separate receiver, so Android can't replay an old one when the app restarts. Screens showing a secret (2FA setup, recovery codes, a new API key) are excluded from screenshots and the app switcher. No backup or device transfer of app data. Shared-in files are only accepted as `content://` URIs from other apps. Tester-uploaded app packages can't be opened from PIKKIE. Updates are checked for the right package name and signing certificate before Android's installer sees them.
Found something? Open an issue, and be as picky as you like.
## Built with
Node.js with its built-in SQLite, Express, Multer, Nodemailer and node-qrcode on the server; Kotlin, Jetpack Compose, OkHttp, CameraX, WorkManager and ZXing in the app. No trackers, no analytics, no third-party requests from the browser.
Security reports: see [SECURITY.md](SECURITY.md).
## License
[MIT](LICENSE). Do what you want, keep the notice.
<p align="center"><img src="server/public/logo.svg" width="64" alt=""><br><sub>stay pikkie 🤘</sub></p>