Skip to content

Latest commit

 

History

10 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RESTful Rust CRUD API

CI within Docker

A CRUD API built with Rust, Axum, SQLx, Postgres, and a REST architectural style.

Tech Stack

  • Language: Rust
  • Framework: Axum (0.8)
  • SQL Toolkit: SQLx
  • Database: PostgreSQL
  • Containerization: Docker & Docker Compose
  • CI: GitHub Actions

Project Structure

The main application is broken up into two major layers: DB & API.

DB

The DB layer allows communication with the Postgres database. The main feature is an utility created in order to make querying the database much cleaner. Normally, when using prepared statements with SQLx, one would have to bind each argument individually. However, the utility creates a layer that does that for you.

Definition of the utility: utils

Usage of the utility: rest

API

The API layer handles HTTP requests and exchanges data in JSON. This layer defines the URIs for the REST resources and uses the resource-methods defined in the DB layer. In order to perform CRUD (Create, Read, Update, Delete) operations, the resource-methods are mapped to standard HTTP-methods: POST, GET, PUT, DELETE. Then, all of the endpoints are unified together for Axum to serve.

About

A showcase of a simple Rust Axum project-structure I designed. 🦀

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages