Skip to main content

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.

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.

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:
ControllerResponsibilityEndpoints
AuthControllerIssues signed JWT tokens to authenticated callersPOST /login
LibrariesControllerFull CRUD lifecycle for library recordsGET /api/libraries, GET /api/libraries/{id}, POST /api/libraries, PUT /api/libraries/{id}, DELETE /api/libraries/{id}
BooksControllerBook management scoped to a parent libraryGET /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 by IAuthenticationService; the token embeds NameIdentifier, Email, and Role claims.

LibrariesController

Provides the complete set of CRUD operations on Library 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

Manages Book 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

ComponentVersionRole
.NET SDK8.0Platform
ASP.NET Core8.0Web API framework
EF Core8.0.2ORM (data access)
Npgsql EF Core Provider8.0.2PostgreSQL driver
Microsoft.AspNetCore.Authentication.JwtBearer8.0.16JWT authentication middleware
Swashbuckle.AspNetCore (Swagger)6.5.0Interactive API documentation
xUnit + FluentAssertions2.9.3 / 5.0.0Integration 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>().

Build docs developers (and LLMs) love