self-hosting made effortless
pip install syft-serve
import syft_serve as ss
import requests
def hello():
return "Hi!"
server = ss.create("my_api", {"/": hello})
requests.get(server.url).text
self-hosting should be effortless
Not your computer, not your control. Cloud providers can change terms, raise prices, or shut down your app anytime.
Self-hosting means wrestling with configs, ports, and processes. Complexity keeps you dependent on cloud APIs.
Self-hosting should be a 1-liner behind the scenes. With syft-serve, your own server is just one function call away.
self-hosting can be effortless
Here's what syft-serve does for you
# You write:
server = ss.create("my_api", {"/predict": my_function})
# Behind the scenes:
# ✓ Spins up isolated Python environment
# ✓ Installs your dependencies safely
# ✓ Generates production-ready FastAPI code
# ✓ Manages server process lifecycle
# ✓ Streams logs for easy debugging
# ✓ Cleans up everything when done
# No orphan processes. No port conflicts. No hassle.
Everything you need, nothing you don't
import syft_serve as ss
# Basic usage
server = ss.create("my_api", {"/hello": hello_func})
# Full control
server = ss.create(
name="my_api",
endpoints={"/predict": predict, "/train": train},
dependencies=["numpy", "pandas"],
port=8080,
expiration_seconds=3600, # Auto-cleanup
force=True # Replace existing
)
# List all servers
servers = ss.list()
# Get specific server
server = ss.get("my_api")
# Access server properties
server.url # http://localhost:8080
server.endpoints # ["/predict", "/train"]
server.status # "running"
server.uptime # "2h 15m"
# Stream logs in real-time
server.stdout.follow()
# Get recent logs
server.stdout.tail(20)
server.stderr.tail(20)
# Check environment
server.env.packages # Installed packages
server.env.python # Python version
# Graceful shutdown
server.terminate()
# Force kill if needed
server.force_terminate()
# Clean up all servers
ss.terminate_all()
# Auto-expiring servers
ss.create("temp_api", endpoints,
expiration_seconds=300) # 5 min