Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/devdavco/backend_1/llms.txt

Use this file to discover all available pages before exploring further.

CoworkingBooking is a Spring Boot 4 REST API designed to manage the full lifecycle of coworking space reservations — from registering shared workspaces and meeting rooms to creating and tracking bookings for individual users. Built for educational and production-ready deployment scenarios alike, it provides a clean JSON interface over three core resources (Espacio, Usuario, Reserva), backed by a PostgreSQL database and fully documented via OpenAPI 3.

Key Features

Three REST Resources

Full CRUD endpoints for Espacios (spaces), Usuarios (users), and Reservas (bookings), each under its own base path (/espacios, /usuarios, /reserva).

OpenAPI / Swagger UI

Interactive API documentation generated automatically by springdoc-openapi. The raw spec is served at /api-docs and the browser UI at /swagger-ui.html.

PostgreSQL + JPA Persistence

All data is persisted in PostgreSQL via Spring Data JPA and Hibernate. SSL-enforced connections make the setup compatible with hosted providers such as Supabase out of the box.

CORS Support

Every controller carries a @CrossOrigin annotation, allowing the companion Next.js dashboard (or any approved frontend origin) to call the API directly from a browser without proxy configuration.

Global Error Handling

Service-layer exceptions are caught and surfaced as structured HTTP error responses, keeping client-side error handling predictable across all endpoints.

HikariCP Connection Pool

The embedded HikariCP pool is pre-configured with a maximum of 10 connections and schema pinning, ensuring efficient resource usage under concurrent load.

API Endpoints

The API exposes 16 public endpoints across the three resource groups:
MethodPathDescription
GET/espacios/allList all coworking spaces
GET/espacios/{id}Retrieve a space by ID
POST/espacios/createCreate a new coworking space
DELETE/espacios/eliminar/{id}Delete a space by ID
GET/espacios/pingHealth check — returns "pong"
GET/reserva/allList all reservations
GET/reserva/{id}Retrieve a reservation by ID
POST/reserva/createCreate a new reservation
PUT/reserva/update/{id}Update a reservation’s status
DELETE/reserva/eliminar/{id}Delete a reservation by ID
GET/reserva/pingHealth check — returns "pong"
GET/usuarios/allList all users
GET/usuarios/{id}Retrieve a user by ID
POST/usuarios/createCreate a new user
DELETE/usuarios/eliminar/{id}Delete a user by ID
GET/usuarios/pingHealth check — returns "pong"

Architecture Overview

CoworkingBooking follows a classic Spring layered architecture. An incoming HTTP request travels through four layers before touching the database:
HTTP Request


┌─────────────┐
│  Controller │  ← @RestController, handles routing & HTTP status
└──────┬──────┘


┌─────────────┐
│   Service   │  ← Business logic, validation, exception handling
└──────┬──────┘


┌─────────────┐
│ Repository  │  ← Spring Data JPA interface, auto-generated queries
└──────┬──────┘


┌─────────────┐
│ JPA Entity  │  ← @Entity mapped to a PostgreSQL table
└─────────────┘
The three resources managed by the API are:
ResourceBase PathDescription
Espacio/espaciosCoworking spaces and meeting rooms, including type, capacity, and post-session cleaning buffer
Usuario/usuariosRegistered users with a role (usuario or admin) and hashed password
Reserva/reservaBookings that link a user to a space with start time, user end time, total end time (including cleaning), and status
The repository also includes a companion Next.js dashboard (swagger-to-ui/) that consumes this API and provides a browser-based UI for managing spaces, users, and bookings. Configure its target API with the NEXT_PUBLIC_API_URL environment variable.

Base URL

The API runs on port 8080 by default when started locally:
http://localhost:8080
The companion Next.js dashboard reads its target API address from the NEXT_PUBLIC_API_URL environment variable, falling back to http://localhost:8080 when the variable is not set:
const API_BASE_URL = process.env.NEXT_PUBLIC_API_URL || "http://localhost:8080"
Set NEXT_PUBLIC_API_URL in your .env.local file (Next.js dashboard) or as a deployment environment variable to point the frontend at a hosted API instance.

Health Check Endpoints

Each resource group exposes a dedicated GET /ping endpoint that returns the plain string "pong". Use these to confirm the server is up and routing requests correctly before running further tests:
EndpointReturns
GET /espacios/pingpong
GET /reserva/pingpong
GET /usuarios/pingpong
curl http://localhost:8080/espacios/ping   # → pong
curl http://localhost:8080/reserva/ping    # → pong
curl http://localhost:8080/usuarios/ping   # → pong

Build docs developers (and LLMs) love