Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Rubick65/calenderyBack/llms.txt

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

This guide walks you through cloning the repository, starting the server, and making your first authenticated API request from scratch.
1

Prerequisites

Make sure the following tools are installed and available on your PATH before continuing:
RequirementVersion / Notes
Java21 (the Dockerfile uses eclipse-temurin:21-jre-jammy)
Maven3.9+ (or use the included ./mvnw wrapper)
PostgreSQLAny recent version; a local instance or a managed cloud DB
DockerOptional — for a fully containerised setup
Supabase projectNeeded for profile-photo storage (avatars bucket)
Verify your Java version:
java -version
# openjdk version "21.0.x" ...
2

Clone and Configure

Clone the repository and set the required environment variables.
git clone https://github.com/Rubick65/calenderyBack.git
cd calenderyBack
CalenderyBack reads all sensitive values from environment variables. Export them in your shell (or add them to a .env file / IDE run configuration):
# PostgreSQL connection
export DATA_BASE_URL=jdbc:postgresql://localhost:5432/calendery
export DATA_BASE_USERNAME=your_db_user
export DATA_BASE_PASSWORD=your_db_password

# Supabase Storage (profile photo uploads)
export SUPABASE_URL=https://<your-project-ref>.supabase.co
export SERVICE_KEY=your_supabase_service_role_key
The full mapping in application.yaml is:
spring:
  datasource:
    url: ${DATA_BASE_URL}
    username: ${DATA_BASE_USERNAME}
    password: ${DATA_BASE_PASSWORD}
    driver-class-name: org.postgresql.Driver
  jpa:
    hibernate:
      ddl-auto: update   # schema is created/updated automatically
ddl-auto: update means Hibernate will create or alter tables automatically on first start. You do not need to run any SQL migration scripts manually for local development.
3

Run the Server

Option A — Maven wrapper (recommended for development)
./mvnw spring-boot:run
The server starts on port 8080. You should see Spring Boot’s startup banner and then log output at WARN level (configured in application.yaml).Option B — Docker (multi-stage build)The project ships a two-stage Dockerfile that builds the JAR and packages it into a slim JRE image:
# Build the image
docker build -t calenderyback:latest .

# Run it, passing in your environment variables
docker run -p 8080:8080 \
  -e DATA_BASE_URL=jdbc:postgresql://host.docker.internal:5432/calendery \
  -e DATA_BASE_USERNAME=your_db_user \
  -e DATA_BASE_PASSWORD=your_db_password \
  -e SUPABASE_URL=https://<project-ref>.supabase.co \
  -e SERVICE_KEY=your_service_key \
  calenderyback:latest
The container JVM is tuned for containerised environments:
-XX:+UseContainerSupport
-XX:MaxRAMPercentage=75.0
-XX:+OptimizeStringConcat
Confirm the server is healthy:
curl -i http://localhost:8080/api/users/auth/validateUser?email=nonexistent@example.com
# HTTP/1.1 404 or 200 — server is responding
4

Register a User

Registration is a two-step process: submit the registration form, then click the confirmation link that arrives by email.Step 4a — Submit registrationPOST /api/users/auth/register is a public endpoint (no credentials required). Send a JSON body matching the UserDto shape:
curl -i -X POST http://localhost:8080/api/users/auth/register \
  -H "Content-Type: application/json" \
  -d '{
    "nombre":   "Alice Example",
    "email":    "alice@example.com",
    "keypass":  "s3cr3tP@ss!"
  }'
Expected response 200 OK:
{
  "idUsuario": 1,
  "roles": ["ROLE_USER"]
}
A verification email is sent to alice@example.com containing a link with a token query parameter.Step 4b — Confirm the email token
curl -i "http://localhost:8080/api/users/registrationConfirm?token=<TOKEN_FROM_EMAIL>"
Expected response 200 OK (empty body). The account is now enabled and can authenticate.
Until the token is confirmed the account remains disabled. Attempting to authenticate with a disabled account returns HTTP 401 Unauthorized.
5

Make an Authenticated Request

CalenderyBack uses HTTP Basic authentication. Pass email:password base-64-encoded in every request to a protected route.Step 5a — Login (verify your credentials)POST /api/users/auth/login returns your user information and roles:
curl -i -X POST http://localhost:8080/api/users/auth/login \
  -u "alice@example.com:s3cr3tP@ss!"
Expected response 200 OK:
{
  "idUsuario": 1,
  "roles": ["ROLE_USER"]
}
Step 5b — Call a protected endpointGET /api/users/app/getUserSettings requires ROLE_USER and additionally checks that the idUsuario parameter matches the authenticated principal (ownership guard via @PreAuthorize):
curl -i \
  -u "alice@example.com:s3cr3tP@ss!" \
  "http://localhost:8080/api/users/app/getUserSettings?idUsuario=1"
Expected response 200 OK:
{
  "nombre":     "Alice Example",
  "fotoPerfil": "https://<project>.supabase.co/storage/v1/object/sign/Avatares/...",
  "descripcion": null
}
You’re authenticated! From here you can explore publications, followers, and the real-time chat via the WebSocket endpoint at ws://localhost:8080/ws-endpoint.

What’s Next?

Authentication deep-dive

Learn about disabled-account handling, token resend, public-key exchange, and route protection rules.

Introduction

Architecture overview, functional domains, and the Mediator pattern explained.

Build docs developers (and LLMs) love