Supercharge Rust APIs with Serverless Functions
Tags: actixweb, rust, serverless, functions
Published: 2022-11-24 07:32:17

---
title: Supercharge Rust APIs with Serverless Functions
published: true
description: Learn how to use Serverless Functions to build a user management API in Rust using Netlify, Xata, and Cloudinary.
tags: #actixWeb #rust #serverless #functions
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9g4iwkd7oi3axz8usz3c.png
# Use a ratio of 100:42 for best results.
# published_at: 2022-11-23 20:44 +0000
---

Serverless Function is a single-purpose programming feature that allows developers to write and deploy software without purchasing and maintaining servers. It lets developers focus on the core business logic of their application without worrying about logistics, operation, and infrastructure associated with software development.

In this post, we will learn how to use Serverless Functions to build a user management API in Rust using Netlify, Xata, and Cloudinary.

## Technology overview

[Netlify](https://www.netlify.com/?utm_source=hackmamba&utm_campaign=hackmamba-hackathon&utm_medium=hackmamba-blog) is a platform for deploying and building highly-performant and dynamic websites, e-commerce stores, and web applications.

[Xata](https://xata.io/?utm_source=hackmamba&utm_campaign=hackmamba-hackathon&utm_medium=hackmamba-blog) is an HTTP API-based serverless database for building scalable applications. It supports a built-in search engine, branching, scalability, and durability without manually managing database configuration and deployment.

[Cloudinary](https://cloudinary.com/?utm_source=hackmamba&utm_campaign=hackmamba-hackathon&utm_medium=hackmamba-blog) is a visual media service for uploading, storing, managing, transforming, and delivering images and videos for websites and applications. 

## GitHub links

The project source codes are below:

- [Serverless Functions source code](https://github.com/Mr-Malomz/xata-functions)
- [Rust API](https://github.com/Mr-Malomz/rust-user-service)

## Prerequisites 

To follow along with this tutorial, the following requirements apply:

- Basic understanding of Rust
- Basic understanding of JavaScript
- [Node.js](https://nodejs.org/en/) installed
- A [Netlify](https://www.netlify.com) account for deploying Serverless Functions. [**Signup**](https://app.netlify.com/signup?_ga=2.194596141.1083651187.1647633137-873794739.1647633137) **is completely free**
- A [Xata account](https://xata.io/?utm_source=hackmamba&utm_campaign=hackmamba-hackathon&utm_medium=hackmamba-blog) for storing data. [**Signup**](https://app.xata.io/?utm_source=hackmamba&utm_campaign=hackmamba-hackathon&utm_medium=hackmamba-blog) **is completely free**
- A [Cloudinary account](https://cloudinary.com/?utm_source=hackmamba&utm_campaign=hackmamba-hackathon&utm_medium=hackmamba-blog) for image optimization. [**Signup**](https://cloudinary.com/users/register/free?utm_source=hackmamba&utm_campaign=hackmamba-hackathon&utm_medium=hackmamba-blog) **is completely free**.
- A [Github account](https://github.com) for saving source code. [**Signup**](https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F&source=header-home) **is completely free**.
## Set up a Database on Xata

To create a database for storing our user management API’s data, we need to log into our Xata’s workspace, click the **Add a Database** button, input `users` as the database name, and **Create**.

![Add a Database](https://paper-attachments.dropboxusercontent.com/s_A1144B74EC1072093F0D2701A540D1E74AD827D7B0FFCD60C26EE8B5BA462734_1667173516275_Screenshot+2022-10-31+at+00.44.55.png)
![input database name](https://paper-attachments.dropboxusercontent.com/s_A1144B74EC1072093F0D2701A540D1E74AD827D7B0FFCD60C26EE8B5BA462734_1667173605124_Screenshot+2022-10-29+at+16.28.50.png)


Next, we need to create a table in our database. To do this, click the **Start from scratch** menu, input `userDetails` as the table name, and **Add table**.

![click the start from scratch](https://paper-attachments.dropboxusercontent.com/s_A1144B74EC1072093F0D2701A540D1E74AD827D7B0FFCD60C26EE8B5BA462734_1667173724094_Screenshot+2022-10-29+at+16.30.08.png)
![input and create](https://paper-attachments.dropboxusercontent.com/s_A1144B74EC1072093F0D2701A540D1E74AD827D7B0FFCD60C26EE8B5BA462734_1667173928867_Screenshot+2022-10-29+at+16.30.43.png)


**PS**: *Xata auto-generates an ID column (a unique identifier) for our table.*

With that done, we need to add a `firstName`, `lastName`, `phoneNumber`, and `avatar` columns to our table. To do this, click on the **Plus icon**, select **String**, input column name, and **Create column**.

![plus icon](https://paper-attachments.dropboxusercontent.com/s_A1144B74EC1072093F0D2701A540D1E74AD827D7B0FFCD60C26EE8B5BA462734_1667174472120_Screenshot+2022-10-29+at+16.31.54.png)
![select string](https://paper-attachments.dropboxusercontent.com/s_A1144B74EC1072093F0D2701A540D1E74AD827D7B0FFCD60C26EE8B5BA462734_1667174472131_Screenshot+2022-10-31+at+01.00.47.png)
![input name](https://paper-attachments.dropboxusercontent.com/s_A1144B74EC1072093F0D2701A540D1E74AD827D7B0FFCD60C26EE8B5BA462734_1667174553609_Screenshot+2022-10-31+at+01.02.02.png)


After creating the columns, our updated table should be similar to the screenshot below:

![updated table](https://paper-attachments.dropboxusercontent.com/s_A1144B74EC1072093F0D2701A540D1E74AD827D7B0FFCD60C26EE8B5BA462734_1667174730823_Screenshot+2022-10-31+at+01.05.15.png)


**Get Database URL and set up API Key**
By default, Xata provides a unique and secure URL for accessing the database. To get our database URL, click the **Get code snippet** button, copy the URL, and then click the **Set up API key** button to generate API key. 

![Get code snippet](https://paper-attachments.dropboxusercontent.com/s_A1144B74EC1072093F0D2701A540D1E74AD827D7B0FFCD60C26EE8B5BA462734_1667175618565_Screenshot+2022-10-31+at+01.13.20.png)



![URL and Set up API key](https://paper-attachments.dropboxusercontent.com/s_A1144B74EC1072093F0D2701A540D1E74AD827D7B0FFCD60C26EE8B5BA462734_1667175618585_Screenshot+2022-10-29+at+16.40.21.png)


**PS**: *The URL we need to copy starts from the* `*https://……*` *section*

Click the **Add a key** button, input `xata-function` as the name, and **Save**.

![Add a key](https://paper-attachments.dropboxusercontent.com/s_A1144B74EC1072093F0D2701A540D1E74AD827D7B0FFCD60C26EE8B5BA462734_1667175790072_Screenshot+2022-10-29+at+16.42.41.png)
![Copy API Key](https://paper-attachments.dropboxusercontent.com/s_A1144B74EC1072093F0D2701A540D1E74AD827D7B0FFCD60C26EE8B5BA462734_1667175790087_Screenshot+2022-10-29+at+16.46.22.png)


We must copy and keep the URL and generated API key, as they will come in handy when building our serverless functions.

## Image sourcing and upload to Cloudinary

Next, we need to upload an image we will use as a default avatar when creating a user. 

**Avatar url**

- bit.ly/3gUBL7E

In our Cloudinary dashboard, we uploaded the image by clicking on the **Media Library** tab, clicking on **Upload**, selecting the **Web Address** option, inputting the **URL**, and clicking on the **Arrow Button** to upload.

![Cloudinary console and upload button for other formats of upload](https://paper-attachments.dropboxusercontent.com/s_A1144B74EC1072093F0D2701A540D1E74AD827D7B0FFCD60C26EE8B5BA462734_1667176524103_Screenshot+2022-10-31+at+01.34.28.png)

![select web address and enter url](https://paper-attachments.dropboxusercontent.com/s_A1144B74EC1072093F0D2701A540D1E74AD827D7B0FFCD60C26EE8B5BA462734_1667176648327_Screenshot+2022-10-31+at+01.36.43.png)


After uploading the image, we will see it displayed on the console. To get the image URL, mouse hover on the image and click on the **Copy URL** icon. The URL will come in handy when building our Serverless Functions.

![copy url](https://paper-attachments.dropboxusercontent.com/s_A1144B74EC1072093F0D2701A540D1E74AD827D7B0FFCD60C26EE8B5BA462734_1667176777775_Screenshot+2022-10-30+at+00.29.58.png)

## Creating Serverless Functions

To get started, we need to navigate to the desired directory and run the command below:

```bash
mkdir xata-functions && cd xata-functions
```

The command creates a directory called `xata-functions` and navigates into it.

**Initializing project and installing dependencies**
First, we need to initialize an empty Node.js project by running the command below:

```bash
npm init -y
```

Lastly, we need to install `node-fetch`, a package for making HTTP requests. To do this, we need to run the command below:

```bash
npm i node-fetch
```

**Adding logics to the Serverless Functions**
With that done, we can start creating our application logic. To get started; first, we need to create a `netlify` folder and create a `functions` folder in this folder.


![updated folder structure](https://paper-attachments.dropboxusercontent.com/s_A1144B74EC1072093F0D2701A540D1E74AD827D7B0FFCD60C26EE8B5BA462734_1667247928234_Screenshot+2022-10-31+at+21.25.15.png)


Secondly, we need to create a `create.js` file inside the `functions` folder and add the snippet below:

```js
import fetch from 'node-fetch';

exports.handler = async function (event, context, callback) {
    let bodyRequest = JSON.parse(event.body);
    const body = {
        firstName: bodyRequest.firstName,
        lastName: bodyRequest.lastName,
        phoneNumber: bodyRequest.phoneNumber,
        avatar: 'https://res.cloudinary.com/dtgbzmpca/image/upload/v1667083687/abstract-user-flat-4.png',
    };

    const response = await fetch(
        `${process.env.XATA_URL}:main/tables/userDetails/data`,
        {
            method: 'POST',
            headers: {
                'Content-Type': 'application/json',
                Authorization: `Bearer ${process.env.XATA_API_KEY}`,
            },
            body: JSON.stringify(body),
        }
    );
    const data = await response.json();

    return {
        statusCode: 200,
        body: JSON.stringify(data),
    };
};
```

The snippet above does the following:

- Imports the required dependency 
- Gets the request body
- Uses the request body to create a `body` object by passing in the `firstName`, `lastName`, `phoneNumber`, and `avatar` default URL we got from Cloudinary
- Creates a `POST` request to the Xata database by passing the URL as an environment variable with the database details and API key
- Returns the appropriate response.

We also constructed the Xata database URL by passing in the **branch**, **table name**, and **endpoint type**.

```bash
https://sample-databaseurl/users:<BRANCH NAME>/tables/<TABLE NAME>/ENDPOINT TYPE
```

We can get the required details from our workspace

![Branch name and Table name](https://paper-attachments.dropboxusercontent.com/s_A1144B74EC1072093F0D2701A540D1E74AD827D7B0FFCD60C26EE8B5BA462734_1667251155158_Screenshot+2022-10-29+at+17.40.43.png)


In our case, we filled it using an environment variable. We will add it when deploying our application to Netlify. An adequately filled  URL is below:

```bash
https://sample-databaseurl/users:main/tables/userDetails/data
```

Thirdly, we need to create a `get.js` file inside the same `functions` folder and add the snippet below:

```js
import fetch from 'node-fetch';

exports.handler = async function () {
    const body = {
        page: {
            size: 15,
        },
    };

    const response = await fetch(
        `${process.env.XATA_URL}:main/tables/userDetails/query`,
        {
            method: 'POST',
            headers: {
                'Content-Type': 'application/json',
                Authorization: `Bearer ${process.env.XATA_API_KEY}`,
            },
            body: JSON.stringify(body),
        }
    );
    const data = await response.json();

    return {
        statusCode: 200,
        body: JSON.stringify(data),
    };
};
```

The snippet above works similarly to the `create.js` file. However, we created a `body` object to paginate the requested data from the Xata database.

Lastly, we need to add a deployment file that instructs Netlify to build our application effectively. To do this, we need to create a `netlify.toml` file in the root directory of our project and add the snippet below:

```toml
[functions]
  node_bundler = "esbuild"
```

**Pushing our source code to GitHub**
We need to push our source code to GitHub to enable a seamless deployment process. To get started, we need to log into our GitHub account, create a repository, input `xata-functions` as the name and **Create repository**.

Next, we initialize a `git` project and save recent changes in our project by running the command below:

```bash
git init
git add .
git commit -m "add serverless functions"
```

To push our changes, copy and run the highlighted commands on the terminal:

![Push changes to GitHub](https://paper-attachments.dropboxusercontent.com/s_A1144B74EC1072093F0D2701A540D1E74AD827D7B0FFCD60C26EE8B5BA462734_1667252593439_Screenshot+2022-10-29+at+17.46.07.png)



## Deploying to Netlify

To get started, we need to log into our [Netlify](https://app.netlify.com/) dashboard. Click on **Add new site** dropdown and select  **Import an existing project**.

![Create site](https://paper-attachments.dropboxusercontent.com/s_A1144B74EC1072093F0D2701A540D1E74AD827D7B0FFCD60C26EE8B5BA462734_1667252724024_Screenshot+2022-10-29+at+19.48.13.png)


Select **GitHub** as the Git provider and authorize Netlify. 

![select Github](https://paper-attachments.dropboxusercontent.com/s_8D31A8FC979E5F8A04C65B533C8604145C4DC40C7A1F1BAA5C7B6711437D62F0_1647646116402_Screenshot+2022-03-19+at+00.27.32.png)


Search for `xata-function` and select the repository.

![select repository](https://paper-attachments.dropboxusercontent.com/s_A1144B74EC1072093F0D2701A540D1E74AD827D7B0FFCD60C26EE8B5BA462734_1667252806071_Screenshot+2022-10-29+at+19.49.43.png)


Click on **Show advanced**, click the **New variable** button and add the `XATA_URL` and `XATA_API_KEY` environment variables as key and their corresponding values.

![Show advanced](https://paper-attachments.dropboxusercontent.com/s_A1144B74EC1072093F0D2701A540D1E74AD827D7B0FFCD60C26EE8B5BA462734_1667253099549_Screenshot+2022-10-29+at+19.50.21.png)
![input env variable](https://paper-attachments.dropboxusercontent.com/s_A1144B74EC1072093F0D2701A540D1E74AD827D7B0FFCD60C26EE8B5BA462734_1667253143824_Screenshot+2022-10-29+at+19.51.23.png)


As earlier mentioned, we can get Xata’s URL and API key from our workspace.


![URL](https://paper-attachments.dropboxusercontent.com/s_A1144B74EC1072093F0D2701A540D1E74AD827D7B0FFCD60C26EE8B5BA462734_1667253588412_Screenshot+2022-10-31+at+22.56.31.png)
![API KEY](https://paper-attachments.dropboxusercontent.com/s_A1144B74EC1072093F0D2701A540D1E74AD827D7B0FFCD60C26EE8B5BA462734_1667253588385_Screenshot+2022-10-29+at+16.46.22.png)


Click on **Deploy site** button to start deployment. It might take a few minutes.

We can view and get our deployed Serverless Functions URL by navigating to the **Functions** tab, and click on any of the functions to access the URL.

![Deployed Functions](https://paper-attachments.dropboxusercontent.com/s_A1144B74EC1072093F0D2701A540D1E74AD827D7B0FFCD60C26EE8B5BA462734_1667253769845_Screenshot+2022-10-29+at+19.00.57.png)
![Copy Function URL](https://paper-attachments.dropboxusercontent.com/s_A1144B74EC1072093F0D2701A540D1E74AD827D7B0FFCD60C26EE8B5BA462734_1667253769874_Screenshot+2022-10-29+at+19.01.28.png)




## Leveraging the Serverless Functions to build Rust APIs

With our Serverless Functions up and running, we can start leveraging them to build our user management APIs. To get started, we need to navigate to the desired directory and run the command below in our terminal:

```bash
cargo new rust-user-service && cd rust-user-service
```

This command creates a Rust project called `rust-user-service` and navigates into the project directory.

Next, we proceed to install the required dependencies by modifying the `[dependencies]` section of the `Cargo.toml` file as shown below:

```toml
//other code section goes here

[dependencies]
actix-web = "4"
serde = { version = "1.0.145", features = ["derive"] }
serde_json = "1.0"
reqwest = { version = "0.11", features = ["json"] }
```

`actix-web = "4"` is a Rust-based framework for building web applications.

`serde = { version = "1.0.145", features = ["derive"] }` is a framework for serializing and deserializing Rust data structures. E.g. convert Rust structs to JSON and vice versa.

`serde_json = "1.0"` is a crate that uses the `serde` crate manipulate JSON and vice versa

`reqwest = { version = "0.11", features = ["json"] }` is a HTTP request crate.

We need to run the command below to install the dependencies:

```bash
cargo build
```

**Structuring our application**
It is essential to have a good project structure as it makes the project maintainable and easier for us and others to read our codebase.
To do this, we need to navigate to the `src` directory and, in this folder, create `api` folder. Inside the `api` folder, we also need to create `mod.rs`, `models.rs`, `services.rs`, and `handlers.rs` files.

![Updated file structure](https://paper-attachments.dropboxusercontent.com/s_A1144B74EC1072093F0D2701A540D1E74AD827D7B0FFCD60C26EE8B5BA462734_1667260041632_Screenshot+2022-11-01+at+00.47.01.png)


`mod.rs` is file for managing application visibility.

`models.rs` is for structuring our application data.

`services.rs` is for abstracting our application logics.

`handlers.rs` is for structuring our APIs.

Next, we need to declare these files as a module by importing them into the `mod.rs` file

```rs
pub mod handlers;
pub mod models;
pub mod services;
```

Finally, we need to register `api` folder as a parent module by importing it into the `main.rs` file as shown below:

```rs
mod api;

fn main() {
  println!("Hello world")
}
```

**Create the API models**
Next, we need to create models to represent our application data. To do this, we need to modify the `model.rs` file as shown below:

```rs
use serde::{Deserialize, Serialize};

#[derive(Deserialize, Serialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
pub struct User {
    pub id: Option<String>,
    pub first_name: String,
    pub last_name: String,
    pub phone_number: String,
    pub avatar: Option<String>,
}

#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct Records {
    pub records: Vec<User>,
}

#[derive(Deserialize, Serialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
pub struct CreateResponse {
    pub id: String,
}

#[derive(Serialize, Debug, Clone)]
pub struct APIResponse<T> {
    pub status: u16,
    pub message: String,
    pub data: Option<T>,
}

#[derive(Serialize, Debug, Clone)]
pub struct APIErrorResponse {
    pub status: u16,
    pub message: String,
    pub data: Option<String>,
}
```

The snippet above does the following:

- Imports the required dependency
- Creates `User` and `Records` structs with required properties to describe request and response  body accordingly 
- Creates a `CreateResponse`, `APIResponse`, and `APIErrorResponse` structs with the required properties needed for the API response

***PS****: The* `*#[serde(rename_all = "camelCase")]*` *macro converts snake case properties to camel case and the* `*derive*` *macro adds implementation support for serialization, deserializations, and cloning.*

**Create the API services**
With our Serverless Functions up and running, we can use it to create a user service. To do this, we need to add the snippet below to the `services.rs` file:

```rs
use super::models::{CreateResponse, Records, User};
use reqwest::{Client, Error};

pub struct UserService {}

impl UserService {
    pub async fn get_user() -> Result<Records, Error> {
        let url = "<NETLIFY FUNCTION GET URL>";

        let client = Client::new();
        let fetched_users = client.get(url).send().await;

        match fetched_users {
            Ok(response) => {
                let json = response.text().await?;
                let new_records: Records = serde_json::from_str(json.as_str()).unwrap();
                Ok(new_records)
            }
            Err(error) => Err(error),
        }
    }

    pub async fn create_user(new_user: User) -> Result<CreateResponse, Error> {
        let url = "<NETLIFY FUNCTION CREATE URL>";
        let json_body = User {
            id: None,
            first_name: new_user.first_name,
            last_name: new_user.last_name,
            phone_number: new_user.phone_number,
            avatar: None,
        };

        let client = Client::new();
        let fetched_users = client.post(url).json(&json_body).send().await;

        match fetched_users {
            Ok(response) => {
                let json = response.text().await?;
                let created_record: CreateResponse = serde_json::from_str(json.as_str()).unwrap();
                Ok(created_record)
            }
            Err(error) => Err(error),
        }
    }
}
```

The snippet above does the following:

- Imports the required dependencies
- Creates a `UserService` struct
- Creates an implementation block that adds methods to the `UserService` struct
- Adds a `get_user` method to get the list of users by making an HTTP request to the `get` Serverless Function URL and returns the list of users
- Adds a `create_user` method to create a user by making an HTTP request to the `create` Serverless Function URL and returns the appropriate response
    

As earlier mentioned, we can get our URLs from the Netlify function tab.

![Deployed Functions](https://paper-attachments.dropboxusercontent.com/s_A1144B74EC1072093F0D2701A540D1E74AD827D7B0FFCD60C26EE8B5BA462734_1667253769845_Screenshot+2022-10-29+at+19.00.57.png)
![Copy Function URL](https://paper-attachments.dropboxusercontent.com/s_A1144B74EC1072093F0D2701A540D1E74AD827D7B0FFCD60C26EE8B5BA462734_1667253769874_Screenshot+2022-10-29+at+19.01.28.png)


**Create the API handlers**
With that done, we can use the services to create our API handlers. To do this, we need to add the snippet below to `handlers.rs` file:

```rs
use actix_web::{get, post, web::Json, HttpResponse};
use reqwest::StatusCode;
use super::{
    models::{APIErrorResponse, APIResponse, CreateResponse, Records, User},
    services::UserService,
};

#[get("/users")]
pub async fn get_user() -> HttpResponse {
    let user_details = UserService::get_user().await;

    match user_details {
        Ok(data) => HttpResponse::Ok().json(APIResponse::<Records> {
            status: StatusCode::OK.as_u16(),
            message: "success".to_string(),
            data: Some(data),
        }),
        Err(error) => HttpResponse::InternalServerError().json(APIErrorResponse {
            status: StatusCode::INTERNAL_SERVER_ERROR.as_u16(),
            message: "failure".to_string(),
            data: Some(error.to_string()),
        }),
    }
}

#[post("/users")]
pub async fn create_user(data: Json<User>) -> HttpResponse {
    let new_user = User {
        id: None,
        first_name: data.first_name.clone(),
        last_name: data.last_name.clone(),
        phone_number: data.phone_number.clone(),
        avatar: None,
    };
    let user_details = UserService::create_user(new_user).await;

    match user_details {
        Ok(data) => HttpResponse::Accepted().json(APIResponse::<CreateResponse> {
            status: StatusCode::ACCEPTED.as_u16(),
            message: "success".to_string(),
            data: Some(data),
        }),
        Err(error) => HttpResponse::InternalServerError().json(APIErrorResponse {
            status: StatusCode::INTERNAL_SERVER_ERROR.as_u16(),
            message: "failure".to_string(),
            data: Some(error.to_string()),
        }),
    }
}
```

The snippet above does the following:

- Imports the required dependencies
- Creates a `get_user` handler with a `/users` API route that uses the `get_user` service to get the list of users and returns the appropriate response using the `APIResponse` and `APIErrorResponse`
- Creates a `create_user` handler with a `/users` API route that uses the `create_user` service to create a user and returns the appropriate response using the `APIResponse` and `APIErrorResponse`

**Putting it all together**
With that done, we need to update the `main.rs` file to include our application entry point and use the `get_user` and `create_user` handlers.

```rs
use actix_web::{App, HttpServer};
use api::handlers::{create_user, get_user};
mod api;

#[actix_web::main]
async fn main() -> std::io::Result<()> {
    HttpServer::new(move || App::new().service(get_user).service(create_user))
        .bind(("localhost", 8080))?
        .run()
        .await
}
```
The snippet above does the following:

- Imports the required dependencies
- Creates a new server that adds the `get_user` and `create_user` handlers and runs on `localhost:8080`

With that done, we can start a development server using the command below:

```bash
cargo run main.go 
```

![get list of users](https://paper-attachments.dropboxusercontent.com/s_A1144B74EC1072093F0D2701A540D1E74AD827D7B0FFCD60C26EE8B5BA462734_1667262317525_Screenshot+2022-10-29+at+23.06.15.png)
![create a user](https://paper-attachments.dropboxusercontent.com/s_A1144B74EC1072093F0D2701A540D1E74AD827D7B0FFCD60C26EE8B5BA462734_1667262364783_Screenshot+2022-10-29+at+23.11.07.png)


We can also verify the APIs by checking the Xata’s workspace

![updated data](https://paper-attachments.dropboxusercontent.com/s_A1144B74EC1072093F0D2701A540D1E74AD827D7B0FFCD60C26EE8B5BA462734_1667262482438_Screenshot+2022-11-01+at+01.27.28.png)

## Conclusion

This post discussed how to quickly create user management APIs in Rust without manually deploying and managing databases and servers. With the powerful trio of Xata, Netlify, and Cloudinary, developers can build and ship applications faster by focusing on what matters and not being bothered by infrastructure bottlenecks.

These resources might be helpful:

- [Xata official docs](https://xata.io/docs/overview?utm_source=hackmamba&utm_campaign=hackmamba-hackathon&utm_medium=hackmamba-blog)
- [Netlify Serverless Functions](https://www.netlify.com/products/functions/?utm_source=hackmamba&utm_campaign=hackmamba-hackathon&utm_medium=hackmamba-blog)
- [Cloudinary official docs](https://cloudinary.com/documentation?utm_source=hackmamba&utm_campaign=hackmamba-hackathon&utm_medium=hackmamba-blog)
- [Reqwest HTTP Library](https://github.com/seanmonstar/reqwest)