A RESTful library management system built with ASP.NET Core and .NET 10. The API enables librarians to manage books, authors, categories, members, and borrowing operations, while providing authenticated access for library members.
- JWT-based authentication and role-based authorization
- Member and librarian registration
- Secure login with bearer tokens
- Book, author, and category management
- Book search with filtering, sorting, and pagination
- Loan creation and book-return tracking
- Automatic loan status handling, including overdue loans
- Member loan history
- Soft-delete and restore support for members
- Consistent validation and problem-details error responses
- OpenAPI documentation with Scalar
- Unit and integration test projects
- Register and log in
- Browse books, authors, and categories
- View their own loan history
- Manage books, authors, and categories
- Manage library members
- Create and return loans
- View and manage all loans
- Register other librarians
| Area | Route | Description |
|---|---|---|
| Authentication | /api/Authentication |
Registration and login |
| Books | /api/Books |
Browse and manage books |
| Authors | /api/Authors |
Browse and manage authors |
| Categories | /api/Categories |
Browse and manage categories |
| Members | /api/Members |
Manage members and view loan history |
| Loans | /api/Loans |
Manage borrowing and book returns |
Public read operations are available for books, authors, and categories. Management operations require a JWT token and librarian privileges.
- .NET 10
- ASP.NET Core Web API
- Entity Framework Core 10
- SQL Server
- ASP.NET Core Identity
- JWT Bearer Authentication
- FluentValidation
- ErrorOr
- OpenAPI and Scalar
- NUnit
- .NET 10 SDK
- SQL Server or SQL Server Express
- Visual Studio 2026 or another .NET-compatible IDE
Update the connection string and JWT settings in:
LibraryManagement.Api/appsettings.Development.json
For production environments, configure these values using environment variables or a secure configuration provider. Do not commit real JWT keys or database credentials to source control.
From the repository root, apply the Entity Framework Core migrations:
dotnet ef database update --project .\LibraryManagement.ApiThe development environment includes sample data for authors, categories, and books. Sample data is seeded automatically when the application runs in the Development environment.
dotnet restore
dotnet run --project .\LibraryManagement.ApiThe API is available at:
- HTTP:
http://localhost:5132 - HTTPS:
https://localhost:7145
When running in development mode, interactive API documentation is available at:
https://localhost:7145/scalar
- Register a member using
POST /api/Authentication/register. - Log in using
POST /api/Authentication/login. - Copy the returned JWT token.
- Send it with protected requests:
Authorization: Bearer <your-token>Librarian-only endpoints require a token issued to a user with the Librarian role.
Run all tests with:
dotnet testThe solution includes:
LibraryManagement.UnitTestsfor validators, mappings, request parameters, and domain behaviorLibraryManagement.IntegrationTestsfor API and database integration scenarios
LibraryManagement.Api/
├── Controllers/ # HTTP API endpoints
├── DataAccess/ # EF Core DbContext, configurations, and seed data
├── DTOs/ # Request and response models
├── Entities/ # Domain entities and roles
├── Filters/ # Validation and action filters
├── Middleware/ # Request pipeline middleware
├── Services/ # Application business logic
└── RequestParameters/ # Filtering, sorting, and pagination models
LibraryManagement.UnitTests/
LibraryManagement.IntegrationTests/
This project is available for educational and development purposes.