Life ConnectLife Connect
Wiki index
Architecture
Services
Concepts
Runbooks
Infra
Swagger Docs
GitHub
Wiki index
Architecture
Services
Concepts
Runbooks
Infra
Swagger Docs
GitHub
  • Backend (Java / Spring Boot)

    • adb
    • adb-persons
    • adb-parts
    • adb-contracts
    • adb-accounting
    • adb-files
    • adb-utilities
    • adb-aggregates
    • adb-views
    • adb-reports
  • Frontend

    • adb-ui
    • adb-web
  • Infrastructure & tooling

    • adb-charts
    • adb-infrastructure
    • adb-tests-artillery
    • adb-doc
  • External services (out-of-monorepo)

    • adb-tickets
    • adb-notes
    • adb-graph
Last updated 2026-05-06

adb-files

AI-generated content

This document was generated by an AI assistant. Verify accuracy before relying on the details.

Role

Document storage service: upload, download, deletion, and concatenation of files (mostly PDF). It combines AWS S3 for binaries and MongoDB for metadata (name, size, owner, tags, link to the business entity).

It is a leaf service: it never calls any other business service. Almost every other service that needs to store documents consumes it.

Tech stack

ItemValue
Spring Boot3.1.3
Java18
Port8083
DatabaseMongoDB Atlas — database adb-files
Object storageAWS S3 (bucket BUCKET_FILES)
AuthKeycloak (resource server)
Reactive stackSpring WebFlux + Reactive MongoDB
Version0.27.0-SNAPSHOT

Internal Maven modules

  • adb-files-model — exposed DTOs and entities.
  • adb-files-app — runnable Spring Boot application.
  • adb-files-client — Java client consumable by other services.

Internal architecture

flowchart TB
    Client[Client adb-*<br/>via FQDN.FILES]

    subgraph adb-files
        FC[FileController]
        FMC[FileMetadataController]
        FS[FileService]
        FMS[FileMetadataService]
        FF[FileFunction<br/>SQS Listener]
    end

    subgraph External
        Mongo[(adb-files<br/>files)]
        S3[(S3<br/>BUCKET_FILES)]
        SQS[SQS queue<br/>S3 upload trigger]
        SNS["SNS (DLQ router)"]
    end

    Client -->|POST /files| FC
    Client -->|GET /files/:id| FC
    Client -->|GET /files/metadata| FMC

    FC --> FS
    FMC --> FMS

    FS --> S3
    FS --> Mongo
    FMS --> Mongo

    S3 -.file uploaded.-> SQS
    SQS --> FF
    FF --> Mongo
    FF -.failed msg.-> SNS
    SNS -.routes to DLQ.-> SQS

Endpoints

ControllerPathRole
FileController/filesUpload, download, delete, PDF concat
FileMetadataController/files/metadataMetadata (search, listing, signed URLs)

Key endpoints

  • POST /files — multipart upload (returns a fileId).
  • GET /files/{id} — download.
  • DELETE /files/{id} — S3 + metadata deletion.
  • GET /files/pdf?ids=a,b,c — PDF concatenation of several files.
  • GET /files/metadata/list?q=... — search by tag, owner, etc.
  • GET /files/metadata/diagnostics?q=... — enriched metadata (used by adb-views).

Data model

erDiagram
    FileMetaDataEntity {
        string _id
        string s3Key
        string fileName
        string mimeType
        number size
        string ownerPersonId
        array tags
        date uploadedAt
    }

A single collection: files.

Events

Emitted

adb-files does not publish events directly — it has no Atlas trigger and no SNS publishing.

Consumed (SQS Listeners)

  • onFileUploaded — triggered by an S3 event notification: when a file is written to BUCKET_FILES, S3 sends a message to the FILES_FILE_UPLOADED_QUEUE SQS queue. The FileFunction listener picks it up and updates the MongoDB metadata accordingly.

Dead-letter (SNS → SQS DLQ)

When a listener fails to process a message, the failed message is published to the FILES_DLQ_TOPIC SNS topic, which routes it to the files SQS DLQ.

Inter-service dependencies

flowchart LR
    files[adb-files]
    s3[(AWS S3)]

    files --> s3

    persons[adb-persons] -->|GET /files| files
    contracts[adb-contracts] -->|POST/GET/DELETE /files| files
    accounting[adb-accounting] -->|POST/GET /files| files
    aggregates[adb-aggregates] -->|GET /files/metadata/list| files
    views[adb-views] -->|GET /files/metadata/diagnostics| files
    reports[adb-reports] -.via aggregates.-> files

adb-files does not call any other business service (consumes no FQDN).

Configuration / deployment

Environment variables

VariableRole
MONGO_DB_URIMongoDB connection string
SECURITY_ISSUER_URI / SECURITY_TOKEN_URIKeycloak
CLIENT_ID / CLIENT_SECRETOAuth2
AWS_REGION (eu-west-1)AWS region
AWS_ACCESS_KEY / AWS_SECRET_KEYAWS credentials
BUCKET_FILESS3 bucket (e.g. dev.files.life-connect.fr)
FILES_FILE_UPLOADED_QUEUESQS queue URL
FILES_DLQ_TOPICDead-letter SNS topic

Helm chart

Deprecated — Helm charts are no longer maintained. Infrastructure is managed via Pulumi (infra/).

adb-charts/charts/services/templates/adb-files.yaml. Image: lifeconnect/adb-files.

Links

  • Code: adb-files/
  • Functional docs: technical-epics/files/
Edit this page
Last Updated:
Contributors: Yevhenii Khudolii
Prev
adb-accounting
Next
adb-utilities