Skip to content

Backend application. Using Rust, Axum, PostgreSQL as database, Docker, tokio-postgres and more.

License

Notifications You must be signed in to change notification settings

mkbeh/rust-simple-chat

Repository files navigation

Rust Axum and Postgresql - microservice example

Platform GitHub license

Backend stack using Rust , including interactive API documentation and many useful features out of the box.

Full list what has been used:

  • axum - web application framework
  • clap - command line argument parser
  • tokio-postgres - an asynchronous, pipelined, PostgreSQL client
  • deadpool-postgres - dead simple async pool for connections and objects of any type
  • validator - struct validator
  • jsonwebtoken - json web token
  • tracing - a scoped, structured logging and diagnostics system
  • utoipa - provides auto-generated OpenAPI documentation for Rust REST APIs

Interactive API documentation

img.png

How to use it

Generate passwords

You will be asked to provide passwords and secret keys for several components. Open another terminal and run:

openssl rand -hex 32
# Outputs something like: 99d3b1f01aa639e4a76f4fc281fc834747a543720ba4c8a8648ba755aef9be7f

How to deploy

docker-compose up --build -d

Swagger UI

http://localhost:9000/swagger-ui

Redoc UI

http://localhost:9000/redoc

Scalar UI

http://localhost:9000/scalar

Rapidoc UI

http://localhost:9000/rapidoc