The goal of this repository is to have a real world template of a Rust backend using Axum, Diesel, etc.

Overview

Axum Diesel Real-World Example

GitHub stars GitHub license GitHub issues

A modular Rust backend template based on the Domain-Driven Design (DDD) architecture, utilizing the Axum and Diesel frameworks. This repository serves as a starting point for building real-world applications in Rust, with different modules and frameworks to choose from.

Table of Contents

Introduction

This repository provides a boilerplate for developing Rust backend applications following the principles of Domain-Driven Design (DDD). It leverages the power of Axum for building asynchronous APIs and Diesel for working with databases.

Features

  • Domain-Driven Design (DDD) architecture.
  • Integration with Axum for building asynchronous APIs.
  • Integration with Diesel for database operations.
  • Modular project structure for easy extension and maintainability.
  • Authentication modules with OAuth (optional).

Getting Started

Follow these steps to get started with your Rust backend project based on this template:

  1. Clone this repository:

    git clone https://github.com/Quentin-Piot/axum-diesel-real-world.git
  2. Choose a specific module/framework branch or work with the default configuration.

  3. Customize the project to your needs.

  4. uild and run your Rust backend:

    cargo run

Project Structure

The project follows a modular structure to keep your code organized and maintainable. Here's a brief overview of the project structure:

  • src/: Contains the main source code of your application.

    • domain/: Define your domain logic using DDD principles.
      • models/: Define your domain models.
    • handlers/: Define your API handlers.
    • infra/: Define your infrastructure logic.
      • db/: Define your database logic.
      • repositories/: Define your repositories.
    • utils/: Define your utility functions.
      • custom_extractors/: Define your custom extractors for Axum.
    • main.rs: Application entry point.
    • routes.rs: Define your API routes.
    • config.rs: Define your application configuration : use OnceCell for static config file.
    • error.rs: Define your custom global error types.
  • migrations/: Database migration files for Diesel (if applicable).

License

This project is licensed under the MIT License.

You might also like...
A brief implementation of a simple hello world program in rust since they said it couldn't be done.

rust-hello-world A brief blazingly fast 🚀 implementation of a simple hello world program in rust since they said it couldn't be done. 🚀 fast 🚀 Also

Rust/Axum server implementation with PCR(Prisma Client Rust)
Rust/Axum server implementation with PCR(Prisma Client Rust)

Realworld Rust Axum Prisma This project utilizes Rust with the Axum v0.7 framework along with the Prisma Client Rust to build a realworld application.

Rust HTTP API Template using PostgreSQL, Redis, RabbitMQ, and Hexagonal Architecture

Rust Template HTTP API Rust API Template using PostgreSQL, Redis, RabbitMQ, and Hexagonal Architecture The following template provides a basic structu

Demo of Rust and axum web framework

Demo of Rust and axum web framework Demonstration of: Rust: programming language that focuses on reliability and stability. axum: web framework that f

Rust Axum+SQLx Sample

rust-axum-sqlx-sample Install git clone https://github.com/web3ten0/rust-axum-sqlx-1.git cd rust-axum-sqlx-1/local docker-compose up -d sh scripts/exe

Rust Axum Full Course code.

Rust Axum Full Course source code. YouTube Full Course: https://youtube.com/watch?v=XZtlD_m59sM&list=PL7r-PXl6ZPcCIOFaL7nVHXZvBmHNhrh_Q MIT OR Apache,

Rust server with Axum, GraphQL and SurrealDb
Rust server with Axum, GraphQL and SurrealDb

📜️ Article on my web Axum server, Async-GraphQl, SurrealDB template Run without any prior setup, DB is in memory: cargo run To use routes other than

Axum web framework tutorial for beginners.

Axum Tutorial For Beginners Hello web developers! This tutorial will cover how to write simple web applications in rust with axum framework. If you ar

Yew + Axum + blog = Yab

Yew + Axum + blog = Yab

Owner
Quentin Piot
Fullstack engineer also interested in system languages and gaming development
Quentin Piot
Code template for a production Web Application using Axum: The AwesomeApp Blueprint for Professional Web Development.

AwesomeApp rust-web-app More info at: https://awesomeapp.dev/rust-web-app/ rust-web-app YouTube episodes: Episode 01 - Rust Web App - Course to Produc

null 45 Sep 6, 2023
axum-serde is a library that provides multiple serde-based extractors and responders for the Axum web framework.

axum-serde ?? Overview axum-serde is a library that provides multiple serde-based extractors / responses for the Axum web framework. It also offers a

GengTeng 3 Dec 12, 2023
A highly customizable, full scale web backend for web-rwkv, built on axum with websocket protocol.

web-rwkv-axum A axum web backend for web-rwkv, built on websocket. Supports BNF-constrained grammar, CFG sampling, etc., all streamed over network. St

Li Junyu 12 Sep 25, 2023
Jotsy is a self-hosted, free and open-source note taking app with a goal of simplicity in mind

Jotsy: Just your notes Jotsy is a self-hosted, free and open-source note taking app with a goal of simplicity in mind. It is powered by Skytable. Read

Sayan 433 Dec 30, 2022
This is a simple Api template for Rust ( Axum framework )

Axum-Rust-Rest-Api-Template This project is an open source Rest Api Template built with Rust's Axum framework. Why this project? I have been learning

Thani 20 Jun 16, 2023
Layers, extractors and template engine wrappers for axum based Web MVC applications

axum-template Layers, extractors and template engine wrappers for axum based Web MVC applications Getting started Cargo.toml [dependencies] axum-templ

Altair Bueno 11 Dec 15, 2022
Starter template for use with the Leptos web framework and Axum.

Leptos Axum Starter Template This is a template for use with the Leptos web framework and the cargo-leptos tool using Axum. Creating your template rep

Leptos 10 Mar 4, 2023
A Rust Boilerplate server with GraphQL API, Diesel, PostgreSQL, session authentication and JWT

Canduma rust Graphql A Rust authentication server with GraphQL API, Diesel, PostgreSQL session authentication and JWT This repository contains a Graph

Julien Lenne 738 Dec 28, 2022
Experiments with Rust CRDTs using Tokio web application framework Axum.

crdt-genome Synopsis Experiments with Rust CRDTs using Tokio web application framework Axum. Background Exploring some ideas of Martin Kleppmann, part

dougfort 3 Mar 18, 2022
JWT Authentication in Rust using Axum Framework

Are you interested in building a secure authentication system for your Rust web application? Look no further than the Axum framework and JSON Web Tokens (JWTs)! Axum is a fast and scalable Rust web framework that provides a reliable and efficient platform for developing microservices and APIs.

CODEVO 16 Jun 11, 2023