TuneCamp β Architecture Decisions & AI Rules β
Workflow & Git Guidelines β
devis the integration branch β never commit tomaindirectly, and never branch offmainfor changes. All work branches offdev:git checkout dev && git pullfirst, thengit checkout -b feat/<name>orfix/<name>.- Keep
devsynced withmain. Before starting new work (and before merging anything intodev), fast-forwarddevfrom the latestmainso it never drifts behind the released code:git checkout dev && git fetch origin && git merge --ff-only origin/main. - Feature/fix branches merge into
dev;devis what gets promoted tomainfor releases. - Before every push: update
CHANGELOG.mdand bumppackage.jsonversion (semver):patch(x.x.X) β bug fix, typo, no new featureminor(x.X.0) β new backward-compatible featuremajor(X.0.0) β breaking change, removed API, architectural shift
- Open PR with
gh pr createtargetingdev(notmain).
Architecture Decisions β
Database β
- Stay on SQLite (better-sqlite3, WAL mode). No Postgres/Redis while single-machine.
- Bottleneck is CPU/concurrency/IO on one process, not the DB.
- Migrate only if: horizontal scale (multi-machine) OR sustained write contention (
SQLITE_BUSY).
Filesystem β
- Files are never moved or renamed. The filesystem is the truth of where a file is; the DB holds metadata.
consolidateFiles()has been removed β do not reintroduce it or any logic that moves/renames files.sync-tags(rewrites ID3 tags from DB) is kept as a manual on-demand action only.- Dedup by
file_pathviamergeTracksis fine; filesystem reorganization is not.
ZEN / ZEN β
- ZEN DB / ZEN has been fully removed (PR #370, 2026-06-15). Do not re-import
zen,zendb.service,zen.worker, orgun. - Instance discovery now uses federated HTTP (NodeInfo
/.well-known/nodeinfo,/peersendpoint, gossip crawler). - Zen SEA & FID SSO signatures (
/api/auth/zen/*) remain active for decentralized identity passports and cross-instance linking.
Federation & Auth β
- Auth is username + password + JWT, per-instance. No cross-instance SSO, no portable cryptographic identity.
- ActivityPub federates interactions, not logins (Mastodon/Funkwhale model).
- Transactions (purchases/collections) are local to the artist's instance.
- RSS/Atom feeds can be followed: stored as
remote_actorswithtype='rss'; items asremote_content.
Publishing & Roles β
- Listeners (
userrole) cannot publish. No uploads, releases, sales, or social posts. - Gate:
VisibilityGuardian.canPublishContent()β root_admin/admin always; super_user (curator) oruser(listener) only when they have a linked artist profile (artistId); anyone without an artist link never. - "Become an Artist" flow keeps the account's
userrole after admin approval β it links an artist profile that grants publishing viacanPublishContent. - Every new publish/sell endpoint must use
canPublishContent, not rawartistIdchecks.
Playlists β
- Playlists are members-only (401 for anonymous). All logged-in users (including Listeners) can create them.
- Public stage model: a private track added to a public playlist is deliberately published. This is the curation channel, not a leak.
- Do not make playlists visible to anonymous users or restrict them by role above
user.