A comprehensive Blazor Server application demonstrating enterprise-level CRUD operations with JWT authentication, role-based authorization, audit logging, and real-time features. This project showcases modern web development best practices using .NET 8 and Blazor Server.
- Hybrid Authentication: Cookie-based (Blazor Server) + JWT (API endpoints)
- User Registration & Login: Complete authentication system with email/password
- Password Recovery: Forgot password functionality with email reset
- User Management: Admin panel for user administration
- Role-Based Access Control (RBAC): Admin and User roles with policy-based authorization
- Profile Management: User profile editing and settings
- Token Refresh: Secure refresh token mechanism with automatic renewal
- Account Security: Account lockout protection, password hashing (PBKDF2)
- Audit Logging: Complete tracking of all authentication events
π Complete Authentication Documentation | Testing Guide
- Real-time Statistics: Live metrics and data visualization
- Activity Feed: Recent user and system activities
- Quick Actions: Fast access to common tasks
- Responsive Design: Optimized for all screen sizes
- Complete CRUD Operations: Create, Read, Update, Delete products
- Advanced Search & Filtering:
- Multi-category filtering with checkboxes
- Price range sliders
- Date range selection
- Real-time search with instant results
- Tag-based filtering system
- Image Upload: Product image management with preview
- Rich Text Editor: HTML content support for product descriptions
- Bulk Operations: Multi-select and batch actions
- Hierarchical Categories: Parent-child category relationships
- Category Organization: Drag-and-drop ordering
- Icon Support: Custom icons for visual categorization
- Display Management: Category visibility and ordering controls
- User Administration: Complete user management interface
- Audit Logging: Comprehensive system audit trail
- System Monitoring: Performance metrics and health checks
- Configuration Management: Application settings interface
- Real-time Notifications: SignalR-powered live updates
- Background Services: Automated maintenance and cleanup tasks
- Error Handling: Global exception handling with user-friendly error pages
- Offline Support: Network status detection and offline mode
- State Management: Global application state container
- Audit Trail: Complete activity logging for compliance
- Data Validation: Comprehensive client and server-side validation
- Currency Input: International currency formatting and validation
- Clean Architecture: Layered architecture with separation of concerns
- Dependency Injection: Comprehensive DI container setup
- Middleware Pipeline: Request/response logging and global error handling
- Entity Framework Core: Advanced ORM with migrations and seeding
- AutoMapper: Object-to-object mapping for DTOs
- FluentValidation: Model validation with custom rules
- Serilog: Structured logging with detailed context
- Responsive Design: Bootstrap 5 with mobile-first approach
- Component Library: Reusable UI components and controls
- .NET 8.0 SDK or later
- Visual Studio 2022 / VS Code / JetBrains Rider
- SQLite (included) or SQL Server
- Node.js (for frontend dependencies)
- Clone the repository
git clone https://github.com/yourusername/BlazorCrudDemo.git
cd BlazorCrudDemo-
Database Setup
- SQLite is used by default (no additional setup required)
- For SQL Server, update the connection string in
appsettings.json - Run database migrations (see Database Setup)
-
Run the application
# Start the application
cd BlazorCrudDemo.Web
dotnet runThe database file (blazorcrud.db) will be created automatically with seed data.
cd BlazorCrudDemo.Web
dotnet watch- Open your browser and navigate to
http://localhost:5120 - Default Admin Account:
- Email:
admin@demo.com - Password:
Admin123!
- Email:
- The dashboard will load with sample data for demonstration
BlazorCrudDemo/
βββ BlazorCrudDemo.Data/ # Data access layer
β βββ Configurations/ # Entity Framework configurations
β βββ Contexts/ # Database context & interceptors
β βββ Interfaces/ # Repository interfaces
β βββ Repositories/ # Data repository implementations
β
βββ BlazorCrudDemo.Shared/ # Shared models and utilities
β βββ DTOs/ # Data Transfer Objects
β βββ Models/ # Domain models (Product, Category, User, Audit)
β βββ Validators/ # Input validation rules
β βββ Exceptions/ # Custom exception types
β
βββ BlazorCrudDemo.Web/ # Blazor Server application
βββ BackgroundServices/ # Automated background tasks
β βββ MaintenanceServices.cs
β
βββ Components/ # Reusable UI components
β βββ Categories/ # Category management components
β βββ Dashboard/ # Dashboard widgets and charts
β βββ Layout/ # Navigation and layout components
β βββ Products/ # Product form and display components
β βββ Search/ # Advanced search and filter components
β βββ Shared/ # Common UI elements (inputs, modals, etc.)
β
βββ Configuration/ # Application configuration
β βββ IdentityServerConfig.cs
β
βββ Hubs/ # SignalR hubs for real-time features
β βββ NotificationHub.cs
β
βββ Middleware/ # Custom middleware
β βββ GlobalExceptionHandlerMiddleware.cs
β βββ RequestResponseLoggingMiddleware.cs
β
βββ Pages/ # Application pages
β βββ Account/ # User profile and settings
β βββ Admin/ # Administrative functions
β βββ Auth/ # Authentication pages (Login, Register, etc.)
β βββ Categories.razor # Category management
β βββ Dashboard/ # Main dashboard
β βββ Error.razor # Error handling
β βββ Products/ # Product management
β
βββ Services/ # Business logic services
β βββ AuthenticationService.cs
β βββ AuditService.cs
β βββ CategoryService.cs
β βββ ProductService.cs
β βββ UserService.cs
β βββ NotificationService.cs
β
βββ wwwroot/ # Static assets
βββ css/ # Custom stylesheets
βββ js/ # JavaScript files
βββ lib/ # Third-party libraries (Bootstrap, Font Awesome)
- Blazor Server - .NET web framework for interactive web UIs
- Bootstrap 5 - Responsive CSS framework with mobile-first design
- Font Awesome 6 - Comprehensive icon library
- JavaScript Interop - Client-side functionality integration
- .NET 8.0 - Cross-platform development framework
- ASP.NET Core - Web framework for hosting and middleware
- Entity Framework Core 8.0 - Object-relational mapping with advanced features
- SignalR - Real-time web functionality for live updates
- AutoMapper - Object-to-object mapping for DTOs
- FluentValidation - Model validation with custom business rules
- SQLite - Lightweight, file-based database with full EF Core support
- Entity Framework Core Migrations - Database schema management and versioning
- Audit Trail - Complete activity logging and change tracking
- ASP.NET Core Identity - User management and authentication
- Duende IdentityServer - OAuth 2.0 and OpenID Connect framework
- Password Hashing - Secure password storage and validation
- Role-Based Authorization - Permission-based access control
- Serilog - Structured logging with rich context information
- Background Services - Automated tasks and maintenance operations
- Error Boundaries - Graceful error handling and recovery
- Request/Response Logging - HTTP traffic monitoring and analysis
- Network Status Detection - Online/offline state management
- System.Text.Json - High-performance JSON processing
- Microsoft.Extensions - Dependency injection and configuration
- Humanizer - Human-friendly text formatting
- Blazor Components - Rich UI component library
- Comprehensive error handling with custom middleware
- Structured logging with detailed context information
- Input validation using FluentValidation
- Clean architecture with separation of concerns
- Efficient database queries with Entity Framework
- Background services for maintenance tasks
- Optimized component rendering and state management
The application can be deployed to various hosting environments:
cd BlazorCrudDemo.Web
dotnet publish -c Release- IIS (Windows): Traditional Windows hosting with process isolation
- Kestrel (Cross-platform): Lightweight cross-platform deployment
- Docker containers: Containerized deployment with consistent environments
- Azure App Service: Cloud hosting with scaling and monitoring
- Linux hosting: Native Linux deployment with systemd
# Build the Docker image
docker build -t blazorcruddemo -f BlazorCrudDemo.Web/Dockerfile .
# Run the container
docker run -d -p 5120:80 --name blazor-app blazorcruddemo- Development: Uses
appsettings.Development.jsonwith relaxed security - Production: Uses
appsettings.Production.jsonwith enhanced security settings - Connection Strings: Configurable for different database providers
- Logging: Environment-specific logging levels and outputs
Contributions are welcome! Here's how to get started:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes with clear, descriptive commit messages
- Test your changes thoroughly across different scenarios
- Update documentation for any new features or changes
- Submit a pull request with a detailed description
- Follow the existing code style and architectural patterns
- Add comprehensive tests for new functionality
- Update documentation for any new features
- Ensure all tests pass before submitting
- Follow security best practices for authentication and data handling
- Use meaningful variable and method names
- Add XML documentation to public APIs
- Handle exceptions gracefully with appropriate logging
- Follow SOLID principles and clean code practices
- Implement proper separation of concerns
This project is licensed under the MIT License - see the LICENSE file for details.
- Blazor - .NET web framework for building interactive web UIs
- Bootstrap - Responsive CSS framework for modern web design
- Font Awesome - Comprehensive icon library and toolkit
- Serilog - Structured logging framework for .NET applications
- SQLite - Self-contained, serverless SQL database engine
- Entity Framework Core - Object-relational mapping framework
- ASP.NET Core Identity - Membership system for authentication
- SignalR - Real-time web functionality framework
- AutoMapper - Object-to-object mapping library
- FluentValidation - Validation library for .NET
If you encounter any issues or have questions:
- π Documentation: Check the Wiki for detailed guides
- π Bug Reports: Report issues on GitHub
- π¬ Discussions: Start a Discussion for questions
- π§ Email: Contact the maintainers for private inquiries