Skip to main content

1. Run your first Wasm App

Welcome to the Cosmonic quick start guide. In the next 2 minutes we will take you through getting your first Rust application running in Cosmonic using WebAssembly, wasmCloud and the power of XKCD comics. We will run this first all in the Cosmonic cloud, then we will split up where the app is running with some of it on your local machine without changing or modifying your architecture! (all in the same secure network - your constellation )

1. Running your first server side Wasm application

To get started, we are going to run a simple application that serves us with random XKCD comic. Click the button below to view the manifest & deploy the application - then head back here.

Deploy XKCD Demo on Cosmonic

Awesome! You have now run your first application. You will start off in the Applications view where you can see a list of all the components that you just deployed.

This application consists of a single actor, which is a stateless, reactive component that represents the smallest unit of compute that you can create. In the future this is where you will write your business logic. This actor is connected to two capability providers, stateful providers offering services like a blob store, database, HTTP server, etc. In this case, one is there to listen for incoming HTTP requests, and another to make outbound HTTP requests to fetch XKCD comics.

The full architecture looks like this:

XKCD architecture

Next let's head to the Logic View to check out how this fits together in Cosmonic and access our application!

The Logic View

You can access the Logic View by navigating on the left hand side of Cosmonic, selecting the top option.

You'll see a node on the canvas for your actor, which is connected to the two capability providers. Right now, this is all running on a host in Cosmonic. A host is an instance of the wasmCloud runtime on a machine.

Logic View

You can then access your application by selecting your wormhole and clicking 'Access your Wormhole'

Access Your app

🎉 Congratulations, you have run and accessed your first server side Wasm application on Cosmonic! Next let's take a look at the power of the Cosmonic networking to see what else we can do.