Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ARCHITECTURE.md #2

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions ARCHITECTURE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Architecture
Bottles is a project that aims to run Windows applications on Linux and macOS using Wine.

This document is an overview of the architecture of the project and how the components interact with each other, it aims to lower the entry barrier for new contributors and help them understand the project's structure.

## Components
We decided to split the project into multiple components to make it easier to maintain and develop new features, each component has a specific role and interacts with other components to achieve the project's goal.

- **Client(s)**: Responsible for rendering the user interface and handling user interactions.
- **Server**: Responsible for handling requests from the client and interacting with the database.
- **Core**: Responsible for handling the logic of the application.
- **WineBridge**: Responsible for interacting with the Windows API within the Wine prefix.

# Overview
The following diagram shows the main components of the project and how they interact with each other.

![[resources/Diagram.png]]

Every component in this project is written in Rust, except for the Client, which can be written in any language that has [gRPC support](https://grpc.io/docs/languages/)

## Client
The client is a desktop application. The client communicates with the server using [gRPC](https://grpc.io/) calls.

If the client is written in Rust, the option to call the `core` library directly is available.

## Server
The server is a [gRPC](https://grpc.io/) server that handles requests from the client.

The server talks to WineBridge to interact with the Windows API.

- Uses gRPC for communication between the client and the server.
- Uses Tonic as a gRPC framework.

## Core
The core is a library that contains the logic of the application. The core is used by the server to handle requests from the client.

## WineBridge
WineBridge is a server that runs within the Wine prefix and interacts with the Windows API.
It listens for requests from the server via [Named Pipes](https://learn.microsoft.com/en-us/windows/win32/ipc/named-pipes) and forwards them to the corresponding Windows API calls.

- Uses [windows-rs](https://crates.io/crates/windows) to interact with the Windows API.
19 changes: 19 additions & 0 deletions resources/Diagram.canvas
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"nodes":[
{"id":"63220de64212e86b","x":220,"y":-1300,"width":460,"height":380,"color":"5","type":"group","label":"Wine Prefix"},
{"id":"6c1d51187d4b773b","type":"text","text":"## Client\n> Binary\n\nCalls the core library if written in Rust.","x":280,"y":-520,"width":340,"height":160,"color":"2"},
{"id":"9d540db2f16f7106","type":"text","text":"## Core library\n> Library\n\nCore library for Bottles","x":280,"y":-800,"width":340,"height":160,"color":"1"},
{"id":"2e25cd35976782ee","type":"text","text":"## Server\n> Binary\n\nExecutes the gRPC server","x":-300,"y":-800,"width":340,"height":160,"color":"6"},
{"id":"c60a702a1ffbfac9","type":"text","text":"## Client\n> Binary\n\nCalls the server via gRPC.","x":-300,"y":-520,"width":340,"height":160,"color":"4"},
{"id":"563f7be933877fe8","x":390,"y":-1015,"width":120,"height":62,"color":"#9def06","type":"text","text":"### FIFO"},
{"id":"ea430dd65523a433","type":"text","text":"## WineBridge\n> Binary\n\nRuns commands on Windows.","x":280,"y":-1262,"width":340,"height":133,"color":"3"}
],
"edges":[
{"id":"a966ff3b996f6017","fromNode":"c60a702a1ffbfac9","fromSide":"top","toNode":"2e25cd35976782ee","toSide":"bottom"},
{"id":"dc357ea72c6ba1ac","fromNode":"2e25cd35976782ee","fromSide":"bottom","toNode":"c60a702a1ffbfac9","toSide":"top","label":"gRPC call"},
{"id":"6a2aec62740ac944","fromNode":"6c1d51187d4b773b","fromSide":"top","toNode":"9d540db2f16f7106","toSide":"bottom","label":"Method call"},
{"id":"696f36f46930beb8","fromNode":"2e25cd35976782ee","fromSide":"right","toNode":"9d540db2f16f7106","toSide":"left","label":"Method call"},
{"id":"68b938df34dcd9a4","fromNode":"ea430dd65523a433","fromSide":"bottom","toNode":"563f7be933877fe8","toSide":"top","label":"Reads"},
{"id":"f91e274437878a32","fromNode":"9d540db2f16f7106","fromSide":"top","toNode":"563f7be933877fe8","toSide":"bottom","label":"Writes"}
]
}
Binary file added resources/Diagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.