Music Database is a full-stack music library app for managing artists, albums, tracks, users, and user-generated tags. It combines a .NET API with a lightweight static HTML/CSS/JavaScript frontend and stores everything in PostgreSQL.
Live demo: https://musicdatabase-67o9.onrender.com
First load may take ~1 min (free tier)
- CRUD operations for artists, albums, tracks, users, and tags
- Keyword search across artists, albums, and tracks
- JWT authentication with signup and login flow
- Role-based access control for admin actions
- Tagging on albums and tracks with user-specific tag ownership
- Automatic creation of related artist and album records when tracks are imported
- Username and password validation rules enforced in the domain model
- Image URL preview before submitting album and artist cover changes
- Album type classification is enforced in PostgreSQL triggers: a track count determines whether an album is registered as a Single, EP, or Album.
- Read-only queries use
AsNoTrackingto reduce EF Core change tracking overhead and memory usage. - Password hashing is handled in the service layer with BCrypt, while domain entities enforce the validation rules for user names and passwords.
- Startup is fail-fast: the application throws if the JWT key is missing and applies EF Core migrations before serving requests.
- Backend: ASP.NET Core on .NET 10
- Frontend: HTML, CSS, JavaScript
- Database: PostgreSQL with Entity Framework Core
- Auth: JWT + BCrypt password hashing
- Deployment: Docker + Render-ready configuration
The project is split into clear layers:
-
MusicDatabase.Domain
- Core entities and domain validation rules
- Username/password rules are enforced here
-
MusicDatabase.Core
- Business logic and service layer
- BCrypt hashing and token generation live here
-
MusicDatabase.Data
- EF Core DbContext and persistence logic
- Database access and migrations
-
MusicDatabase.Api
- Controllers and static web frontend hosting
- Startup configuration, auth setup, HTTPS redirection, and migration bootstrapping
-
MusicDatabase.Contracts
- DTOs and request/response models
-
MusicDatabase.Tests
- Integration tests covering service behavior and regression cases
Entities enforce their own invariants (see docstrings in MusicDatabase.Domain). Here's some of them:
- Album: must have an artist and at least one track; release year is 1900 – current year + 1; type (Single/EP/Album) is set by a PostgreSQL trigger based on track count
- User: username 3–20 chars, password 8–30 chars, no whitespace; passwords are hashed with BCrypt
- Tag: max 20 chars, normalized to lowercase
- .NET 10 SDK
- PostgreSQL instance
- Optional: Docker
Set the following before running the app locally or in deployment:
- ConnectionStrings__Default
- Jwt__Key
Example:
export ConnectionStrings__Default="Host=localhost;Database=musicdatabase;Username=postgres;Password=postgres"
export Jwt__Key="your-super-secret-key"Render uses double underscores in environment variable names, so the app expects names like:
- ConnectionStrings__Default
- Jwt__Key
dotnet restore
dotnet run --project MusicDatabase.ApiThe application automatically applies database migrations on startup and redirects root requests to the search page.
A Dockerfile is included for containerized deployment.
Build:
docker build -t musicdatabase .Run:
docker run -p 8080:8080 \
-e ConnectionStrings__Default="Host=...;Database=...;Username=...;Password=..." \
-e Jwt__Key="your-super-secret-key" \
musicdatabaseThe app is configured to:
- fail on missing JWT key
- force HTTPS redirection
- apply EF Core migrations during startup
- expose the API on port 8080 in Docker
This makes it suitable for deployment on Render or similar hosting providers.
Run the test suite with:
dotnet testThe project includes integration tests for repository and service flows, including album, track, artist, tag, and user behavior. Current coverage includes tag add/remove cycles, duplicate protection checks, and validation scenarios around username/password and entity rules.
- Reviews and rating system
- User profile pages with review history
- Tag-based filtering and advanced discovery
- Additional analytics and recommendations
- Artist summary pages and richer artist-level insights
- Albums can have more than one Artist
