How egbejoe06/musicgenre works
Purpose and Deployment Shape
Music Genre Classifier is a two-process application: a Vue 3 browser client captures or accepts audio, and an Express API submits it to Google Gemini for native audio-based genre analysis. The frontend runs through Vite; the backend is a Node.js service configured with a Gemini API key.
• Frontend/src/main.js
• Backend/server.js
• Backend/.env.example
Frontend Application Shell
The Vue application boots the root component and uses Vue Router to render the primary user workflow. App.vue provides the application shell, while the home view coordinates input, submission, loading/error state, and result presentation.
• Frontend/src/main.js
• Frontend/src/App.vue
• Frontend/src/router/index.js
• Frontend/src/views/HomeView.vue
Audio Acquisition Boundary
Audio enters the client through two interchangeable sources. The recorder uses browser microphone and Web Audio/media capabilities for recorded clips and waveform-oriented interaction; the uploader accepts existing audio files. Both produce an audio payload for the shared classification path, keeping browser media handling separate from API and AI concerns.
• Frontend/src/components/AudioRecorder.vue
• Frontend/src/components/AudioUploader.vue
• Frontend/src/views/HomeView.vue
API Client and Request Flow
The frontend API service is the network boundary. It sends the selected or recorded audio as multipart/form-data to the backend classification endpoint, using a configurable API URL via frontend environment settings. The expected response carries genre, subgenre, confidence, reasoning, acoustic analysis, and timestamp.
• Frontend/src/services/api.js
• Frontend/.env.example
• Frontend/src/views/HomeView.vue
Result Rendering
Classification output is isolated in a dedicated Vue component. It consumes the structured API response rather than interpreting raw model output in the UI, allowing the backend to own response normalization and error handling.
• Frontend/src/components/GenreResult.vue
• Frontend/src/views/HomeView.vue
Backend Ingestion and AI Orchestration
Express exposes GET /api/health for service checks and POST /api/classify for audio analysis. Multer handles multipart upload ingestion, with supported audio constrained to MP3, WAV, FLAC, and WebM and a stated 10 MB maximum. The server then invokes Google Generative AI/Gemini, relying on Gemini’s native audio understanding rather than local feature extraction, and returns normalized JSON to the client.
• Backend/server.js
• Backend/package.json
• Backend/.env.example
Runtime and External Dependencies
The primary runtimes are a modern Node.js backend and browser-hosted Vue/Vite frontend. Material external services and platform boundaries are Google Gemini via GEMINI_API_KEY, browser microphone permissions (HTTPS or localhost), and local HTTP communication between the Vite client and Express API. Styling is frontend-local via Tailwind and the main stylesheet.
• Backend/server.js
• Frontend/vite.config.js
• Frontend/src/assets/main.css
Main entry points: HomeView.vue Classification workflow · api.js API client · server.js Express server · main.js Vue bootstrap
Components 14
Vue Browser Client
Vite-hosted Vue 3 application.
- Vite runtime
Frontend/vite.config.js - Vue bootstrap
Frontend/src/main.js - Application shell
Frontend/src/App.vue - Vue Router
Frontend/src/router/index.js - Classification workflow · Coordinates input, submission state, and results.
Frontend/src/views/HomeView.vue - Audio recorder · Captures microphone clips with browser media APIs.
Frontend/src/components/AudioRecorder.vue - Audio uploader · Accepts existing audio files.
Frontend/src/components/AudioUploader.vue - API client · Sends multipart audio to the classification API.
Frontend/src/services/api.js - Genre result · Renders normalized classification output.
Frontend/src/components/GenreResult.vue
Express API
Node.js audio classification service.
- Express server · Exposes health and classification endpoints.
Backend/server.js - Multer ingestion · Validates MP3, WAV, FLAC, and WebM uploads up to 10 MB.
Backend/server.js - Gemini orchestration · Submits audio and normalizes the model response.
Backend/server.js
Platform & AI
- Browser microphone · Requires permission and HTTPS or localhost.
- Google Gemini · Native audio-based genre analysis.
Connections 17
- Vite runtime → Vue bootstrap: serves
- Vue bootstrap → Application shell: mounts
- Application shell → Vue Router: hosts
- Vue Router → Classification workflow: renders
- Browser microphone → Audio recorder: audio capture
- Audio recorder → Classification workflow: recorded audio
- Audio uploader → Classification workflow: selected file
- Classification workflow → API client: classify audio
- API client → Express server: POST /api/classify multipart
- Express server → Multer ingestion: ingests request
- Multer ingestion → Gemini orchestration: validated audio
- Gemini orchestration → Google Gemini: audio analysis · Uses GEMINI_API_KEY.
- Google Gemini → Gemini orchestration: genre analysis
- Gemini orchestration → Express server: normalized JSON
- Express server → API client: classification response
- API client → Classification workflow: structured result
- Classification workflow → Genre result: renders result