LibraryService API is a RESTful web service built with .NET 8 and ASP.NET Core 8 for managing a library catalogue — libraries and their associated books. It exposes a structured set of HTTP endpoints secured with JWT Bearer authentication, persists data through EF Core 8 via the Npgsql provider to a PostgreSQL database (hosted on Supabase), and ships with interactive Swagger / OpenAPI documentation out of the box.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/marchena96/Paradigma-lab1/llms.txt
Use this file to discover all available pages before exploring further.
Quickstart
Clone the repo, configure credentials, and have the API running locally in under 5 minutes.
API Reference
Full reference for every endpoint across the Libraries, Books, and Auth controllers.
Architecture
Layered design, EF Core context, hosting model, and the middleware pipeline explained.
Authentication
How JWT tokens are issued, validated, and used to protect endpoints.
What it provides
LibraryService API is organized into three controllers, each responsible for a distinct area of the domain:| Controller | Responsibility | Endpoints |
|---|---|---|
AuthController | Issues signed JWT tokens to authenticated callers | POST /login |
LibrariesController | Full CRUD lifecycle for library records | GET /api/libraries, GET /api/libraries/{id}, POST /api/libraries, PUT /api/libraries/{id}, DELETE /api/libraries/{id} |
BooksController | Book management scoped to a parent library | GET /api/libraries/{libraryId}/books, POST /api/libraries/{libraryId}/books |
AuthController
Accepts an email/password payload and returns a signed HS256 JWT valid for one hour. All credential validation is handled byIAuthenticationService; the token embeds NameIdentifier, Email, and Role claims.
LibrariesController
Provides the complete set of CRUD operations onLibrary records. Every library has a name and a location. Deleting a library cascades to all of its associated books at the database level (foreign key ON DELETE CASCADE defined in the InitialCreate migration).
BooksController
ManagesBook entities always in the context of a specific library (identified by {libraryId} in the route). Both endpoints validate that the parent library exists before proceeding; a missing library yields 404.
Tech stack
| Component | Version | Role |
|---|---|---|
| .NET SDK | 8.0 | Platform |
| ASP.NET Core | 8.0 | Web API framework |
| EF Core | 8.0.2 | ORM (data access) |
| Npgsql EF Core Provider | 8.0.2 | PostgreSQL driver |
| Microsoft.AspNetCore.Authentication.JwtBearer | 8.0.16 | JWT authentication middleware |
| Swashbuckle.AspNetCore (Swagger) | 6.5.0 | Interactive API documentation |
| xUnit + FluentAssertions | 2.9.3 / 5.0.0 | Integration test runner and assertions |
| Supabase (PostgreSQL 15) | — | Cloud-hosted database |
LibraryService API uses the classic
Program.cs + Startup.cs hosting model, not the .NET 6+ Minimal API style. Program.cs builds the generic host with Host.CreateDefaultBuilder and delegates all service registration and pipeline configuration to Startup.cs via webBuilder.UseStartup<Startup>().