# onlyoffice/server architecture

> Architecture diagram of the GitHub repository onlyoffice/server, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/onlyoffice/server
- Repository: https://github.com/onlyoffice/server

## Overview

- Common Library/Shared Module:
– Represented by the “Common” directory.
– Contains shared configuration files, core utilities (logger, license handling, notification, RabbitMQ and ActiveMQ cores, storage interfaces, etc.).
- Document Service (DocService):
– This is the primary module that exposes document-related endpoints.
– Contains the server, routes, database connectors for different RDBMS (MySQL, PostgreSQL, Oracle, MS SQL, Dameng).
– Handles interactions with various services (e.g., WOPI for integration) and connects to external storage or messaging.
- File Converter:
– The “FileConverter” component includes logic for file and document conversion.
– Acts as a service that receives conversion requests and outputs converted files.
- Spell Checker:
– This module, found in “SpellChecker,” handles language and spellchecking services.
- Metrics Service:
– Found in “Metrics,” it collects and reports on performance and usage data.
- Ancillary Services and Third-Party Integrations:
– Messaging via RabbitMQ – both used in Common and DocService as well as explicitly existing in the source files of modules.
– Database(s) – MySQL or PostgreSQL for persistent storage; the schema directory highlights multiple database vendor sets of scripts.
– External Dependencies:
· Redis for caching.
· Other required components (Java for SDK build, Python for spellchecker modules build, etc).

##### Relationships and Interactions
- The DocService is the central orchestration layer that interacts with:
– The Common module for reusable functions and configuration.
– The various database connectors to perform CRUD operations based on client requests.
– RabbitMQ and, possibly, the ActiveMQ core from Common for asynchronous messaging and task queuing.
- FileConverter, SpellChecker, and Metrics operate as independent services or microservices.
– They may communicate with DocService via internal APIs or message queues.
– They might also access the Common module’s utilities where applicable.
- The system’s configuration is determined by several JSON files located in Common/config (for different OS and environment setups).

##### Architectural Patterns and Design Principles
- Modularity: The project is clearly split by functionality (document service, file conversion, spell checking, metrics) with a shared common library.
- Microservices/Multi-module Architectural Style: While they might run on the same machine, there is clear separation of concerns.
- Use of Dependency Injection and Reusable Libraries: The “Common” folder encapsulates shared logic and configurations used across modules.
- Database Abstraction: Each database connector is encapsulated within its own file inside “DocService/sources/databaseConnectors”, which makes it easy to support multiple relational databases.

##### Relevant Technologies, Frameworks, and Libraries
- Node.js (as the runtime environment).
- RabbitMQ and ActiveMQ (messaging and task queues).
- Various database technologies (MySQL, PostgreSQL, Oracle, SQL Server, Dameng).
- Redis (for caching).
- External tools like Java, Python, and Erlang as mentioned in the README.
- Testing frameworks (unit, integration, performance tests under “tests”).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Shared Layer
    subgraph "Shared Layer"
        Common["Common Library"]:::commonStyle
    end
    
    %% Core Orchestration Layer
    subgraph "Core Orchestration"
        DocService["Document Service"]:::docStyle
        DBConnectors["Database Connectors"]:::docStyle
    end
    
    %% Functional Services Layer
    subgraph "Functional Services"
        FileConverter["File Converter"]:::fileStyle
        SpellChecker["Spell Checker"]:::spellStyle
        Metrics["Metrics Service"]:::metricStyle
    end
    
    %% External Systems Layer
    subgraph "External Systems"
        RabbitMQ["RabbitMQ"]:::extStyle
        ActiveMQ["ActiveMQ"]:::extStyle
        Redis["Redis"]:::extStyle
        Databases["Relational Databases"]:::extStyle
    end
    
    %% Relationships between Shared Layer and Core Orchestration
    Common -->|"uses_shared"| DocService
    DocService -->|"shared_with"| Common
    
    %% Relationships from Shared Layer to Functional Services
    Common -->|"provides_utilities"| FileConverter
    Common -->|"provides_utilities"| SpellChecker
    Common -->|"provides_utilities"| Metrics
    
    %% Relationships within Core Orchestration
    DocService -->|"uses"| DBConnectors
    DBConnectors -->|"CRUD_operations"| Databases
    
    %% External integrations for Messaging and Caching
    DocService -->|"async_messaging"| RabbitMQ
    Common -->|"messaging_core"| ActiveMQ
    DocService -->|"caching"| Redis
    
    %% Functional service requests initiated by DocService
    DocService -->|"conversion_req"| FileConverter
    DocService -->|"spellcheck_req"| SpellChecker
    DocService -->|"metrics_req"| Metrics

    %% Click Events
    click Common "https://github.com/onlyoffice/server/tree/master/Common"
    click DocService "https://github.com/onlyoffice/server/tree/master/DocService"
    click FileConverter "https://github.com/onlyoffice/server/tree/master/FileConverter"
    click SpellChecker "https://github.com/onlyoffice/server/tree/master/SpellChecker"
    click Metrics "https://github.com/onlyoffice/server/tree/master/Metrics"
    click DBConnectors "https://github.com/onlyoffice/server/tree/master/DocService/sources/databaseConnectors"
    
    %% Styles
    classDef commonStyle fill:#D0EAF9,stroke:#0C5DA5,stroke-width:2px;
    classDef docStyle fill:#D2F8D2,stroke:#2D972D,stroke-width:2px;
    classDef fileStyle fill:#F9D0D0,stroke:#A50C0C,stroke-width:2px;
    classDef spellStyle fill:#FFF0B3,stroke:#E6A300,stroke-width:2px;
    classDef metricStyle fill:#FAD1E0,stroke:#DA4C91,stroke-width:2px;
    classDef extStyle fill:#E8E8E8,stroke:#777777,stroke-width:2px;
```
