Udemy
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  
Turn what you know into an opportunity and reach millions around the world.
Learn More
Your cart is empty.
Keep shopping
Creating an API server in Rust with Actix, SQLx and JWT
Rating: 4.5 out of 5(24 ratings)
186 students

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.
Created byAfaan Bilal
Last updated 1/2025
English

What you'll learn

  • Create a Rust project
  • Create a REST API server using Actix Web
  • Interacting with a database using SQLx
  • Authenticating APIs using JWT
  • Running database migrations using SQLx CLI

Course content

11 sections63 lectures2h 46m total length
  • Introduction1:41

    Build blazing fast, secure api servers with rust, actix, sqlx, and json web tokens, then deploy production-ready code with docker.

  • Project Setup1:28

    Learn to set up a rust rest api project by validating the rust version, creating a cargo binary named money flow, and initializing git with standard files.

  • Hello World and Directory Structure2:01
  • Basic Requirements and Resources0:19
  • Installing Actix Web1:39

    Install Actix web in your Rust project by adding the crate to cargo.toml or using cargo add, targeting version four.x. Build the API backend and prepare a hello world example.

  • Actix Hello World4:02

    Explore how Actix web uses its runtime to run an async main function, register routes with get, and test endpoints hello, hey, and echo.

  • Rust Basics
  • GitHub Repository0:06

Requirements

  • Basic programming experience
  • Basic experience with the Rust programming language

Description

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.

Who this course is for:

  • Programmers curios about creating REST API servers and other projects using Rust
  • Beginner Rust developers looking to use the Actix Web framework
  • Beginner Rust developers looking to use SQLx for database interactions