Source Tree Analysis β
This section describes the structure of the TuneCamp repository, highlighting critical directories and their purpose.
Project Structure β
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 (e.g. labApps.ts β Lab app registry)
β βββ hooks/ # Custom React Hooks
β βββ pages/ # Page Components (Route entry points, incl. Radio, Lab)
β βββ services/ # Client API and webapp services
β βββ stores/ # State management (Zustand)
βββ docker-compose.yml # Configuration for containerized deploymentCritical 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).