Data layer
AI-generated content
This document was generated by an AI assistant. Verify accuracy before relying on the details.
ADB combines four distinct stores. Each one has a specific role and is consumed by a subset of the services.
flowchart LR
subgraph Services
persons[adb-persons]
parts[adb-parts]
contracts[adb-contracts]
accounting[adb-accounting]
files[adb-files]
utilities[adb-utilities]
views[adb-views]
reports[adb-reports]
aggregates[adb-aggregates]
end
subgraph Mongo[MongoDB Atlas]
m_persons[(adb-persons)]
m_parts[(adb-parts)]
m_contracts[(adb-contracts)]
m_accounting[(adb-accounting)]
m_files[(adb-files)]
m_utilities[(adb-utilities)]
m_views[(adb-views)]
m_reports[(adb-reports)]
end
s3[(AWS S3)]
neo4j[(Neo4j)]
persons --> m_persons
parts --> m_parts
contracts --> m_contracts
accounting --> m_accounting
files --> m_files
files --> s3
utilities --> m_utilities
views --> m_views
reports --> m_reports
aggregates -.reads via HTTP.-> persons
aggregates -.reads via HTTP.-> parts
aggregates -.reads via HTTP.-> contracts
adbgraph[adb-graph<br/>deprecated] --> neo4j
1. MongoDB Atlas
All business data lives in MongoDB Atlas, a managed multi-environment cluster (adb-development, adb-integration, adb-production). Each service has its own database (adb-<service>): no cross-service joins — data is propagated via HTTP or events. Exception: adb-aggregates has no own database — it fetches data directly from other services at query time
Databases and collections
| Database | Service | Main collections |
|---|---|---|
adb-persons | adb-persons | persons, organization, invitations, company_settings |
adb-parts | adb-parts | parts, assets, charges, budget_lines, sales |
adb-contracts | adb-contracts | contracts, propose_contracts, direct_debits, template_values |
adb-accounting | adb-accounting | invoices, payments, accounting_entries, accounting_events, journals, ledger_account, ledger_auxiliary_accounts, fiscal_year, rental_allowance_statements, tenant_rental_allowances, serial, accounting_sequence, transaction_reads, configurations, resume_token, accounting_event_fallback |
adb-files | adb-files | files (metadata) |
adb-utilities | adb-utilities | allocationkeys, configurations, dashboards, catalog, indexes, notifications, notification_definitions, serials |
adb-views | adb-views | parts, contracts_entries, accounting_event (denormalized projections) |
adb-reports | adb-reports | templates, template_meta_data |
adb-views hosts denormalized projections kept up to date by SQS listeners — this is intentional, to serve dashboards quickly.
Connection
Each service reads its connection string from the MONGO_DB_URI variable (format mongodb+srv://...). Credentials come from Kubernetes secrets.
Reactive stack
Access goes through Spring Data MongoDB Reactive (ReactiveMongoRepository). Services avoid any blocking call; BlockHound is enabled in cloud environments for adb-views and adb-accounting to detect blocking calls at runtime.
2. AWS S3
Two main buckets:
| Bucket | Variable | Main service | Content |
|---|---|---|---|
{ENV_NAME}.files.life-connect.fr | BUCKET_FILES | adb-files | User-uploaded documents |
{ENV_NAME}.templates.life-connect.fr | BUCKET_TEMPLATES | adb-views, adb-reports, adb-contracts, adb-accounting | FreeMarker templates, PDF templates |
adb-files issues pre-signed S3 URLs for direct uploads and downloads from the browser (avoiding a round-trip through the Java service).
3. Neo4j
⚠️ Deprecated — adb-graph is shut down and Neo4j is no longer in use.
The adb-graph service (out-of-monorepo) maintains a graph of the relationships between persons, parts, contracts and tickets. It is fed by RabbitMQ events (persons.graph, parts.graph, contracts.graph, tickets.graph).
Helm/Terraform for Neo4j: see adb-charts/terraform/ and the scripts under adb-charts/scripts/cypher_r4.cypher.
4. Messaging — AWS SQS / SNS
Detailed in Service-to-service communication §4. Single region: eu-west-1. Queues are named by convention <env>-<service>-<event> (e.g. dev-views-contract-modified-queue).
Each service has:
- One SNS topic per emitted event type.
- One DLQ (
<env>-<service>-dlq) for unprocessed messages.
Migrations / setup scripts
adb-infrastructure/mongodb-atlas/data-scripts/ contains around 37 migration and setup scripts. Tooling: MongoDB Atlas CLI + Realm CLI. No Terraform yet — managed manually or through the CLI.
Common environment variables
| Variable | Role |
|---|---|
MONGO_DB_URI | MongoDB Atlas connection string |
AWS_REGION | eu-west-1 |
AWS_ACCESS_KEY / AWS_SECRET_KEY | AWS credentials (S3 + SQS/SNS) |
BUCKET_FILES | S3 bucket for documents |
BUCKET_TEMPLATES | S3 bucket for templates |
<SERVICE>_<EVENT>_QUEUE | URL of each consumed SQS queue |
<SERVICE>_DLQ_TOPIC | Service DLQ |