Rust, Software Development

REST API with Rust, Actix-web, and PostgreSQL – Part 1

Last Updated on

This is the first part post that demonstrates a simple example of a REST API with Rust, Actix-web, and PostgreSQL.


These are the items used for these posts and the subsequent ones.

1. Windows 10

Please see How to install Rust in Windows 10

2. Docker for Windows

Install Docker for Windows. These posts use Docker to create PostgreSQL container.

3. docker-compose.yml for PostgreSQL

Please see docker-compose.yml for PostgreSQL. The same username and password are used for the codes.

4. Database Table

We use a single table called persons. Create the table using the DDL below.

5. IntelliJ IDEA

Install the IntelliJ Rust plugin and create a new project.

6. Rust 1.37.0

Install it via rustup-init.exe.

Update Cargo.toml

The three crates in used are – postgres, actix-web, and serde.


We need postgres to access our PostgreSQL database running as a Docker container.


Actix-web is a framework for creating web applications with Rust. This is like Spring-web from Spring and Java.


Serde is for the deserialization and serialization of HTTP requests and HTTP responses, respectively.

You Might Also Like