The New Hello World for faastRuby - The Serverless Platform for Ruby & Crystal - Part 1.
Tags: ruby, crystal, faastruby, serverless
Published: 2019-04-13 20:22:44

---
title: The New Hello World for faastRuby - The Serverless Platform for Ruby & Crystal - Part 1. 
published: true
description: 
tags: ruby, crystal, faastruby, serverless
---
 
![alt text](https://faastruby.io/wp-content/uploads/2019/03/logo-negative-1.png "faastRuby logo")

Hi folks! I want to share with you one of the most emerging technologies for Cloud Computing. I'm talking about "Functions as a Service" or FaaS. In this article I want you to explore with me an introductory solution. We will build a serverless application, step by step, using the [faastRuby](https://www.faastruby.io) platform, and we will make the solution available in the cloud.

If you are not familiar with these terms, do not worry. I've described more about [faastRuby](https://www.faastruby.io), FaaS and Serverless in this article in [Portuguese](https://onebitcode.com/faastruby-serverless-ruby/) and here in [English](https://faastruby.io/blog/building-a-simple-landing-page-with-faastruby-functions/).

faastRuby is an incredible platform and allows us to work easily with serverless functions. The platform is intuitive and very similar to Heroku, where the server infrastructure is totally abstracted.

Click here [https://www.faastruby.io](https://www.faastruby.io) to know more about faastRuby.

## Introduction

The faastRuby platform was updated and there were improvements after version 0.5, so I decided to rewrite the Hello World tutorial. 

### Understanding the Platform

**faastRuby** is a Serverless Software Development Platform for Ruby and Crystal, made of two main components.

#### Main Components

1. **faastRuby Cloud** - where you deploy your applications and functions to.
2. **faastRuby Local** - an SDK that allows you to develop and test rich web applications and APIs in your machine and deploy your app as a set of distributed functions to the platform. Basically all you have to do is write code. No Ops required.

#### Basic Concepts: **Account, Project, Function & Workspace**

1. **Account** - To get started with the faastRuby Cloud Platform, you'll have to create an account, which you'll use to login on the Platform. A faastRuby account belongs to a person or a company.
2. **Function** - faastRuby apps are built with pure Ruby or Crystal functions. Functions are the unit of deployment of faastRuby apps. Each function is its own thing - they are independent from each other.
3. **Project** - Project is where your application stays. Your project will have a main folder, subfolders, static files and functions.  
4. **Workspace** - Workspaces are isolated environments where you deploy your functions to. They are represented by a URL like
[https://projectName-environment-abs123.tor1.faast.cloud]().
 

#### Breaking Down a Workspace URL

Example [https://projectName-environment-abs123.tor1.faast.cloud]().

* **projectName**: Your faastRuby project's name.
* **environment**: Stage is the default environment. You can choose another one like prod, dev, etc.
* **abs123**: This's the project identifier, used to ensure your workspaces will have unique names. It shouldn't be changed.

## What are we going to create?
Using the faastRuby resources, we're going to create two Ruby functions locally, test them, and deployed them to the cloud.

## Tools
* **ruby 2.6.0**
* **gem faastruby**

## Step by Step Function Creation

### Installation

Create your own folder for faastRuby projects and enter into it. This is not mandatory. I prefer to use this kind of folder organization, this way, all projects made in faastRuby stay inside this folder.

```Bash
$ mkdir faastruby
$ cd faastruby
```

Perform this step only if you use the Ruby version manager, [RVM](https://rvm.io):

```Bash
$ faastruby/> rvm use ruby-2.6.0@faastruby --ruby-version --create
```

#### Install the gem

If you do not have the gem installed, perform:

```Bash
$ faastruby/> gem install faastruby
```
If you already have faastruby gem installed, just upgrade it:

```Bash
$ faastruby/> faastruby update
```

To know if it worked, let's see the gem version. For me this is the current version: 0.5.23. Note that your version may be newer, as the platform is constantly being updated.


```Bash
$ faastruby/> faastruby -v
0.5.23
```

### Signing up on faastRuby Platform

```Bash
$ faastruby/> faastruby signup

Welcome to FaaStRuby! Please enter your email address:
Email: <<< you@your-email.com >>>

```

After entering your email, you can enter with your password.

```Bash
Now type in a password. 
It must contain 8 to 50 characters and have at least 
one uppercase letter, one lowercase letter, 
one number and one special character @ $ ! % * ? &
************
✔ Creating your account...
```

You'll then receive an email with a token for verification. Copy and paste the token into the field indicated below.

```Bash
You should have received an email with a confirmation token.
If you didn't receive an email:
- Make sure you sign up with the correct email address
- The system won't send an email if you account status is already 'confirmed'
Confirmation Token: <<< your token here >>>
```

Finally, you'll be registered and logged into the platform.

```Bash
✔ Confirming your account...
Login successful!
```

When you need to login, use the following command:

```Bash
$ faastruby/> faastruby login       
Email: you@your-email.com
Password: ***********
Login successful.
```

And when you need to logout, you can use:

```Bash
$ faastruby/> faastruby logout ## use --all to logout from all machines
Logout successful.
```

#### This article continues on [Part 2](https://dev.to/sergiosouzalima/the-new-hello-world-for-faastruby-the-serverless-platform-for-ruby-crystal-part-2-29pk) where we'll build up a faastRuby project and deploy it to the cloud.