Simple music store built with:
- Node.js + Express backend
- Vanilla HTML/CSS/JS frontend
- Jest + Supertest for API testing
- Browse albums (static JSON data)
- Search by title or artist (debounced)
- Filter by genre
- LocalStorage powered cart (add / remove / quantity adjust / clear)
- Simple checkout simulation (alert)
- Audio preview button (if album has
previewUrl) - API endpoints:
- GET
/api/albums(optionalsearch,genrequery params) - GET
/api/albums/:id - GET
/api/health
- GET
src/
server.js # Express app
routes/albums.js # Album routes
data/ # Static JSON + access helpers
public/
index.html # UI
styles.css # Styling
app.js # Frontend logic
tests/
albums.test.js # Jest API tests
Install dependencies:
npm install
Run in dev mode with auto-reload:
npm run dev
Run tests:
npm test
Place a demo audio file at public/audio/demo.mp3 (or adjust the previewUrl in src/data/albums.json). The frontend renders a ▶ button for albums with a previewUrl. Clicking it plays/stops a single shared audio element.
Notes:
- Supported formats depend on the browser (recommend
.mp3for widest support). - Only one preview plays at a time; starting a new one stops the previous.
- To add more previews, add
previewUrlto other album objects.
When a preview starts, a global player bar appears at the bottom with:
- Title / artist
- Play/Pause toggle (⏸ / ▶)
- Seek bar (drag to seek)
- Elapsed and total time (mm:ss) It hides automatically when playback ends or you stop the track.
- Persist orders (SQLite or Mongo)
- User auth + sessions
- Pagination + sorting
- Album artwork uploads
- Better accessibility & keyboard navigation
- TypeScript migration
ISC (demo only)