## 4 System Design
### Microservices  
Scaling the system as an individual process is not particularly necessary, since it is possible to isolate and scale the functionality. This pattern is known as microservices and implies dividing a single application into multiple smaller stand-alone individualapplications that communicate with each other over the network [35; 36]. This type of architecture has several benefits:  
1. Scalability: Independent services can be scaled individually, optimizing resource allocation. 2. Flexibility: Enables faster development and deployment cycles with each service developed, deployed, and scaled independently. 3. Fault isolation: Failures in one microservice instance do not affect the entire system, enhancing reliability. 4. Technology diversity: Allows the use of different technologies for different services, optimizing for specific needs. 5. Easy maintenance: Easier to maintain and update as changes to one service do not necessarily impact others. 6. Continuous delivery and integration: Supports continuous integration and delivery practices, facilitating a more streamlined development process. 7. Resilience: Improved fault tolerance and resilience due to the distributed nature of services. 8. Autonomy: Teams can work independently on different services, fostering autonomy and speeding up development. 9. Better resource utilization: Efficient use of resources as each microservice can be optimized for its specific task. The microservices pattern is more suitable because it allows independent scaling and control over the pieces of functionality that produce higher traffic and computing overhead [38]. As an organization rule, the overall server-side functionality will be divided into multiple independent smaller and self-contained services. Each application will expose a specific set of functionalities (API--Application Programming Interface--a series of exposed calls to the system). Based on the known requirements, we can identify several microservices. Documents API is a module for handling the actual document creation and basic manipulation of all the resources besides the document content. Document Manipulation API is an API designated for handling collaboration sessions in real-time between the users and responsible for storing the data generated in the sessions. Notifications API means that the application will have a channel for delivering notifications to users in real-time mode whenever possible and offline capabilities for storage and late delivery. Any system requires a series of utility modules/microservices. Certain functionalities will naturally require child services that will solve very specific tasks. For example: the real-time document manipulation API will handle document content editing. Serving a considerable number of peers over the network imposes another challenge: supporting multiple consumers. To respect the microservices pattern, specific pieces of work should be delegated to individual microservices for better scaling and reusability. By this rule, a real-time client communication API can be introduced. This module will be dedicated to handling the open connections between the server and clients. This microservice will serve to produce events based on user interaction. Naturally, when having a series of smaller self-container applications that need to work together to achieve a final goal, a question occurs: How will a client interact with those applications? In such instances, where a client needs to interact with external services, the easiest approach is to introduce a single point of entry. It presents the following advantages:  
1. The client implementation does not need to know about the specifics of the services providing the functionality. A single point of entry can \"hide\" all the building blocks from the client and provide only what is necessary. 2. A single point of entry facilitates global operations like monitoring, logging, authorization, etc. 3. Provides routing to the needed functionality. Such an application entry-point is called the API Gateway [39].