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.

What is CalenderyBack?

CalenderyBack is the backend service powering a social calendar application. It is built with Spring Boot 4 on Java 21 and exposes a combined REST + WebSocket API that handles everything from user accounts and publications to real-time chat.
AttributeValue
FrameworkSpring Boot 4.0.3
LanguageJava 21
ArchitectureHexagonal (Ports & Adapters)
DatabasePostgreSQL (via Spring Data JPA / Hibernate)
File StorageSupabase Storage (profile avatars bucket)
SecuritySpring Security — HTTP Basic authentication
Real-timeSTOMP over WebSocket (/ws-endpoint)
EmailSpring Mail (SMTP / Gmail)

Functional Domains

CalenderyBack is organised into six cohesive functional domains, each with its own package tree under com.rubenmartin.calenderyback:
DomainResponsibility
UsersRegistration, authentication, profile settings, avatar upload, public-key exchange
PublicationsCreate, read, and manage social calendar posts
Comments & LikesThreaded comments and like reactions on publications
FollowersSocial graph — follow/unfollow, follower counts, feed curation
ChatPeer-to-peer chat rooms created between two users
MessagesIndividual messages within a chat, delivered in real-time over WebSocket

Architecture Overview

CalenderyBack follows the hexagonal (ports-and-adapters) architecture: the domain layer has no dependency on the framework layer, and all cross-layer communication flows through well-defined interfaces.

Layer breakdown

┌──────────────────────────────────────────────────────┐
│  Infrastructure (API / DB)                           │
│  ┌──────────────────┐   ┌────────────────────────┐  │
│  │  REST Controllers │   │  JPA Repository Impls  │  │
│  └────────┬─────────┘   └──────────┬─────────────┘  │
│           │                        │                  │
│  ┌────────▼────────────────────────▼─────────────┐   │
│  │  Application Layer  (Commands / Queries)       │   │
│  │  dispatched through the Mediator               │   │
│  └────────────────────────┬──────────────────────┘   │
│                           │                           │
│  ┌────────────────────────▼──────────────────────┐   │
│  │  Domain  (Entities, Value Objects, Ports)      │   │
│  └───────────────────────────────────────────────┘   │
└──────────────────────────────────────────────────────┘

Mediator pattern

All application-layer operations — whether commands (writes) or queries (reads) — are dispatched through a central Mediator bean. Each operation is encapsulated in a Request object and handled by a dedicated RequestHandler:
// Dispatch a query from any controller
GetUserByIdResponse response = mediator.dispatch(new GetUserByIdRequest(id));

// The Mediator routes to the matching handler at startup
public <R, T extends Request<R>> R dispatch(T request) {
    RequestHandler<T, R> handler =
        (RequestHandler<T, R>) requestHandlerMap.get(request.getClass());
    if (handler == null)
        throw new RuntimeException("No handler found for " + request.getClass());
    return handler.handle(request);
}
This means adding a new feature requires only a new Request + RequestHandler pair — the controller and the mediator wiring need no changes.

Authentication Model

CalenderyBack uses HTTP Basic authentication managed by Spring Security.
  • Public routes (no credentials required): registration, email confirmation, token resend, user validation.
  • Protected routes (/api/users/app/**, /api/publication/app/**, /api/chat/**, /ws-endpoint/**): require ROLE_USER.
  • Ownership-guarded routes: sensitive endpoints additionally use @PreAuthorize to verify the authenticated user matches the resource owner.
See the Authentication guide for full details and curl examples.

Real-time Capability

Chat messages are delivered in real-time using STOMP over WebSocket, mounted at /ws-endpoint. The WebSocket layer is secured by the same Spring Security filter chain — only ROLE_USER principals may connect. Clients subscribe to per-chat topics and receive pushed message events without polling.

Key Dependencies

LibraryPurpose
spring-boot-starter-webmvcREST API
spring-boot-starter-securityHTTP Basic auth, method-level security
spring-boot-starter-data-jpaORM / database access (PostgreSQL)
spring-boot-starter-websocketSTOMP / WebSocket real-time messaging
spring-boot-starter-mailEmail verification on registration
spring-boot-starter-validationBean Validation (@NotBlank, @Valid)
mapstruct 1.6.2DTO ↔ domain / entity mapping
lombokBoilerplate reduction (@Data, etc.)

CalenderyBack follows the hexagonal (ports-and-adapters) architecture pattern. Domain entities and business rules live in the domain package and are completely framework-free. The application layer contains use-case commands and queries. The infrastructure layer provides JPA implementations and REST controllers — both of which are treated as adapters that plug into the domain ports. This separation ensures the core business logic can be tested in isolation without loading the Spring context.

Explore the Docs

Quickstart

Run the server locally, register a user, confirm your email, and make your first authenticated API call in five steps.

Authentication

Understand HTTP Basic auth, the registration + email verification flow, public vs protected routes, and public-key exchange.

Architecture Concepts

Dive deeper into the hexagonal architecture, the Mediator pattern, and how commands and queries are structured.

API Reference

Full endpoint reference for all six domains: Users, Publications, Comments & Likes, Followers, Chat, and Messages.

Build docs developers (and LLMs) love