TuneCamp Project Overview β
TuneCamp is a federated, self-hosted music platform that combines a personal music server with Fediverse social protocols (ActivityPub), HTTP gossip-based instance discovery, and web3 monetization (on-chain payments on Base).
Project Goals β
- Data Ownership: Allow users to host and control their own music library.
- Federation: Enable interaction between different TuneCamp servers via the ActivityPub (Fediverse) protocol.
- Decentralized Discovery: Use an HTTP gossip protocol to discover other TuneCamp instances; catalogs are then exchanged directly over HTTP.
- Artist Support: Facilitate direct publishing, crowdfunding, and rights management via smart contracts and unlock systems.
- Metadata Enrichment: Integration with multiple providers (MusicBrainz, Discogs, iTunes, TheAudioDB, Spotify, Bandcamp, SoundCloud) and Lyrics.ovh for high-resolution covers and lyrics.
Notable Features β
- Radio: an always-on HLS station broadcast from the instance's library β admins mix custom playlists and dynamic per-genre playlists. See radio.md.
- AI access (MCP): a Model Context Protocol server lets AI clients (e.g. Claude Desktop) search the catalog and run actions over a token-gated channel. See mcp-setup-guide.md.
- Admin System panel: live CPU/RAM/storage/background-task metrics for spotting memory leaks. See monitoring.md.
- Extensibility: built-in backend providers (metadata, streaming, storage, β¦) behind per-provider registries. Acquisition (search/download from external sources) lives in Sidecamp, the desktop companion app.
Tech Stack β
Backend β
- Language: TypeScript
- Runtime: Node.js (Express)
- Database: SQLite (via
better-sqlite3) - Federation: Fedify (ActivityPub)
- Multimedia: FFmpeg (for transcoding and waveform generation)
Webapp (Frontend) β
- Framework: React
- Build Tool: Vite
- Styling: CSS (with theme support)
- State Management: Zustand
- Discovery: HTTP Gossip (only to discover other instances; no P2P distribution of audio content)
Blockchain & Smart Contracts β
- Language: Solidity
- Contracts: Checkout, Factory, NFT for sales and ownership management.
Repository Structure β
The project is organized as a monorepo with the following main directories:
tunecamp/
βββ contracts/ # Smart Contracts (Solidity)
β βββ TuneCampCheckout.sol
β βββ TuneCampFactory.sol
β βββ TuneCampNFT.sol
βββ docs/ # Technical documentation (Markdown, JSON)
βββ src/ # Backend sources and tools
β βββ server/ # Express Server core logic
β β βββ common/ # Shared utilities and errors
β β βββ core/ # Config, DI container, database, plugin-loader
β β βββ middleware/ # Express Middleware (Auth, Error handling, Rate limit)
β β βββ modules/ # Domain-specific business logic (ActivityPub, Catalog, AI, Live, Radio, Storage, Workers, ...)
β β βββ providers/ # Plugin provider implementations (metadata, streaming, storage, ...)
β β βββ repositories/ # Data access layer (Album, Artist, Track)
β β βββ routes/ # REST API Endpoints (admin, api [incl. radio, mcp], auth, library, network)
β β βββ server.ts # Express server bootstrap
β β βββ types/ # Shared backend types
β β βββ utils/ # Server utility functions
β βββ tools/ # Maintenance, backup, and migration scripts
β βββ utils/ # General utility functions
βββ webapp/ # React Frontend Application
β βββ public/ # Static assets and WASM files
β βββ src/ # React sources
β βββ components/ # UI Components organized by domain
β βββ data/ # Static client config
β βββ hooks/ # Custom React Hooks
β βββ pages/ # Page Components (Route entry points, incl. Radio)
β βββ services/ # Client API and webapp services
β βββ stores/ # State management (Zustand)
βββ docker-compose.yml # Configuration for containerized deployment
βββ docker-compose.override.yml.example # Template for per-instance tweaksCritical Directories and Purpose β
src/server/ β
Contains all server-side logic. It uses a layered architecture:
- Routes: Define the API interface.
- Repositories: Handle SQLite queries.
- Modules: Encapsulate complex features such as ActivityPub federation or audio file management.
webapp/src/ β
The heart of the user interface.
- Pages: Fundamental directory mapping the frontend routes.
- Components: Divided into
ui/(base),layout/,modals/, and thematic directories (player/,artist/,admin/). - Services:
api.tsis the main gateway for communicating with the backend.
contracts/ β
Defines the on-chain logic for monetization and access control.
src/tools/ β
Essential for music library management (relinking paths, database migrations, generating unlock codes).
Entry Points β
- Backend:
src/index.tsβ entry point: loads config and callsstartServerfromsrc/server/server.ts. - Webapp:
webapp/src/main.tsxβ mount point of the React application. - CLI/Tools: Various scripts in
src/tools/(backup, restore, generate-codes, relink-tracks, migrations).
Webapp Component Catalog β
Catalog of the main React components in the webapp (webapp/src/), organized by directory. For the overall frontend design see architecture-webapp.md.
Layout (components/layout/) β
MainLayout.tsx: Main app shell (sidebar, player bar, content area).Sidebar.tsx: Primary navigation between sections.
Music Player (components/player/) β
PlayerBar.tsx: Global player bar (controls, progress, volume, queue).PlayerCanvas.tsx: Expanded view / player visualization.QueuePanel.tsx: Playback queue display and management.LyricsPanel.tsx: Synced lyrics panel.Waveform.tsx: Track waveform visualization.
Artist (components/artist/) β
ArtistFediversePanel.tsx: Fediverse (ActivityPub) interactions panel for the artist.ArtistEventsManager.tsx: Create/manage an artist's live events.ArtistStripeConnectCard.tsx: Stripe Connect onboarding/status card for artist payouts.
Network (components/network/) β
PeerSessionCard.tsx: Card for a discovered federated peer/session.PeerTrackCard.tsx: Card for a track found on a remote peer.
Administration (components/admin/) β
- Library lists:
AdminArtistsList,AdminAlbumsList,AdminTracksList,AdminReleasesList,AdminAssetsList,AdminUsersList. - Panels:
AdminSettingsPanel,IntegrationsPanel(renders one card per registered frontend plugin, see architecture-webapp.md),StoragePanel,AdminFederationPanel,ActivityPubPanel,IdentityPanel,AdminMaintenancePanel,BackupPanel,AdminRadioPanel(radio station controls),AdminReportsPanel(release reports queue),PeerSessionsPanel(federated peer session monitoring),SystemPanel(live CPU/RAM/storage sparklines). SetupWizard.tsx: Instance setup wizard (Admin β Setup, root admin only). Applies a profile preset β module flags plus site mode β and can be re-run at any time. See Instance Setup Wizard.CurationQueue.tsx: Curation queue for promoting drafts to releases.
Modals (components/modals/) β
The dialog windows are collected here. The main ones:
- Auth & setup:
AuthModal,SetupWizardModal. - Publishing & import:
UploadTracksModal,AdminReleaseModal,AdminTrackModal,AdminArtistModal,AdminAssetModal,BatchTrackEditModal,ArtistMetadataPickerModal,CreatePostModal,ImportBandcampReleaseModal,AddYouTubeTrackModal. - Purchase/unlock:
CheckoutModal,UnlockModal,UnlockCodeManager,SubscriptionModal. - Playlists & tracks:
CreateUserPlaylistModal,PlaylistModal,AddTrackToUserPlaylistModal,TrackPickerModal. - Moderation:
ReportReleaseModal(report a release),AdminUserModal. - Generic:
ConfirmModal(backsuseConfirmStore).
Base UI (components/ui/) β
PageHeader.tsx: Standard page header.ReleaseCard.tsx: Card for a release/album.AlbumResultCard.tsx: Card for an album/release search result.ThemeSwitcher.tsx: Theme selector (tunecamp/light/grey/nordic/nordic-dark).LanguageSwitcher.tsx: i18n locale switcher.WalletPill.tsx: Wallet status indicator.ChangePasswordCard.tsx: Password change form.SecurityQuestionsCard.tsx: Security questions setup/verification (account recovery).LinksEditor.tsx: Editable list of external links (artist profile, etc.).
Root Components (components/) β
Comments.tsx: Comments section for tracks/albums.RelatedTracks.tsx: Related track suggestions.GenreTags.tsx: Genre tag display/editor for a release or track.MetadataMatchModal.tsx: Metadata matching from external providers.AccountMigrationCard.tsx: Account migration status/actions card.UpdateBanner.tsx: Banner shown when a newer server version is available (seehooks/useVersionCheck.ts).
Frontend Plugins (core/plugins/, plugins/) β
Not components in the traditional sense, but part of the UI surface: each folder under plugins/ registers a FrontendPlugin (icon, description, status check, optional config panel) consumed by IntegrationsPanel / AdminSettingsPanel. Current folders: plugins/builtins/ (Telegram, OpenRouter), plugins/metadata/ (iTunes, MusicBrainz, Deezer, Bandcamp, Spotify, SoundCloud), plugins/youtube/. See architecture-webapp.md for details.
Pages (pages/) β
Each file is generally wired to a route in App.tsx. Main ones: Home, Library (merged tracks/favorites/playlists browsing β /tracks, /favorites, /playlists and /my-playlists redirect here), Releases (also serves /albums), AlbumDetails, Artists, ArtistDetails, Store, PlaylistDetails, MyMusic, Search (also covers what used to be the separate ContentSearch page), Network, Social, Post, Board, Live (live streaming HLS), Radio, NowListening, Stats, Profile, UserProfile, Wallet, Support, Tools, About, Legal, Changelog, Guide, SharePage, Files (root-admin file browser), Archive (manager/root-only), Publish, Admin, AdminReleaseEditor, ResetPassword / ResetPasswordSecurity.
Several routes are gated by wrapper components rather than logic inside the page itself: AdminGuard, EditorGuard, RootAdminGuard, ManagerOrRootGuard (role-based), and ModuleGuard (instance feature flags hideLive, hideStore, hideSocial, hideNetwork, hideSamples, hideCollab from useSiteSettingsStore).
Development Notes β
The components are written in TypeScript with Functional Components and Hooks. Data fetching goes through TanStack Query (hooks/queries.ts, lib/queryClient.ts) layered on top of services/api.ts. Styling uses standard CSS with variables for theme support.
Related Repositories β
| Repo | Description |
|---|---|
| tunecamp | Main server + webapp |
| sidecamp | Standalone Desktop & Mobile App for Peer Sharing, Soulseek, and Torrents (npm-workspaces monorepo: Sidecamp + Sidecamp CLI) |
| fid | FID (Fediverse-ID) β self-sovereign identity & SSO protocol, Zen SEA auth |
| tunecamp-iris | Air-gapped optical file transfer (fountain codes + WASM), standalone |
| tunecamp-website | Landing page, community directory, and global FID identity portal |
| tunecamp-ecosystem | Ecosystem overview doc β what exists, how the pieces talk |
Related Documentation β
- Backend Architecture (includes the data model / database schema)
- Webapp Architecture
- API Contracts
- Development Guide