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 that lets you manage libraries and their book collections. Built with ASP.NET Core 8, it provides JWT-secured endpoints for full CRUD operations on libraries and books, backed by a PostgreSQL database (Supabase) via Entity Framework Core 8.

Quickstart

Clone the repo, configure credentials, and have the API running locally in minutes.

API Reference

Browse all endpoints — Libraries, Books, and Authentication — with request and response details.

Architecture

Understand the layered design, data model, and how services are wired together.

Authentication

Learn how JWT tokens are issued and how to pass them in secured API calls.

Key Features

CRUD for Libraries & Books

Full create, read, update, and delete operations on both resources with proper HTTP status codes.

JWT Bearer Auth

HS256-signed tokens issued at POST /login, validated on protected endpoints.

EF Core + PostgreSQL

Entity Framework Core 8 with Npgsql, automatic migrations on startup, and cascade-delete for books.

Integration Tests

xUnit test suite using SQLite in-memory via WebApplicationFactory — no live database required for tests.

Swagger UI

Interactive API explorer available at /swagger in the Development environment.

Dependency Injection

Services registered in Startup.csILibrariesService, IBooksService, and IAuthenticationService.

Get Started

1

Clone the repository

git clone https://github.com/marchena96/Paradigma-lab1.git
cd Paradigma-lab1
2

Configure the database connection

Register your PostgreSQL credentials as .NET User Secrets so they never appear in source control:
cd HackerRank1
dotnet user-secrets set "ConnectionStrings:DefaultConnection" \
  "Host=<host>;Port=5432;Database=postgres;Username=<user>;Password=<password>;SSL Mode=Require;Trust Server Certificate=true;Pooling=false"
3

Build and run

dotnet clean && dotnet restore && dotnet run --project HackerRank1
The API starts at https://localhost:7098. Open https://localhost:7098/swagger to explore the endpoints interactively.
4

Obtain a JWT token and make your first request

curl -s -X POST https://localhost:7098/login \
  -H "Content-Type: application/json" \
  -d '{"email":"admin","password":"1234"}' | jq .token
Use the returned token as a Bearer credential for protected endpoints.
The API compiles without credentials, but the startup migration will fail without a valid PostgreSQL connection string. Follow the Quickstart for full setup instructions.

Build docs developers (and LLMs) love