GitPedia

Rustapi

๐Ÿš€ RESTful Rust API Template / Boilerplate

From ndelvalleยทUpdated June 8, 2026ยทView on GitHubยท

RESTful API template built with Rust lang. It uses [MongoDB](https://docs.mongodb.com/) database and [Axum](https://github.com/tokio-rs/axum) HTTP framework. The project is written primarily in Rust, first published in 2019. Key topics include: api, axum, boilerplate, mongodb, restful.

rustapi

Tests

RESTful API template built with Rust lang. It uses MongoDB
database and Axum HTTP framework.

Requirements

How to use this template

To use this template as your project starting point, click "Use this template" at the top of this page, or click here.

Feature highlights

  • Authentication. Based on jsonwebtoken
  • Layered configuration. Based on config-rs
  • Logs. Based on tracing
  • Error handling
  • Pagination
  • E2E Tests
  • OpenAPI Specification
  • CI based on Github actions
  • Dependabot configuration

Project structure

bash
โ”œโ”€โ”€ Cargo.lock โ”œโ”€โ”€ Cargo.toml โ”œโ”€โ”€ README.md โ”œโ”€โ”€ config โ”‚ย ย  โ”œโ”€โ”€ default.json # Default configuration โ”‚ย ย  โ”œโ”€โ”€ production.json # Production configuration (Overwrites the default) โ”‚ย ย  โ””โ”€โ”€ test.json # Test configuration (Overwrites the default) โ”œโ”€โ”€ rustfmt.toml โ”œโ”€โ”€ src โ”‚ย ย  โ”œโ”€โ”€ database.rs โ”‚ย ย  โ”œโ”€โ”€ errors.rs โ”‚ย ย  โ”œโ”€โ”€ lib # Helpers not related to the business model โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ authenticate_request.rs โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ date.rs โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ mod.rs โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ models.rs # Base Database Model trait โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ to_object_id.rs โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ token.rs โ”‚ย ย  โ”œโ”€โ”€ logger.rs โ”‚ย ย  โ”œโ”€โ”€ main.rs โ”‚ย ย  โ”œโ”€โ”€ models โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ cat.rs โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ mod.rs โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ user.rs โ”‚ย ย  โ”œโ”€โ”€ routes โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ cat.rs โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ mod.rs โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ status.rs โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ user.rs โ”‚ย ย  โ”œโ”€โ”€ settings.rs โ”‚ย ย  โ””โ”€โ”€ tests # E2E Tests โ””โ”€โ”€ test.sh

Test

To run tests make sure MongoDB is up and running.

make test

Contributing

Contributors are welcome, please fork and send pull requests! If you find a bug
or have any ideas on how to improve this project please submit an issue.

Contributors

Showing top 9 contributors by commit count.

View all contributors on GitHub โ†’

This article is auto-generated from ndelvalle/rustapi via the GitHub API.Last fetched: 6/25/2026