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

Platform GitHub license GitHub CI

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
  • utoipa - provides auto-generated OpenAPI documentation for Rust REST APIs
  • tracing - a scoped, structured logging and diagnostics system
  • opentelemetry - implements the API component of OpenTelemetry
  • prometheus - the Rust client library for Prometheus
  • mockall - provides tools to create mock versions of almost any trait or struct. They can be used in unit tests as a stand-in for the real object

Interactive API documentation

img

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

Prometheus

http://localhost:9007/metrics

Jaeger UI

http://localhost:16686/search