How yrdn21/sharemusicdb works
ShareMusic is a FastAPI web app and API for managing artists, albums, songs, and album stock. Users enter through browser pages or API routes; handlers invoke domain-specific database operations, which persist SQLModel records, and web handlers render templates or redirect after changes. The workflow spans artist and album creation, song registration, stock purchases/restocking, and search/history/reporting. Image uploads use configured S3-compatible object storage. The source excerpts establish the album, artist, and song paths; dashboard statistics are documented by the source index, while some router and storage details remain unsampled.
Main entry points: web.py Web routes · artist_operations_db.py Artist operations · operations_db.py Album and stock operations · songs_operations_db.py Song operations
Components 20
Application entry
- FastAPI application
main.py
Catalog workflows
- Album API
routers/album.py - Artist API
routers/artist.py - Song API
routers/songs.py - Artist operations
data/db/artist_operations_db.py - Album and stock operations
data/db/operations_db.py - Song operations
data/db/songs_operations_db.py - Dashboard statistics
data/db/stats_db.py
Domain models
- Artist model
models/artist.py - Album model
models/album.py - Song model
models/songs.py - Domain enums
enums
Persistence and storage
- SQL database engine
data/db/album.py - Image storage
data/image_storage.py
Web presentation
- Web routes
routers/web.py - Template configuration
templating.py - Jinja templates
templates
Other components
- Browser user
- API client
- S3-compatible object store
Connections 33
- Browser user → Web routes: requests pages
routers/web.py - API client → Album API: calls API
README.md - API client → Artist API: calls API
README.md - API client → Song API: calls API
README.md - FastAPI application → Album API: mounts router
main.py - FastAPI application → Artist API: mounts router
main.py - FastAPI application → Song API: mounts router
main.py - FastAPI application → Web routes: mounts router
main.py - Web routes → Template configuration: uses templates
routers/web.py - Web routes → Jinja templates: renders pages
routers/web.py - Web routes → Artist operations: queries and updates
routers/web.py - Web routes → Album and stock operations: queries and updates
routers/web.py - Web routes → Song operations: queries and updates
routers/web.py - Web routes → Dashboard statistics: gets dashboard stats
routers/web.py - Web routes → Image storage: saves uploads
routers/web.py - Album API → Album and stock operations: invokes operations
routers/album.py - Album API → Image storage: saves and deletes
routers/album.py - Artist API → Artist operations: invokes operations
routers/artist.py - Song API → Song operations: invokes operations
routers/songs.py - Artist operations → Image storage: deletes old image
data/db/artist_operations_db.py - Image storage → S3-compatible object store: uploads and deletes
data/image_storage.py - Artist operations → SQL database engine: reads and writes
data/db/artist_operations_db.py - Album and stock operations → SQL database engine: reads and writes
data/db/operations_db.py - Song operations → SQL database engine: reads and writes
data/db/songs_operations_db.py - Dashboard statistics → SQL database engine: queries database
data/db/stats_db.py - Artist operations → Artist model: persists records
data/db/artist_operations_db.py - Album and stock operations → Album model: persists records
data/db/operations_db.py - Song operations → Song model: persists records
data/db/songs_operations_db.py - Album and stock operations → Artist model: checks artist status
data/db/operations_db.py - Song operations → Album model: checks album and track
data/db/songs_operations_db.py - Album model → Domain enums: uses genre and stock types
models/album.py - Artist model → Domain enums: uses artist status
models/artist.py - Song model → Domain enums: uses song status
models/songs.py