How abhishek1mandal/am-music-backend works
AM Music Backend is a FastAPI music-library service. Its principal workflow is a client request entering the versioned API, passing through a domain endpoint, and producing catalog, discovery, download, or playback behavior. The tree also shows account and preference management, playlists, favorites, history, artwork, and maintenance. The graph preserves these product areas and the central metadata, storage, and persistence layers. Source evidence is incomplete for many endpoints, so their internal calls are not asserted; dashed links mark unverified runtime relationships.
Main entry points: router.py API router · database.py Database session · v1/auth.py Authentication API · dependencies/auth.py Authentication dependency
Components 27
API surface
- API router
app/api/v1/router.py
Accounts and preferences
- Authentication API
app/api/v1/auth.py - Preferences API
app/api/v1/preferences.py - Authentication dependency
app/dependencies/auth.py - Language preferences
app/services/preferences/languages.py
Catalog and discovery
- Home API
app/api/v1/home.py - Catalog APIs
app/api/v1/albums.py - Search API
app/api/v1/search.py - User collections APIs
app/api/v1/playlists.py - Library API
app/api/v1/library.py - Home discovery
app/services/home.py - MusicBrainz metadata
app/services/metadata/musicbrainz.py
Downloads and media
- Downloads API
app/api/v1/downloads.py - Streaming API
app/api/v1/streaming.py - Artwork API
app/api/v1/artwork.py - Maintenance API
app/api/v1/maintenance.py - YouTube Music provider
app/services/providers/youtube_music.py - Music downloading
app/services/music/downloader.py - Music processing
app/services/music/artwork.py
Runtime and persistence
- FastAPI application
app/main.py - Token and password security
app/core/security.py - Runtime configuration
app/core/config.py - Database session
app/core/database.py - Track records
app/models/track.py - User records
app/models/user.py
Other components
- API client
- MusicBrainz service
Connections 36
- API client → FastAPI application: sends requests
- FastAPI application → API router: mounts routes
app/main.py - FastAPI application → Language preferences: seeds languages
app/main.py - API router → Authentication API: registers
app/api/v1/router.py - API router → Preferences API: registers
app/api/v1/router.py - API router → Home API: registers
app/api/v1/router.py - API router → Catalog APIs: registers
app/api/v1/router.py - API router → Search API: registers
app/api/v1/router.py - API router → User collections APIs: registers
app/api/v1/router.py - API router → Library API: registers
app/api/v1/router.py - API router → Downloads API: registers
app/api/v1/router.py - API router → Streaming API: registers
app/api/v1/router.py - API router → Artwork API: registers
app/api/v1/router.py - API router → Maintenance API: registers
app/api/v1/router.py - Authentication API → Token and password security: hashes and issues tokens
app/api/v1/auth.py - Authentication dependency → Token and password security: decodes tokens
app/dependencies/auth.py - Home discovery → MusicBrainz metadata: searches metadata
app/services/home.py - MusicBrainz metadata → MusicBrainz service: requests metadata
- Home API → Home discovery: uses discovery
- Downloads API → Music downloading: delegates downloads
- Streaming API → Music processing: uses media services
- Artwork API → Music processing: uses artwork service
- Downloads API → YouTube Music provider: may use provider
- Preferences API → Authentication dependency: requires user identity
- Authentication API → Database session: queries users
app/api/v1/auth.py - Authentication dependency → Database session: loads user
app/dependencies/auth.py - FastAPI application → Database session: closes resources
app/main.py - Home discovery → Track records: queries tracks
app/services/home.py - Home discovery → MusicBrainz metadata: uses language mapping
app/services/home.py - Language preferences → Database session: queries and seeds
app/services/preferences/languages.py - Authentication API → User records: creates and queries
app/api/v1/auth.py - Authentication dependency → User records: checks account
app/dependencies/auth.py - Track records → Database session: maps records
app/models/track.py - User records → Database session: maps records
app/models/user.py - Downloads API → Runtime configuration: may read settings
- Streaming API → Runtime configuration: may read settings