We may earn an affiliate commission when you visit our partners.
Eric Mabo
  1. You will build a full-stack web app using the rust programming language. We will be building a fully functional CRUD Server API using Then we will build a fully functional frontend in rust using the Yew framework (Yew looks like ReactJS but in Rust). We will then connect the front end and the back end to run from the same port/URL. You will learn how to create Yew components, routing, create forms and handle GET and POST requests using the rust reqwest crate in the front end. This course is good for developers who already know at least one programming language and have some web development experience. It is not a course for folks who are completely new to programming.

  2. Rust is the most loved programming language for the past several years according to StackOverflow. All the big tech companies are now using rust and a lot of startups are using rust. More so, a lot of the newer blockchain projects are building with rust. The rust programming language is growing very rapidly.

  3. This course will help you start developing in rust very fast, as you will build a real full-stack app. You can use the concepts to expand your rust dev options.

  4. The course is divided into 3 main sections. Section 1 is an intro to rust. You can skip this section if you are already familiar with the material. Section 2 will cover the Server API dev using AXUM and section 3 covers developing frontend apps using the popular Yew framework.

  5. Full source code provided at the end of the course.

Enroll now

What's inside

Learning objectives

  • Why use rust programming language for full stack web app development in 2023 and beyond?
  • Rust language basics like variables, functions, data types, control flow, structs, enums, using json, hashmaps, modules, ownership and borrowing in rust
  • Build a fully functional crud api using axum, sqlx and postgress
  • Build a fully functional frontend in rust using the yew framework (yew looks like reactjs, but in rust)
  • Following popular demand: link to source code provided at the end of the course.

Syllabus

Why use rust? Why use Yew? Why use Axum?

The videos goes over the agenda and discusses why you may want to consider learning and using rust

Read more
Showcase what we will be building
Installing Rust
Setting up VS Code
Rust Variables and Functions 1
Rust Variables and Functions 2
Rust Modules
Rust data Types
Compound Data Types
Vectors
Rust HashMaps
HashMaps 2
If, Else, match
For and While Loops
Rust Structs
Rust Structs: Impl
Working with JSON: serde_json
Understanding Rust Ownership and Borrowing
You will learn how to build a fully functional Web API in rust. All CRUD functions implemented
What will be covered in this section

use axum::{

    routing::{get},Router,

};

use tower_http::cors::{Any, CorsLayer};


#[tokio::main]

async fn main() {

    //tracing

    tracing_subscriber::fmt::init();


    // add cors

    let cors = CorsLayer::new()

                            .allow_origin(Any);


    let app = Router::new()

        .route("/", get(root))

        .layer(cors);


    tracing::debug!("listening on {}", "0.0.0.0:3000");

    println!(" Listening on port {}" , "0.0.0.0:3000" );

    axum::Server::bind(&"0.0.0.0:3000".parse().unwrap())

            .serve(app.into_make_service())

            .await

            .unwrap();

}


// basic handler that responds with a static string

async fn root() -> &'static str {

    "Hello, REST AXUM API"

}

Add Cargo Watch
Adding CORS to AXUM
Adding Postgres/SQLx
Adding Postgres Table
AXUM API - Create Product
AXUM API - Get ALL Products
AXUM API - Get -ONE product
AXUM API - Delete Product
AXUM API - Update Product
Server API completed - see final code
You will learn how to build a frontend application using the Yew framework
Yew Frontend

Cargo.toml


[package]

name = "frontend"

version = "0.1.0"

edition = "2021"


# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html


[dependencies]

yew = { version = "0.20.0", features = ["csr"] }


yew-router = "0.17"

serde = "1.0.152"

serde_json = "1.0.91"

wasm-bindgen-futures = "0.4.33"

reqwest = { version = "0.11.13", features = ["json"] }

web-sys = {version = "0.3.60", features = ["HtmlInputElement"] }

gloo-console = "0.2.3"

Adding Styling to Yew
Yew Components

below is the final products.rs file



use serde::{Deserialize, Serialize};

use yew::prelude::*;

use yew_router::prelude::*;


use crate::router::Route;


#[derive(Serialize, Deserialize, Debug)]

pub struct Product {

    id: i32,

    name: String,

    price: i32

}

#[function_component]

pub fn Products() -> Html {


    let data: UseStateHandle<Vec<Product>>  = use_state(|| vec![]);

    {

        let data_clone = data.clone();

        use_effect(move ||{

            wasm_bindgen_futures::spawn_local( async move {

                let fetched_data = reqwest::get("http://localhost:3000/api/products")

                .await

                .expect("cannot get data from url")

                .json::<Vec<Product>>()

                .await

                .expect("cannot convert to json");

                data_clone.set(fetched_data);

            });

            || ()

        });

    }  


    let products = data.iter().map(|product| html! {

        <ul>

            <li key={product.id}>{format!("Name: {}, Price: {}", product.name, product.price)}</li>

        </ul>

    }).collect::<Html>();


    html! {

        <div class="container">

            <button class="btn-primary">

                <Link<Route> to={Route::AddProduct}>{ "Add new Product" }</Link<Route>>

            </button>

            <h2>{"List of Products: "} {data.len()} </h2>

            <p>{products}</p>

        </div>

    }

}



let products = data.iter().map(|product| html! {

        <ul>

            <li key={product.id}>{format!("Name: {}, Price: {}", product.name, product.price)}</li>

        </ul>

    }).collect::<Html>();

Yew use_effect hook
Create Form
Add Form

===================================

#### Connecting frontend and server ####

create and add to Cargo.toml

[workspace]


members = [

"server", "frontend"

]


#create and add to .gitignore

target/

dist/

.env


create frontend/Trunk.toml and add contents

[build]

target = "index.html"

dist = "../dist"


now you can run: trunk serve


# now go to server/main.rs

axum::response::IntoResponse

axum::http::StatusCode,

use std::io;


//serving frontend static files

let serve_dir = ServeDir::new("../frontend/dist").not_found_service(ServeFile::new("../dist/frontend/index.html"));

let serve_dir = get_service(serve_dir).handle_error(handle_error);


# add to router


        .nest_service("/", serve_dir.clone())

        .fallback_service(serve_dir.clone());


# add handle error fn    

async fn handle_error(_err: io::Error) -> impl IntoResponse {

        (StatusCode::INTERNAL_SERVER_ERROR, "Something went wrong...")

    }


  # change current / to /home

cd into backend: cargo watch -x run

=========================================

Post Form Data to Server API
Style Form

final router.rs


use yew_router::prelude::*;

use yew::prelude::*;


use crate::products::Products;

use crate::form::Form;



#[derive(Clone, Routable, PartialEq)]

pub enum Route {

    #[at("/")]

    Home,

    #[at("/addproduct")]

    AddProduct,

    #[at("/about")]

    About,

    #[not_found]

    #[at("/404")]

    NotFound,

}


pub fn switch(routes: Route) -> Html {

    match routes {

        Route::Home => html! { <Products /> },

        Route::AddProduct => html! { <Form />},

        Route::About => html! { <h1>{ "About us " }</h1>},

        Route::NotFound => html! { <h1>{ "404" }</h1> },

    }

}



Yew Routing: Adding Components and Navigation
Link to source code: https://github.com/infinityfish/fullstackrustcourse

Good to know

Know what's good
, what to watch for
, and possible dealbreakers
Uses Rust, which is a language known for its memory safety and performance, making it suitable for building robust and efficient web applications
Employs AXUM, Yew, and SQLx, which are modern Rust frameworks and libraries for building web applications, potentially offering a more cutting-edge development experience
Requires familiarity with at least one programming language and some web development experience, so learners completely new to programming may find the course challenging
Covers building a CRUD API with AXUM and SQLx, which are valuable skills for backend development and interacting with databases in a Rust environment
Features Yew, a Rust framework for frontend development that shares similarities with ReactJS, potentially easing the transition for developers familiar with React
Provides full source code, which allows learners to examine a complete application and adapt the code for their own projects, facilitating deeper understanding

Save this course

Save Learn Full Stack Rust Programming using AXUM, Yew, and SQLx to your list so you can find it easily later:
Save

Activities

Be better prepared before your course. Deepen your understanding during and after it. Supplement your coursework and achieve mastery of the topics covered in Learn Full Stack Rust Programming using AXUM, Yew, and SQLx with these activities:
Review Basic Rust Syntax
Reinforce your understanding of fundamental Rust syntax, including variables, data types, and control flow, to prepare for the course's more advanced topics.
Browse courses on Rust
Show steps
  • Read through the first few chapters of 'The Rust Programming Language' book.
  • Write small programs to practice declaring variables and using different data types.
  • Experiment with control flow statements like 'if', 'else', and 'match'.
Brush Up on Web Development Fundamentals
Revisit core web development concepts like HTTP requests, HTML structure, and basic CSS styling to ensure a smooth transition into full-stack Rust development.
Browse courses on Web Development
Show steps
  • Review the basics of HTTP methods (GET, POST, PUT, DELETE).
  • Practice creating simple HTML forms and handling user input.
  • Familiarize yourself with CSS selectors and basic styling techniques.
Read 'The Rust Programming Language'
Gain a solid understanding of Rust's core principles and syntax by working through the official Rust book.
Show steps
  • Work through the book, paying close attention to the ownership and borrowing chapters.
  • Complete the exercises at the end of each chapter to reinforce your understanding.
  • Refer back to the book as needed throughout the course.
Four other activities
Expand to see all activities and additional details
Show all seven activities
Build a Simple REST API with Axum
Practice building a basic REST API using Axum to solidify your understanding of server-side Rust development.
Show steps
  • Set up a new Rust project with Axum as a dependency.
  • Define routes for basic CRUD operations (Create, Read, Update, Delete).
  • Implement handlers for each route to interact with a simple data store (e.g., a HashMap).
  • Test your API using a tool like curl or Postman.
Document Your Learning Journey
Improve retention by documenting your learning process, including challenges faced and solutions found.
Browse courses on Rust
Show steps
  • Create a blog or online notebook to record your progress.
  • Write about new concepts learned, code snippets, and project updates.
  • Reflect on challenges encountered and how you overcame them.
Contribute to a Rust Project
Deepen your understanding of Rust by contributing to an open-source project, gaining experience with real-world codebases and collaboration.
Browse courses on Rust
Show steps
  • Find a Rust project on GitHub that interests you.
  • Look for issues labeled 'good first issue' or 'help wanted'.
  • Submit a pull request with your changes.
Deploy Your Full-Stack Application
Solidify your full-stack skills by deploying your application to a cloud platform, gaining experience with infrastructure and DevOps.
Browse courses on Deployment
Show steps
  • Choose a cloud platform (e.g., Heroku, AWS, Google Cloud).
  • Configure your application for deployment.
  • Set up a CI/CD pipeline for automated deployments.
  • Monitor your application's performance and troubleshoot any issues.

Career center

Learners who complete Learn Full Stack Rust Programming using AXUM, Yew, and SQLx will develop knowledge and skills that may be useful to these careers:
Rust Engineer
A Rust Engineer specializes in developing software using the Rust programming language. This course is highly relevant to this role. It provides a full stack experience using Rust that includes both front end and back end development. The course syllabus' focus on building a functional CRUD API using AXUM, SQLx and Postgres is directly applicable to the work of a Rust engineer. Additionally, the course teaches how to connect a frontend, built with the Yew framework, to the backend. The full stack skills taught in this course will be applicable to many different kinds of Rust projects.
Full-Stack Web Developer
A Full Stack Web Developer works on both the front-end and back-end of web applications. This course is directly aligned with this role as it guides a learner through the process of building a complete full stack web application using Rust. The course covers essential aspects of both front end development with Yew and back end development with AXUM and SQLx. Furthermore, it teaches how to connect the two. The course emphasizes practical experience with topics such as API development, data handling, routing, and form creation, all of which are critical skills for a full stack developer, and it demonstrates how to use the Rust language in that work. This focused approach makes this course an excellent choice for anyone looking to become a full stack web developer.
Rust Software Developer
A Rust Software Developer builds robust, high-performance applications using the Rust programming language. This course is particularly relevant to this career, as it provides hands-on experience building a full-stack web application using Rust, specifically focusing on using AXUM for the backend and Yew for the frontend. It is also relevant because it teaches how to connect the frontend and backend. The course's curriculum on topics such as variables, functions, data types, control flow, structs, enums, JSON, hashmaps, modules, ownership and borrowing in Rust is directly applicable to the daily tasks of a Rust developer. Moreover, it covers web development-specific libraries and frameworks such as AXUM, SQLx, and Yew, which are essential for many projects.
Web Application Developer
A Web Application Developer designs and creates web applications, often dealing with both the frontend and backend aspects. This course provides hands-on experience in building a full-stack web application using Rust, which is why it is highly helpful for this role. The course covers the essential skills needed for web application development, including front-end development with Yew, back-end development with AXUM and SQLx and full stack principles, like connecting the frontend and backend. The focus on building a real-world CRUD application will ensure that a web application developer will be able to use the concepts he learns here to expand his development options.
API Developer
An API Developer designs, develops, and maintains Application Programming Interfaces (APIs). This course is helpful for API Developers, because it provides direct experience building a RESTful API using Rust with the AXUM framework. The course delves into creating CRUD operations, which are fundamental to building RESTful APIs. Moreover, it covers how to connect the frontend and backend. It also provides an introduction to using Postgres for data storage with SQLx. This course provides a strong foundation for API development projects, and the skills taught will translate well to larger or more complex projects.
Backend Engineer
A Backend Engineer is responsible for the server-side logic of applications, including databases and APIs. This course is useful for aspiring backend engineers, as it provides in-depth knowledge of backend development using Rust and the AXUM framework. It will also teach them about data handling with SQLx and Postgres. The course emphasizes hands-on experience in building CRUD APIs, which is a fundamental skill for backend development. Furthermore, the course covers essential concepts in Rust such as ownership and borrowing, which would help to write high-performance code. For these reasons, this course is valuable for anyone aiming to specialize in backend engineering.
Frontend Developer
A Frontend Developer focuses on creating user interfaces for websites and applications. A particular focus is on how users interact with a webpage. This course is relevant for frontend developers, as it provides the necessary skills to build frontend applications using the Yew framework in Rust. The course covers important topics such as component creation, routing, form handling, and connecting to backend APIs. By building a functional frontend application in Rust, using the Yew framework, this course would help build a foundation in modern frontend technologies. It will be beneficial for the aspiring frontend developer to see how the front and back end interact.
Software Engineer
A Software Engineer designs, develops, and maintains software systems. This course may be useful for software engineers, as it introduces Rust, a modern programming language increasingly used in the industry. The course will teach Rust fundamentals like data structures and control flow, and it will also teach a learner how to build a full stack web app. It provides hands-on experience in building a real-world application using the Rust programming language, which would be helpful to apply to future software engineering projects. The course material, as a whole, would provide beneficial knowledge for a software engineer.
Web Services Developer
A Web Services Developer is involved in creating and maintaining web-based software applications and services. This course may be useful for Web Services Developers, as it focuses on building a full-stack web application using Rust. The course includes training on both front-end development with the Yew framework and back-end development with AXUM. It is also beneficial insofar as it covers connecting the frontend and backend. The course will give a web services developer experience with using the rust language for both client and server side services.
Database Engineer
A Database Engineer is responsible for designing, implementing, and maintaining databases. This course may be useful to a Database Engineer insofar as it provides an introduction to using Postgres with SQLx. The course teaches a learner how to integrate a Postgres database into a backend server application. It also teaches how to use a backend API to connect to this database. This knowledge will be applicable to database integration projects and would expand a database engineer's general skillset.
Cloud Developer
A Cloud Developer builds and maintains applications on cloud platforms. This course is moderately useful to a Cloud Developer, as many cloud services are backed by APIs. This course provides an introduction to building a CRUD API with the AXUM framework. Additionally, it teaches a learner how to connect a frontend client to this API. The learner will also be exposed to data handling with SQLx and Postgres. This experience will help a cloud developer architect and build cloud-native applications.
Software Architect
A Software Architect is responsible for making high-level design choices for software systems. This course may be useful to a Software Architect, because it introduces the Rust programming language and some of its features. It shows one common method of designing a full stack application using Rust, and it introduces the concepts of creating an API backend and a frontend client. The knowledge gained from this course may help a software architect understand the design considerations of projects using Rust.
DevOps Engineer
A DevOps Engineer works to bridge the gap between development and operations, ensuring smooth deployment and management of software. This course may be helpful to a DevOps Engineer, because it teaches a learner how to package and deploy a full stack application. The course teaches how to build both an API backend with AXUM and a frontend with Yew. Furthermore, it teaches how to connect the two. Understanding how a web application is constructed is useful for any DevOps role.
Technical Lead
A Technical Lead manages and guides a team of developers, often having a strong technical background themselves. This course may be helpful to a technical lead who wants to understand Rust better. The course includes a full stack web application, and the technical lead will gain experience with the different libraries and frameworks used in such a project. The course curriculum includes backend development with AXUM, front end development using Yew, and will help the technical lead evaluate and guide such projects.
Solutions Architect
A solutions architect is responsible for the high level design of large software systems. This course may be helpful to a solutions architect, because it gives an introduction to Rust. The course will teach the learner how to construct a full stack application with a rust backend. The learner will also learn about some of the patterns and practices of building web applications including creating a RESTful API. The skills learned here will likely be applicable to many systems.

Reading list

We've selected one books that we think will supplement your learning. Use these to develop background knowledge, enrich your coursework, and gain a deeper understanding of the topics covered in Learn Full Stack Rust Programming using AXUM, Yew, and SQLx.
Is the official guide to Rust and provides a comprehensive introduction to the language. It covers everything from basic syntax to advanced concepts like ownership and borrowing. It must-read for anyone learning Rust and serves as a valuable reference throughout the course. This book is commonly used as a textbook at academic institutions and by industry professionals.

Share

Help others find this course page by sharing it with your friends and followers:

Similar courses

Similar courses are unavailable at this time. Please try again later.
Our mission

OpenCourser helps millions of learners each year. People visit us to learn workspace skills, ace their exams, and nurture their curiosity.

Our extensive catalog contains over 50,000 courses and twice as many books. Browse by search, by topic, or even by career interests. We'll match you to the right resources quickly.

Find this site helpful? Tell a friend about us.

Affiliate disclosure

We're supported by our community of learners. When you purchase or subscribe to courses and programs or purchase books, we may earn a commission from our partners.

Your purchases help us maintain our catalog and keep our servers humming without ads.

Thank you for supporting OpenCourser.

© 2016 - 2025 OpenCourser