Skip to content

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 deployment

Critical 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.ts is 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 calls startServer from src/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).

Released under the MIT License.