[go: up one dir, main page]

Skip to content

ndelvalle/rustapi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

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

β”œβ”€β”€ 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.