Architecture - Overview and request flow
This page describes the architecture of the platform as deployed with Docker Compose (srv-dev, reused for qualif and recette). Detailed per-module architecture documents are in the Software Architecture Specification.
Table of contents
Components
flowchart LR
B[Browser] -->|443| A[Apache httpd]
A -->|/cofolio| N[nginx<br/>Vue 3 SPA]
A -->|/cas| C[CAS 6.6<br/>OIDC]
C --> L[(OpenLDAP<br/>SupAnn)]
A -->|/apim| G[APISIX]
G -->|forward auth| SEC[security<br/>BFF + RBAC]
G --> API[api]
G --> BO[back-office]
G --> IO[interoperability]
API & BO & IO --> PG[(PostgreSQL 17)]
API & IO --> V[(Valkey)]
IO --> OS[(OpenSearch)]
| Component | Role |
|---|---|
| Apache httpd | TLS entry point, path-based routing |
| nginx | Serves the avenirs-cofolio-client SPA under /cofolio |
| CAS 6.6 + OpenLDAP | OIDC authentication, directory in SupAnn format |
| APISIX | API gateway exposing the backends under /apim; routes are generated from the backends’ OpenAPI (see Development Environment) |
| security | RBAC engine and OIDC BFF (see Authentication) |
| api / back-office / interoperability | Spring Boot backends, one PostgreSQL database each |
Request flow
Public traffic goes through Apache, then APISIX. For every API call, APISIX asks security to resolve the session into a signed context, which the backend trusts.
sequenceDiagram
participant U as cofolio client
participant A as Apache
participant G as APISIX
participant S as security
participant B as Backend
participant D as PostgreSQL
U->>A: /apim/... + session cookie
A->>G: proxy
G->>S: forward auth
S->>S: find session, check tokens
S-->>G: signed context
G->>B: request + signed context
B->>B: verify signature, @PreAuthorize
B->>D: read / write
B-->>U: JSON response
- The gateway identifies; the backend authorizes locally with
@PreAuthorize(hasAuthority)and does not callsecurity. - Every new endpoint needs an
operationId: APISIX routes are generated from it.
Java backends
The three backends (avenirs-portfolio-api, -back-office, -interoperability) share the libs/avenirs-portfolio-common library (Git submodule) and a hexagonal architecture, organized by business context:
flowchart LR
subgraph application
CT[adapter/controller] --> M1[mapper / dto]
end
subgraph domain
PI[port/input] --> S[service]
S --> PO[port/output]
MD[model]
end
subgraph infrastructure
R[adapter/repository, client, seeder] --> E[adapter/model<br/>JPA entities]
TS[Transactional*Service]
end
CT --> PI
PO -.implemented by.-> R
TS -.decorates.-> S
| Service | Responsibility |
|---|---|
| api | ePortfolio business API (/me/* endpoints), file storage (S3) |
| back-office | Administration, directory search, access scopes |
| interoperability | Import of the ROME 4, CASOC/CASOL and XXI repositories, indexed in OpenSearch |
Conventions:
- Domain imports are checked in CI: the domain depends on neither infrastructure nor frameworks.
- Transactions: there is no
@Transactionalin domain services. Transactions are applied by infrastructure decorators namedTransactional*Service(e.g.TransactionalDeclaredActivityService). A new service that writes to the database needs its own decorator. - Domain services are wired by
*ServiceConfigclasses. - One database per service (
avenirs_api,avenirs_back_office,avenirs_interoperability), schemadev. Liquibase is disabled at runtime: migrations are applied separately (npm run db:update-allin srv-dev). - Stack: Java 25, Spring Boot 4.1.
Data
| Store | Usage |
|---|---|
| PostgreSQL 17 | One database per service |
| Valkey | Cache (api, interoperability) |
| OpenSearch | Repository indexes (interoperability) |
| Files | S3 (api): the only supported storage |
Repositories
| Repository | Content |
|---|---|
| srv-dev | Docker Compose, overlays, bootstrap scripts, submodules (details) |
| avenirs-portfolio-api / -back-office / -interoperability / -security | Spring Boot backends |
| avenirs-cofolio-client | Vue 3 client (Vite, Pinia, TanStack Query, OpenAPI client generated by Orval) |
| avenirs-deployment | Deployment scripts on the VMs (details) |
| avenirs-workflows | Shared CI/CD (details) |