Development Workflow¶
Running the Application¶
Start Services¶
# Start all services
docker compose up -d
# View logs
docker compose logs -f radio-community
Stop Services¶
docker compose down
Making Changes¶
Frontend Changes¶
The container mounts ./frontend/dist as read-only. This means:
- Make frontend changes in
frontend/src/ - Build locally:
cd frontend && npm run build - Restart container:
docker compose up -d(no--buildneeded!) - Changes are immediately visible - no Docker rebuild required
Why this works:
- Local npm run build writes to frontend/dist/
- Container reads from mounted volume
- No need to rebuild Docker image for frontend changes
Backend Changes¶
Rebuild required when changing:
- server.js (backend code)
- Adding new npm dependencies
- Changing Dockerfile or docker-compose.yml
docker compose up -d --build
Code Style¶
Backend (JavaScript)¶
- Language: JavaScript (ES6+) with CommonJS modules
- Indentation: 4 spaces (no tabs)
- Line Length: Soft limit 120 characters
- Functions: Prefer async/await with early returns
Frontend (TypeScript/React)¶
- Language: TypeScript with React 18
- Styling: Tailwind CSS + DaisyUI
- Indentation: 2 spaces
- TypeScript: Strict mode enabled, no
anyallowed - Hooks: Follow react-hooks rules (exhaustive deps)
Linting¶
# Lint frontend
cd frontend && npm run lint
# Lint backend
npx eslint server.js
Database¶
Schema¶
The database schema is defined in db/init.postgres.sql.
Operations¶
- Use
dbGet(sql, params)- Get single row - Use
dbAll(sql, params)- Get multiple rows - Use
dbRun(sql, params)- Insert/Update/Delete - Call
saveDatabase()after mutations
File Ownership¶
Downloaded music files are chowned to www-data:www-data (Dockerfile creates user if not exists).
Music Storage¶
Music files are stored in the mounted host folder:
/mnt/HDD1/nextcloud/data/aldo/files/Documents/Torrents/music/
- Community subfolder:
community/(e.g.,community/kanjers/) - Database stores relative paths:
community/kanjers/track.mp3