Quick Start
Get introduced to the Everywhere Computer’s core concepts while using the every cli
to write and run custom functions on your local machine:
Run Your First Function
Clone down our custom TypeScript functions repo. In the src/functions
directory you’ll find four very basic functions:
add.ts
- adds two numbers togetherconcat.ts
- concatenates two stringshello.ts
- a simplehello ${world}
message-and-number.ts
- concatenates together a string and a number
Boot Up The Everywhere Computer
Let’s begin with hello.ts
. From the root directory of the repository run:
This should produce an output like the following in your terminal:
Everything is now ready to run your function:
- The function has been compiled to WebAssembly (Wasm) which is the Everywhere Computer’s native format.
- A local Homestar node is running — these are what power the Everything Computer.
- A local instance of the Control Panel is running so that we can interact with our local Homestar node.
- A Cloudflare tunnel has been opened, enabling your function to be called over the public internet via an HTTP Gateway.
Run hello
From The Control Panel
Visit your local Control Panel at https://control.everywhere.computer. You should see the following interface:
Enter a name and hit the “Run” button. You should see your first result!
You may have noticed it took a moment to compile the result. Because of the Everywhere Computer’s memoization, that result is now cached. If you hit run again, it should be nearly instantaneous — we skipped straight to the result.
Run hello
From Your Phone
Take out your phone and scan the QR code from your terminal. This will open the Cloudflare tunnel on your device.
Append hello?name=Gary
to the url (eg. https://YOUR-TUNNEL-URL/hello?name=test). Because of the content type of the response, your browser will likely download (or prompt you to download) a text file that reads “Hello Gary”.
Congrats! You’ve just run the Everywhere Computer over the internet.
Write A Multi-Function Workflow
When you called that first sample function, it was wrapped with the input you proved as a task
and executed as part of a workflow
: a sequence of functions that define compute jobs to be run on the Everywhere Computer. Just to repeat:
- A Function: The code you’ve written that accepts inputs and returns an output
- A Task: Function + a specific set of Inputs
- A Workflow: Multiple tasks run in sequence
Workflows can be big. They can be small. They can run in isolation. They can be composed together.
Let’s construct a two task workflow to test this out. To do this, we’ll instruct the cli to compile both the hello
and concat
functions:
Next Steps
For additional instructions on local development with the every cli
— including writing custom functions in TypeScript and Rust — check out Every CLI Usage.