Key Value API
1
4fbf02fc-0329-4291-aac3-0143969167c4
Promise API
2
4fbf02fc-0329-4291-aac3-0143969167c4
Worker API
8
fc0b5887-cca5-4261-b6b7-73711f6f23b0
Token API
7
fc0b5887-cca5-4261-b6b7-73711f6f23b0
Template API
6
fc0b5887-cca5-4261-b6b7-73711f6f23b0
Project policy API
5
fc0b5887-cca5-4261-b6b7-73711f6f23b0
Project grant API
4
fc0b5887-cca5-4261-b6b7-73711f6f23b0
Project API
3
fc0b5887-cca5-4261-b6b7-73711f6f23b0
Login API
2
fc0b5887-cca5-4261-b6b7-73711f6f23b0
Account API
1
fc0b5887-cca5-4261-b6b7-73711f6f23b0
Breaking changes August 2023
1
726cfb0b-bffe-41ba-98b4-94069569ec3c
Overview
0
726cfb0b-bffe-41ba-98b4-94069569ec3c
Tier 4 languages
4
03501aa5-572b-4129-aa0a-9e9fe9f5d3fc
Python
4
54bda586-0bf3-430e-93e5-6d8c578372bd
Overview
0
ac8f610e-7e8f-465d-9e32-4b6ae0aba3b5
Overview
0
0f58ad57-8cb7-4a64-8aed-c7bea90c37f9
Overview
0
03501aa5-572b-4129-aa0a-9e9fe9f5d3fc
Overview
0
54bda586-0bf3-430e-93e5-6d8c578372bd
Overview
0
9b92ca64-009f-47e8-9457-b544f786d8af
Quickstart
2
1d167981-dd90-40ab-8023-3b2013ceb5c5
Overview
0
1aa11fd4-1dcf-4c87-8b46-5c15ca815d61
Overview
0
4fbf02fc-0329-4291-aac3-0143969167c4
Overview
0
d0be080a-56f4-481a-91d3-ba7d30c144f4
Common tooling
1
03501aa5-572b-4129-aa0a-9e9fe9f5d3fc
C
3
54bda586-0bf3-430e-93e5-6d8c578372bd
Go
2
54bda586-0bf3-430e-93e5-6d8c578372bd
Grain
3
9b92ca64-009f-47e8-9457-b544f786d8af
Swift
1
9b92ca64-009f-47e8-9457-b544f786d8af
C#
3
9b92ca64-009f-47e8-9457-b544f786d8af
Zig
2
9b92ca64-009f-47e8-9457-b544f786d8af
Rust
1
54bda586-0bf3-430e-93e5-6d8c578372bd
Overview
0
fc0b5887-cca5-4261-b6b7-73711f6f23b0
Overview
0
62133a19-c114-4a29-a74b-f986d118e157
Why Golem?
1
1d167981-dd90-40ab-8023-3b2013ceb5c5
Overview
0
1d167981-dd90-40ab-8023-3b2013ceb5c5
API Gateway
308adf1f-525e-460e-81c9-6ea00d1dbca4
d0be080a-56f4-481a-91d3-ba7d30c144f4
4
Release notes
726cfb0b-bffe-41ba-98b4-94069569ec3c
d0be080a-56f4-481a-91d3-ba7d30c144f4
9
Component interface
ac8f610e-7e8f-465d-9e32-4b6ae0aba3b5
d0be080a-56f4-481a-91d3-ba7d30c144f4
7
Getting Started
1d167981-dd90-40ab-8023-3b2013ceb5c5
d0be080a-56f4-481a-91d3-ba7d30c144f4
1
Building Components
03501aa5-572b-4129-aa0a-9e9fe9f5d3fc
d0be080a-56f4-481a-91d3-ba7d30c144f4
2
Tier 2 languages
54bda586-0bf3-430e-93e5-6d8c578372bd
03501aa5-572b-4129-aa0a-9e9fe9f5d3fc
2
Promises
62133a19-c114-4a29-a74b-f986d118e157
d0be080a-56f4-481a-91d3-ba7d30c144f4
3
Tier 3 languages
9b92ca64-009f-47e8-9457-b544f786d8af
03501aa5-572b-4129-aa0a-9e9fe9f5d3fc
3
Golem CLI
1aa11fd4-1dcf-4c87-8b46-5c15ca815d61
d0be080a-56f4-481a-91d3-ba7d30c144f4
4
REST API
fc0b5887-cca5-4261-b6b7-73711f6f23b0
d0be080a-56f4-481a-91d3-ba7d30c144f4
5
Runtime API
4fbf02fc-0329-4291-aac3-0143969167c4
d0be080a-56f4-481a-91d3-ba7d30c144f4
6
FAQ
0f58ad57-8cb7-4a64-8aed-c7bea90c37f9
d0be080a-56f4-481a-91d3-ba7d30c144f4
7

Quickstart

1d167981-dd90-40ab-8023-3b2013ceb5c5

This guide will get you up and running in the Golem Cloud in minutes.

Install Golem CLI

Golem CLI is a command-line application that allows you to deploy new invincible workers onto Golem Cloud, as well as manage your account, projects, templates, and API tokens.

In order to download the command-line application, you must first register for the Developer Mode preview. You will then be provided with a link to download Golem CLI.

After downloading Golem CLI, you need to place the application on your path, so you can run it from anywhere.

Authenticate

You need to create an account and authenticate yourself before using any Golem commands. This is easy to do with Github OAuth2. Lets do it right now by using the following command:

golem-cli account get

Once you authenticate, Golem CLI will cache an API token in a local directory named $HOME/.golem. This token will allow you to use Golem CLI without further authentication.

Building an Example

Golem Cloud runs templates that are WebAssembly programs. Templates are like applications, except they may expose functions that can be called externally.

To deploy to Golem Cloud, you must first build a template using any programming language and toolchain that can build WebAssembly components.

To get started quickly, you can use Golem CLI to create a template from an example:

golem-cli new --example rust-shopping-cart --template-name shopping_cart

This will generate a new shopping-cart directory in the current directory with the example for your template.

To build the newly created template you need some development tools installed. These are collected for each supported guest language on the Building Templates page. For the above example, please read the Rust specific instructions to set up cargo-component.

Once you have that, navigate to the shopping-cart, and run:

cargo component build --release

This will write the resulting template to shopping-cart/target/wasm32-wasi/release/lib.wasm.

💡
The golem-cli new command prints out the necessary steps to build your template exactly as you have to type them - using your custom template and package names and the selected example’s language specific tools.

Uploading Your Template

To upload your template to Golem Cloud, you can use the template add command. Navigate to shopping-cart/target/wasm32-wasi/release and then do:

golem-cli template add --template-name shopping-cart lib.wasm

Uploading a template to Golem Cloud does not actually execute the template. Instead, it only makes it available for execution to Golem Cloud.

Every separate execution of your template is referred to as a worker based on that template.

Create Workers

In Golem Cloud, every worker has a unique id, which is arbitrary text that you define. If you don’t need a meaningful id for workers, you can generate a UUID.

Once you have chosen a worker id, you can launch the worker either explicitly, or by invoking any function on the worker (for example, a “main” function).

Here, we creating a new worker shopping-cart-1 :

golem-cli worker add \

--worker-name shopping-cart-1 \

--template-name shopping-cart

When you add a template you will see some basic information about the template such as its name, unique identifier, version, and size. In addition, you will see a list of exports. These are the public API of your worker and can be used to call it with the CLI or REST API, as we will see below.

Invoking Workers

Thanks to the WebAssembly component model, your Golem Cloud applications are not just an executable. Rather, they may export functions that can be called from the outside. Exported functions allow your workers to be given instructions or queried for their state.

Here, we invoke the function initialize_cart on the worker with a single string parameter:

golem-cli worker invoke-and-await \

--template-name=shopping-cart \

--worker-name=shopping-cart-1 \

--function=golem:template/api/initialize-cart \

--parameters='["test-user"]'

If a worker of the specified name has not been created, then when you attempt to invoke a function on the worker, it will first be created.

Check the Template interface section to learn about how to figure out the function name and how to encode your parameters in JSON.

Next Steps

In this guide, you have learned how to build and deploy invincible serverless workers on Golem Cloud, and seen how you can interact with them as they execute.

Take your next steps with Golem Cloud by exploring the following resources:

  • Building Templates describes you can use different programming languages for building Golem templates
  • Promises are a way to block your program until an external condition fulfills it.
  • The Golem CLI page lists all the commands available on Golem’s command line interface
  • Golem can also be controlled using its REST API
  • Read the FAQ page for frequently asked questions