A clean architecture application built with .NET 9 and TypeScript React for managing books, authors, categories, and publishers in a library.
This application follows Clean Architecture principles with Domain-Driven Design (DDD):
- Domain Layer: Contains entities, domain events, and repository interfaces
- Application Layer: Contains CQRS commands/queries, DTOs, and business logic
- Infrastructure Layer: Contains Entity Framework implementation and external services
- API Layer: Contains REST API controllers and configuration
- CQRS Pattern: Separate Commands (Create/Update/Delete) and Queries (Read)
- MediatR: For handling commands and queries
- Entity Framework Core: For data persistence with SQL Server
- FluentValidation: For input validation
- Domain Events: For handling domain events like BookCreated
- Swagger/OpenAPI: For API documentation
- Docker Compose: For easy deployment with SQL Server
- Unit Tests: For testing business logic
- .NET 9 SDK
- Docker Desktop
- SQL Server (via Docker)
cd LibraryManagementAppdocker-compose up -dThis will start:
- SQL Server on port 1433
- API on ports 5000 (HTTP) and 5001 (HTTPS)
cd frontend
npm startThis will start the React frontend on http://localhost:3000
cd src/LibraryManagementApp.API
dotnet ef database update# Restore packages
dotnet restore
# Build the solution
dotnet build
# Run the API
cd src/LibraryManagementApp.API
dotnet rundotnet testGET /api/books- Get all booksPOST /api/books- Create a new book
GET /api/authors- Get all authorsPOST /api/authors- Create a new author
- Modern UI: Clean and responsive design with gradient backgrounds
- Book Management: View all books with details including authors and categories
- Author Management: View all authors with biographies
- Add Books: Form to create new books with multiple authors and categories
- Add Authors: Form to create new authors
- Responsive Design: Works on desktop and mobile devices
The application uses the following configuration:
- Database: SQL Server with connection string in
appsettings.json - CORS: Configured to allow all origins in development
- Swagger: Available at
/swaggerin development mode
LibraryManagementApp/
├── src/
│ ├── LibraryManagementApp.Domain/ # Domain entities and interfaces
│ ├── LibraryManagementApp.Application/ # CQRS commands/queries and DTOs
│ ├── LibraryManagementApp.Infrastructure/ # EF Core and repository implementations
│ ├── LibraryManagementApp.API/ # REST API controllers
│ └── tests/
│ └── LibraryManagementApp.Tests/ # Unit tests
├── docker-compose.yml # Docker services configuration
└── README.md # This file
Run the unit tests:
dotnet testThe application includes Docker support with:
- Multi-stage Dockerfile for the API
- Docker Compose for SQL Server and API services
- Volume persistence for SQL Server data
Once the application is running, visit:
- Frontend:
http://localhost:3000 - Swagger UI:
https://localhost:5001/swagger - API Base URL:
https://localhost:5001/api
To create a new migration:
cd src/LibraryManagementApp.API
dotnet ef migrations add MigrationName
dotnet ef database update- Add more CRUD operations for all entities
- Implement authentication and authorization
- Add the React frontend
- Add integration tests
- Implement caching
- Add logging and monitoring
This project is for educational purposes.