Creating an API server in Rust with Actix, SQLx and JWT

Build your own REST API server with the safety and performance of Rust using Actix Web, SQLx and JWT authentication.

Creating an API server in Rust with Actix, SQLx and JWT
Creating an API server in Rust with Actix, SQLx and JWT

Creating an API server in Rust with Actix, SQLx and JWT free download

Build your own REST API server with the safety and performance of Rust using Actix Web, SQLx and JWT authentication.

In this course, we'll create a REST API server in Rust to manage a personal budget called MoneyFlow. MoneyFlow would allow us to manage categories and transactions.


Using this system, we'll be able to:

  • Create, list, update and delete categories

  • Create, list, update and delete transactions

  • List all transactions by a particular category

  • See total running balance and the running balance for a category


We'll learn how to:

  • Create a new Rust project using cargo

  • Build and run our Rust project

  • Add crates and enable crate features


We'll learn about basic API concepts such:

  • Routing and HTTP methods

  • Extracting data from HTTP requests

  • Interacting with the database to query and insert data

  • Creating user accounts

  • Authentication using JWT

  • Using relationships between models to query and list associated data


Along with these concepts, we'll learn how to:

  • Handle incoming (request) and outgoing (response) data in a type safe way

  • Handle CORS

  • Rate limiting

  • Create and run database migrations


We'll have an additional lecture at the end to learn how to Dockerize our API server to deploy and run it anywhere.


We'll be using the following crates:

  1. Actix Web: a powerful, pragmatic, and extremely fast web framework for Rust.

  2. SQLx: an async, pure Rust SQL crate featuring compile-time checked queries.

  3. jsonwebtoken to create and decode JWTs in a strongly typed way.

  4. serde and serde_json for serializing and deserializing Rust data structures efficiently and generically.