Music Albums REST API written in C# / .NET Core, with Dapper and PostgreSQL
Secrets are stored in User Secrets (outside the repo, never committed).
1. Configure application secrets (User Secrets):
# Set your secrets for the main API
cd src/MusicAlbums.Api
dotnet user-secrets set "Database:ConnectionString" "Server=localhost;Port=5433;Database=albums;User ID=dev;Password=yourpass;"
dotnet user-secrets set "Jwt:Key" "your-secret-key-min-32-chars"
dotnet user-secrets set "ApiKey" "your-api-key"
# Set secrets for Identity API
cd ../../tools/Identity.Api
dotnet user-secrets set "Jwt:Secret" "your-secret-key-min-32-chars"2. Configure database credentials (Docker - Optional):
Docker Compose uses these defaults: dev / changeme / albums on port 5433
If you want different values, copy the example and customize:
cp .env.example .env
# Edit .env with your valuesNote: Don't edit docker-compose.yml directly - use .env to override defaults.
Keep ports in sync: If you change POSTGRES_PORT in .env, update your connection string to match:
cd src/MusicAlbums.Api
dotnet user-secrets set "Database:ConnectionString" "Server=localhost;Port=YOUR_NEW_PORT;Database=albums;User ID=dev;Password=changeme;"docker-compose up -d # Start database
cd src/MusicAlbums.Api
dotnet run# List all secrets
cd src/MusicAlbums.Api
dotnet user-secrets list
# Open secrets file directly (Windows)
code "$env:APPDATA\Microsoft\UserSecrets\<UserSecretsId>\secrets.json"
# Open secrets file directly (Linux/macOS)
code ~/.microsoft/usersecrets/<UserSecretsId>/secrets.jsonFind <UserSecretsId> in MusicAlbums.Api.csproj or Identity.Api.csproj.