How casantosmu/audiodeck works
Project type and purpose
• From the file tree and README, AudioDeck is a full-stack, self-hosted web application.
• Frontend: a React/TypeScript single-page app built with Vite.
• Backend: a Go HTTP API serving static assets, listing media files, and reading audio data from a read-only volume.
• Purpose: let users browse their local music library, fetch audio files, and generate spectrograms entirely in the browser.
File structure
• Top level: Dockerfile and dockerignore (container build & runtime), README/license.
• backend/:
• cmd/api/: HTTP entrypoint (main.go, routes.go, handlers.go, middleware.go)
• internal/media/: logic to open, decode, and probe audio files (decode.go, format.go)
• go.mod/sum: Go module definitions
• frontend/:
• public & index.html: static shell
• src/: React app (App.tsx, components, context, hooks, core models, utils)
• vite.config.ts & tsconfig*: build config
• package.json & pnpm-lock.yaml: dependencies & scripts
• Absence of a database: file system is the sole “data store.”
README for additional insights
• Key features: zero server load for spectrogram generation, path-traversal-safe, Docker-ready.
• Usage: volume mount /media from host into the container, expose port 4747.
Main components and their interactions
a. Frontend SPA (React/Vite)
• Served as static assets by the Go backend.
• Components: FileBrowser (lists files via API), SpectrogramDisplay (uses Web Audio API to render).
b. Backend HTTP API (Go)
• Serves static files (HTML/CSS/JS).
• Exposes endpoints under /api/…:
• GET /api/files: directory listing (reads /media mount).
• GET /api/audio/:path: streams raw audio bytes.
• Internal media package handles audio probing and MIME negotiation.
c. File system volume
• Host directory mounted read-only into container at /media.
d. Client processing
• Browser fetches audio chunks, decodes via Web Audio API, computes spectrogram on the client side.
e. Docker container
• Encapsulates backend + static assets + volume mount; orchestrated via Docker Compose.
Architectural patterns and design principles
• Single page application (SPA) front/backend separation via REST API.
• Minimal backend responsibilities: serve assets and stream files (thin API layer).
• Client-side heavy lifting (spectrogram generation) for zero server CPU load.
• Secure by design: read-only mounts, middleware guarding against path traversal.