We may earn an affiliate commission when you visit our partners.
Afaan Bilal

In this course, we'll create a REST API server in Rust to represent a bookstore. This bookstore would allow us to add books and authors.

Using this system, we'll be able to:

  • Create, list, update and delete authors

  • Create, list, update and delete books

  • Associate and disassociate books and authors

  • List all books by a particular author

We'll learn how to:

  • Create a new Rust project using cargo

  • Build and run our Rust project

  • Add crates and enable crate features

Read more

In this course, we'll create a REST API server in Rust to represent a bookstore. This bookstore would allow us to add books and authors.

Using this system, we'll be able to:

  • Create, list, update and delete authors

  • Create, list, update and delete books

  • Associate and disassociate books and authors

  • List all books by a particular author

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

  • Creating and 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

  • Create and run database migrations

  • Create one-to-many database relationships

  • Create entities from database tables

We'll have a bonus 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. Rocket: a web framework for Rust that makes it simple to write fast, secure web applications without sacrificing flexibility, usability, or type safety.

  2. SeaORM: is a relational ORM to help you build web services in Rust.

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

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

Enroll now

Here's a deal for you

We found an offer that may be relevant to this course.
Save money when you learn. All coupon codes, vouchers, and discounts are applied automatically unless otherwise noted.

What's inside

Learning objectives

  • Create a rust project
  • Create a rest api server using rocket
  • Interacting with a database using seaorm
  • Authenticating apis using jwt
  • Writing database migrations using seaorm cli

Syllabus

Introduction
Designing the database structure
Creating a Rust project
Understanding directory structure
Read more

Let's see if we understand the basics of setting up a new Rust project.

Rocket website: rocket.rs

Add the following to your Cargo.toml under [dependencies]:

rocket = { version = "^0.5.0-rc.2", features = ["json"] }

main.rs

#[macro_use] extern crate rocket;

#[get("/")]

fn index() -> &'static str {

    "Hello, world!"

}

#[launch]

fn rocket() -> _ {

    rocket::build().mount("/", routes![index])

}

Traffic lights

Read about what's good
what should give you pause
and possible dealbreakers
Uses Rocket, a web framework for Rust, which simplifies the creation of fast and secure web applications while maintaining flexibility and type safety
Employs SeaORM, a relational ORM, to assist in constructing web services in Rust, streamlining database interactions and management
Covers authentication using JWT, a standard method for securing APIs and ensuring only authorized users can access protected resources
Includes a bonus lecture on Dockerizing the API server, enabling learners to deploy and run their applications in various environments
Requires the use of Rocket version 0.5.0-rc.2, which may present compatibility issues or require adjustments for users familiar with newer releases
Teaches database migrations using SeaORM CLI, which may require learners to install and configure additional command-line tools

Save this course

Create your own learning path. Save this course to your list so you can find it easily later.
Save

Reviews summary

Practical rust api development with rocket & seaorm

According to learners, this course provides a solid foundation and practical experience in building API servers using Rust, Rocket, SeaORM, and JWT. Many students highlight the hands-on project approach as particularly useful for understanding how these components work together. The course is praised for its clear explanations of complex concepts and libraries like SeaORM and JWT. While the course is largely seen as very positive, some reviewers noted that the initial setup can be challenging and that a basic understanding of Rust is beneficial, although the instructor often provides guidance.
Assumes some familiarity with Rust basics.
"This course is probably best if you already have a grasp of core Rust concepts like ownership and lifetimes."
"While not strictly required, having some Rust background will make the course much smoother."
"If you're completely new to Rust, you might find the pace quick."
Helps understand Rocket, SeaORM, JWT.
"The explanations of SeaORM and JWT were particularly clear and easy to follow."
"Instructor does a great job of breaking down how Rocket routing and state management works."
"I gained a much better understanding of how to integrate SeaORM into a Rocket application."
Building a real API is very helpful.
"The hands-on coding and projects are the strongest part of the course for me."
"I really liked building a real API from scratch, it helped solidify the concepts."
"Working through the bookstore API project was a great way to see Rocket and SeaORM in action."
Some dependencies may need updating.
"Had to update some dependencies to get the code to compile with the latest Rust version."
"Be aware that library versions might change, requiring small code adjustments."
"I found that the versions used required minor tweaks to work on my system."
Initial environment setup can be tricky.
"Getting the database and initial Rocket setup working took some trial and error outside the course steps."
"I struggled a bit with the environment setup, especially database connections."
"Be prepared to troubleshoot setup issues, though the core material is good."

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 Creating an API server in Rust with Rocket, SeaORM and JWT with these activities:
Review Basic Rust Syntax
Reviewing Rust syntax will help you better understand the code examples and implement the API server more effectively.
Show steps
  • Read the official Rust documentation on basic syntax.
  • Complete online Rust tutorials focusing on syntax.
  • Write small Rust programs to practice syntax.
Review REST API Concepts
Reviewing REST API concepts will help you understand how the API server is structured and how to interact with it.
Browse courses on REST API
Show steps
  • Read articles on REST API principles and best practices.
  • Study examples of REST API designs.
  • Familiarize yourself with HTTP methods (GET, POST, PUT, DELETE).
Read 'The Rust Programming Language'
Reading 'The Rust Programming Language' will provide a solid foundation in Rust and help you understand the more advanced concepts used in the course.
Show steps
  • Read the chapters relevant to web development and API design.
  • Work through the examples and exercises in the book.
Five other activities
Expand to see all activities and additional details
Show all eight activities
Build a Simple CRUD API
Building a simple CRUD API will allow you to practice the concepts learned in the course and solidify your understanding of Rocket, SeaORM, and JWT.
Show steps
  • Set up a new Rust project with Rocket and SeaORM.
  • Define database models for a simple entity (e.g., a task).
  • Implement CRUD operations (Create, Read, Update, Delete) for the entity.
  • Add basic authentication using JWT.
Practice SeaORM Queries
Practicing SeaORM queries will improve your ability to interact with the database and retrieve data efficiently.
Show steps
  • Set up a local database with sample data.
  • Write SeaORM queries to filter, sort, and join data.
  • Experiment with different query builders and operators.
Read 'Rust Web Development'
Reading 'Rust Web Development' will provide practical guidance on building web applications with Rust and complement the course material.
Show steps
  • Focus on the chapters covering Rocket and database integration.
  • Compare the approaches in the book with the course's methods.
Write a Blog Post on JWT Authentication in Rust
Writing a blog post will help you solidify your understanding of JWT authentication and share your knowledge with others.
Show steps
  • Research JWT authentication principles and best practices.
  • Implement JWT authentication in a Rust project.
  • Document the implementation process in a blog post.
Contribute to a Rocket or SeaORM Project
Contributing to open-source projects will provide valuable experience and allow you to learn from other developers.
Show steps
  • Find a Rocket or SeaORM project on GitHub.
  • Identify a bug or feature to work on.
  • Submit a pull request with your changes.

Career center

Learners who complete Creating an API server in Rust with Rocket, SeaORM and JWT will develop knowledge and skills that may be useful to these careers:
API Developer
An API developer specializes in designing, building, and maintaining application programming interfaces. This course is an excellent starting point for an API developer because it teaches how to create a REST API server, handle routing and requests, authenticate users with JWT, and interact with databases using SeaORM. Additionally, the course specifically uses the Rocket framework, and also teaches how to work with JSON. This course goes through the specifics of creating an API for a bookstore, giving the student experience in creating and consuming data. These are all essential skills for an API developer, and a good reason to take this course.
Backend Engineer
A backend engineer is responsible for building and maintaining the server-side logic of applications, including APIs. This course helps build a foundation for a career as a backend engineer by teaching how to create a REST API server using Rust, Rocket, SeaORM, and JWT for authentication. Specifically, the course covers essential skills for handling requests, interacting with databases, managing authentication, and creating database relationships, all of which are common tasks for a backend engineer. Learning to use Rust, a language known for its performance and safety, can help make one a very strong candidate for this role. Knowledge in using Rocket, SeaORM, and JWT libraries can serve as valuable experience.
Full-Stack Developer
A full stack developer is involved in both front-end and back-end development. This course helps a full stack developer be well-equipped to handle backend responsibilities by providing the knowledge of how to build an API server using Rust, Rocket, SeaORM, and JWT. The course covers creating routes, extracting data from requests, interacting with databases, authenticating users, and managing database relationships. Given the breadth of topics covered by this course, anyone wishing to become a full stack developer can use its lessons to help build a solid foundation. The skills learned can easily be applied to a variety of full stack projects.
Software Developer
A software developer creates a wide range of programs, including web applications and server-side systems. This course can help a software developer build a strong understanding of how to create a robust and secure API server using Rust, a high-performance language. The course provides hands-on experience with routing, database interactions, and authentication using JWT, which are fundamental components in many software projects. The course additionally covers how to create one-to-many database relationships. Any student seeking to improve their skills or begin a career in software development, should take the course.
Application Developer
An application developer creates software applications for various purposes. This course teaches how to create a server-side application using Rust, which is essential to many applications today. Specifically, it teaches how to use the Rocket framework to manage requests and responses, and SeaORM for database access. This provides a strong foundation for an application developer. The course further covers concepts of authentication using JWT, and gives a broad understanding of systems used by an application. For anyone looking into becoming an application developer, this course is helpful.
Web Developer
A web developer builds and maintains websites and their underlying systems. This course is directly relevant to web developers who work with backend systems, as it teaches how to create a REST API server using Rust and the Rocket framework. This course may be helpful to web developers because it includes lessons in handling HTTP requests, interacting with databases using SeaORM, and securing APIs with JWT. The course also covers concepts like CORS, which is critical knowledge for any professional in web development. This course is highly practical for any web developer interested in expanding to a full-stack role.
API Integrator
An API integrator connects and manages various APIs to create seamless workflows. This course is a good way to learn many of the fundamental principles of API design and how to build APIs effectively. The course takes the learner through creating routes, handling requests, setting up databases, and securing an API using JWT, which are important components when integrating APIs into a larger system. Anyone interested in becoming an API integrator should find this course helpful in understanding the fundamentals of API development.
DevOps Engineer
A DevOps engineer focuses on automating and optimizing the software development lifecycle. This course can be helpful for a DevOps engineer because it teaches how to dockerize an API server, enabling the student to deploy and run the server anywhere. The course uses Rust, a language that is often used in systems which DevOps engineers often work with. The skills learned in this course can provide a foundation for learning new complex concepts in DevOps, and a good reason to take it.
Systems Engineer
A systems engineer works with the infrastructure and architecture of computing systems. This course can be useful for a systems engineer as it teaches how to build an API server and how to dockerize that server. The course provides a pragmatic approach to creating an API, with a bonus lecture on how to run it anywhere using Docker. This course goes over using rust, which is a language often used by systems engineers, specifically in high-performance and low-level tasks. The course provides useful knowledge to anyone in the field of systems engineering.
Database Engineer
A database engineer designs, implements, and maintains database systems. While this course is not solely focused on database engineering, it does provide valuable experience in interacting with databases using SeaORM, specifically teaching how to query and insert data, create database relationships, and run database migrations. The course focuses on using a database in the context of an API server, and can be a great way to learn how important this is. The course touches on database concepts that could help someone seeking to become a database engineer.
Cloud Engineer
A cloud engineer builds and manages cloud infrastructure and services. This course may be useful to a cloud engineer because it teaches how to dockerize an application, which is a skill that is very important in cloud deployments. The course goes through setting up a database, which is essential in the cloud, as well as how to create an API server. While not focused entirely on a cloud environment, this course does offer some relevant skills that a cloud engineer might use.
Software Architect
A software architect designs the high-level structure of software systems. Although more experience is typically required for this role, this course can help an aspiring software architect by showing how API servers are structured. The course covers important topics such as authentication and how to design API routes. The course provides hands-on experience in creating an API server from start to finish. This course helps with understanding the architecture of a typical API server, which helps a software architect.
Solutions Architect
A solutions architect designs comprehensive technical solutions to meet business needs. This course may be helpful for a solutions architect, by teaching the learner how to create a REST API server using Rust. This course gives an example of designing a system, which could be valuable in understanding the kind of practical considerations that are needed. This course also covers many technologies that would be found in modern systems, such as Rocket, SeaORM, and JWT. This course goes over system design and implementation, which may be helpful to a solutions architect.
Technical Lead
A technical lead oversees a team of developers and guides technical decisions. This course may be useful for a technical lead because it covers a comprehensive approach to designing an API server. Specifically, the course focuses on creating a robust and secure system using Rust, Rocket, SeaORM, and JWT. The concepts taught would provide help in mentoring other developers, and help make better informed decisions. This course also provides a good example of a practical application of these technologies, which would be useful for a technical lead.
Software Consultant
A software consultant provides expert advice and guidance on software projects. This course could be useful for a software consultant by providing hands-on experience in building a REST API server using Rust, which is an in-demand skill. The technologies taught in the course, such as Rocket, SeaORM, and JWT, are all useful to know. The course gives practical examples of how to implement a functional, secure API, which can be a good frame of reference for a consultant. The skills developed in this course might be helpful for a consultant.

Reading list

We've selected two 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 Creating an API server in Rust with Rocket, SeaORM and JWT.
Is the official guide to Rust programming. It provides a comprehensive overview of the language, including syntax, data structures, and concurrency. It is particularly useful for understanding the underlying principles of Rust and writing efficient code. This book is commonly used as a textbook at academic institutions.
Focuses specifically on web development in Rust. It covers topics such as web frameworks, databases, and deployment. It valuable resource for learning how to build web applications using Rust. This book adds more depth to the existing course by providing a more focused approach to web development.

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