Skip to main content

How to: Set up Local Development

This guide will show you how to set up a local development environment for SyftBox.

Setting up a local development environment is important for testing your apps before publishing them or sending them to your users because it allows you to test various features without the risk of oversharing data or affecting the main network.

Requirements:

Clone the SyftBox repository

First, we need to clone the SyftBox repository.

In a terminal, run:

git clone git@github.com:OpenMined/syft.git

Structure

Since SyftBox is a network that syncs files across multiple connected clients, we'll need to spin up locally:

  • a server
  • at least 2 clients

Local Server

Inside the repository root, run the following command to spin up a server:

just run-server

You should see an output similar to this one:

Using CPython 3.12.7
Creating virtual environment at: .venv
Built syftbox @ file:///home/user/syftbox
Installed 147 packages in 204ms
2025-02-10 17:40:30.353 | INFO | syftbox.server.migrations:run_migrations:24 - Creating folders
2025-02-10 17:40:30.353 | INFO | syftbox.server.migrations:run_migrations:26 - Initializing DB
...

Don't worry if it's not exactly the same, as long as the logs start appearing it means that the local server is running ⚡️.

info

Keep the current terminal window open to keep the local server running.

Local Clients

info

Make sure you start each client in a separate terminal, as they are long-running processes.

In another terminal window, run:

just run-client alice
note

alice is an arbitrary name, you can choose any mock email addresses for the local clients.

You should see an output similar to this one:

Email      : alice@openmined.org
Client : http://localhost:0
Server : http://localhost:5001
Data Dir : .clients/alice@openmined.org
2025-02-10 17:56:09.353 | INFO | syftbox.client.core:run_syftbox:303 - Client metadata
{
"client_config": {
"data_dir": "/home/user/.clients/alice@openmined.org",
"server_url": "http://localhost:5001/",
"client_url": "http://127.0.0.1:54569/",
"email": "alice@openmined.org",
"token": null,
"client_timeout": 5.0
},
"client_syftbox_version": "0.3.5",
"python_version": "3.12.7 (main, Oct 7 2024, 23:45:10) [Clang 18.1.8 ]",
"platform": "macOS-15.3-arm64-arm-64bit",
"timestamp": "2025-02-10T15:56:09.352875Z",
"env": {
"DISABLE_ICONS": false,
"CLIENT_CONFIG_PATH": "/home/user/.syftbox/config.json"
}
}
2025-02-10 17:56:09.965 | INFO | syftbox.client.core:start:107 - Started SyftBox
2025-02-10 17:56:09.971 | INFO | syftbox.client.core:register_self:160 - Email registration successful

Then, in another terminal window, run:

just run-client bob

Again, you should see an output similar to the one above, for the user bob.

Conclusion

That's it! Now you have 3 processes running on your machine, simulating a small SyftBox network locally:

  • a sync server
  • 2 clients/peers: alice and bob

Your local file structure should reflect the newly created clients:

syftbox-repo/
├── .clients
│ ├── alice@openmined.org <-- alice's Datasite
│ │ └── ...
│ └── bob@openmined.org <-- bob's Datasite
│ └── ...
└── .server
└── ...

You can use this local setup to test your Apps, file syncing and more!