Introduction
Beat App’s backend architecture consists of two primary API services that handle music data retrieval and streaming functionality. The services are built on top of YouTube Music’s infrastructure, providing a comprehensive music streaming experience.Base Configuration
All API endpoints are configured through environment variables and use a centralized base URL:src/constants.js
Base URL for all API services. Configure via environment variable.
API Services
YouTube API Service
Base URL:${API_URL}/api/youtube
Handles all music metadata operations including:
- Search functionality (tracks, albums, artists, playlists)
- Content retrieval (albums, artists, playlists)
- Discovery features (home feed, explore, charts, new releases)
- Search suggestions and autocomplete
Stream API Service
Base URL:${API_URL}/api/stream
Handles media streaming operations including:
- Audio stream proxying
- Media URL resolution
- Stream delivery optimization
Authentication
All API requests require Bearer token authentication. The token is configured through environment variables:API authentication token for YouTube Music API access
Response Patterns
Standard Response Structure
Most API endpoints return data in a consistent wrapper format:Pagination
Many endpoints support continuation-based pagination:- Initial request returns
continuationtoken in response - Subsequent requests use
/continuationendpoint with token parameter - Empty continuation indicates end of results
Error Handling
All service functions implement graceful error handling:- Failed requests return empty arrays or objects
- No exceptions thrown to client code
- Errors logged to console in development
Data Models
The API implements several data transformation mappers to normalize YouTube Music responses:Rate Limiting
API rate limits are enforced by the upstream YouTube Music API. Implement appropriate request throttling in your application to avoid service disruption.Next Steps
YouTube API
Explore search and metadata endpoints
Stream API
Learn about audio streaming