A Blazor Server application with authentication and authorization.
The application uses SQL Server LocalDB for development. You need to create an appsettings.Development.json file with your connection string.
- Copy
MusicSalesApp/appsettings.Development.json.sampletoMusicSalesApp/appsettings.Development.json - Adjust the connection string if needed
Note: appsettings.Development.json is not checked into source control for security reasons.
The application uses SignalR for real-time features and implements automatic connection management to provide a seamless user experience:
- Keep-alive interval: 15 seconds - Server sends ping to keep connection active
- Client timeout: 60 seconds - Connection considered dead if no response
- Circuit retention: 3 minutes - Server retains inactive circuit state
- Handshake timeout: 15 seconds - Time allowed for initial connection
- Silent reconnection: No modal dialogs shown to users
- Exponential backoff: Retries at 2s, 5s, and 10s intervals
- Auto-reload: Page automatically reloads after 3 failed attempts
- SEO friendly: Reconnection UI hidden from search engines
This configuration ensures:
- Connections stay alive during normal usage
- Minimal disruption during temporary network issues
- Automatic recovery without user intervention
- No reconnection text appearing in search engine results
dotnet restore
dotnet build
dotnet run --project MusicSalesAppThe database will be created automatically on first run with seed data.
After running the application for the first time, you can log in with:
-
Admin User:
- Email:
admin@app.com - Password:
Password_123 - Role: Admin
- Permissions: ManageUsers, ValidatedUser
- Email:
-
Regular User:
- Email:
user@app.com - Password:
Password_123 - Role: User
- Permissions: ValidatedUser
- Email:
dotnet testThe application uses a custom permissions system:
ManageUsers- Assigned to Admin roleValidatedUser- Assigned to Admin and User rolesNonValidatedUser- Reserved for future use
- Browse music library with albums and individual songs
- 60-second preview for non-subscribers and non-owners
- Full playback for purchased music and active subscribers
- Create and manage playlists
- Add songs and albums to cart
- Purchase music through PayPal Expanded Checkout with:
- Multiple payment options (PayPal, Venmo, Pay Later)
- 3D Secure authentication for enhanced security
- Enhanced error handling and user experience
- Compliance with PayPal merchant requirements
- Owned music accessible indefinitely
For detailed information about the PayPal Expanded Checkout integration, see PAYPAL_EXPANDED_CHECKOUT.md.
The application supports a monthly subscription model that provides unlimited streaming access to all music.
- Monthly Price: Configurable in
appsettings.json(default: $3.99/month) - Unlimited Access: Subscribers can stream all music in full without purchasing
- Flexible Cancellation: Cancel anytime, access continues until end of paid period
- PayPal Integration: Secure subscription management through PayPal
Add the following to your appsettings.json:
"PayPal": {
"ClientId": "YOUR_PAYPAL_CLIENT_ID",
"Secret": "YOUR_PAYPAL_SECRET",
"ApiBaseUrl": "https://api-m.sandbox.paypal.com/",
"SubscriptionPrice": "3.99",
"ReturnBaseUrl": "https://localhost:7144"
}- Use sandbox URL for testing:
https://api-m.sandbox.paypal.com/ - Use production URL for live:
https://api-m.paypal.com/ - Update
ReturnBaseUrlto match your application's base URL
- Navigate to "Manage Subscription" from the menu (requires login)
- Review subscription terms
- Check "I agree to the subscription terms and conditions"
- Click "Sign Up for Monthly Subscription"
- Complete payment through PayPal
- Enjoy unlimited streaming!
To cancel:
- Navigate to "Manage Subscription"
- Click "Cancel Subscription"
- Confirm cancellation
- Access continues until the end of your current billing period