This project demonstrates a simple distributed system built with .NET 8 Minimal API. It uses a master–followers architecture, where:
- The master node accepts write requests
- Updates are represented as JSON Patch operations
- The master applies the patch locally and propagates it to all followers
- Followers apply the same patch to keep state consistent
- A simple vector clock is used to prevent stale updates
- Master node — receives PATCH requests and broadcasts them
- Follower nodes — receive updates only from the master
- All nodes run the same application image
- Roles and topology are configured via
appsettings.jsonand environment variables
-
/
Returns a simple status message:"Server started!" -
/get
Returns the current JSON state stored on the node. -
/replace
Applies a single JSON Patch operation to the current state.
On the master node, the patch is also forwarded to all followers. -
/vclock
Returns the current vector clock (logical timestamps per source). -
/test
Simple HTML UI for manual testing of/replaceand/get.
The request contains:
- Source — identifier of the request sender
- ID — monotonically increasing logical timestamp
- Payload — a single JSON Patch operation (RFC 6902)
{
"Source": "Dyagilev",
"ID": 1,
"Payload": "{'op': 'add', 'path': '/hello', 'value': { 'name': 'Ginger' }}"
}{
"op": "add",
"path": "/user",
"value": { "name": "Alice" }
}{
"op": "replace",
"path": "/user/name",
"value": "Bob"
}{
"op": "remove",
"path": "/user"
}The system is designed to run using Docker Compose. One container acts as the master, and multiple containers act as followers.
-
Clone the repository:
git clone https://github.com/GeorgeD615/DistributedSystemAPI.git -
Navigate to the project directory:
cd DistributedSystemAPI -
Build and start all services:
docker compose up --build -
Open the master node in a browser:
http://localhost:3000
- Master:
http://localhost:3000 - Follower 1:
http://localhost:3001 - Follower 2:
http://localhost:3002 - Follower 3:
http://localhost:3003
- The system demonstrates eventual consistency
- JSON Patch operations are applied in order using logical clocks
- This project is intended for educational purposes