Running a Server
In this guide, we'll walk you through the process of running a server on your EdgeOS device. We'll be using the Hummingbird, a popular and lightweight Swift web server framework to run on your EdgeOS device. There are many times you want to communicate with your EdgeOS device over traditional web protocols like HTTP, and Hummingbird is a great way to do that.
You'll need to make sure your that your EdgeOS is discoverable on your network. But while you have your EdgeOS device connected to your computer over USB, it'll be discoverable over a local IP address.
Step 1: Create a new project
macOS
mkdir HummingBirdServerExample
cd HummingBirdServerExample
edge init
Now your favorite editor (we highly recommend VSCode, Cursor, or Windsurf with the Edge VSCode Extension) and open the project.
Step 2: Open the project in your favorite editor
macOS
code .
# or
cursor .
# or
windsurf .
Step 3. Add the Hummingbird package
Open up Package.swift
and add the following dependencies:
Package.swift
platforms: [
.macOS(.v15), // a requirement for compiling Hummingbird on macOS
],
dependencies: [
.package(url: "https://github.com/hummingbird-project/hummingbird.git", from: "2.15.0"),
],
targets: [
.target(
name: "HummingBirdServerExample",
dependencies: [
.product(name: "Hummingbird", package: "hummingbird"),
],
),
],
Step 4. Open the main.swift
file
The edge init
command will create a main.swift
file for you. Open it in your favorite editor you should see the following code:
main.swift
import Hummingbird
// Create a router and add a simple route
let router = Router()
router.get("/") { request, context in
"Hello, World!"
}
// Create and configure the application
let app = Application(
router: router,
configuration: .init(address: .hostname("0.0.0.0", port: 9080))
)
// Run the server
try await app.run()
It's important that your hummingbird server is running on 0.0.0.0
and not localhost
or 127.0.0.1
. This is because your EdgeOS device is not on the same network as your Macbook. So you'll need to access your server from the outside world and 0.0.0.0
is the same as localhost
but it's accessible from the outside world.
Step 5. Run the server on your EdgeOS device
First make sure your EdgeOS device is set as your active device. Open up your VSCode Edge Extension and look for your the "DEVICES" panel, and click on the EdgeOS device to make the active one.

EdgeOS
edge run
Next debug and run your server on your EdgeOS device.

Step 6. Test your server
While on your Macbook. Open up your browser and navigate to http://edgeos-device.local:9080
. You should see the following output:

Congratulations!
You've successfully run a server on your EdgeOS device. You can now start building your own server applications. So long as your device is on the same network as your Macbook, you can access your server locally! You've now made a full fledge edge computing web server accessible outside of a data center!