0PricingLogin
Learn Rust Coding · Lesson

Project Setup

Structure the API.

Building a REST API in Rust

In this course you will build a small REST API in Rust. We use the Axum web framework, which is built on Tokio (async runtime) and Tower (middleware). It is ergonomic, type-safe, and widely used in production.

This first lesson sets up the project structure so later lessons can add routes, models, a database, and tests.

Creating the Project

Start with Cargo. A binary project gives you a src/main.rs entry point:

  • cargo new rest_api creates the folder.
  • cd rest_api moves into it.
  • cargo run builds and runs.

These are shell and cargo commands, not runnable Rust snippets.

// terminal
// cargo new rest_api
// cd rest_api
// cargo run

All lessons in this course

  1. Project Setup
  2. Endpoints and Models
  3. Database Integration
  4. Testing the API
← Back to Learn Rust Coding