Skip to content

RESTful Todo API with Actix-web and SeaORM. Documented by swagger-ui

License

Notifications You must be signed in to change notification settings

TheAwiteb/oxide_todo

Repository files navigation

Oxide Todo

Oxide Todo is RESTful API built with Actix and SeaORM. Documented by swagger-ui. Authenticated by JWT. Rate limited by actix_extensible_rate_limit. Tested by rstest. Have fun! 😁

CI

Prerequisites

  • Rust (Minimum Supported Rust Version: 1.65.0)

Usage

Clone the repository and run the following commands:

cargo run

Just like that, you have a RESTful API running on your machine. If you want to see the logs, you can run the following command:

RUST_LOG=debug cargo run

Documentation

Environment variables

Rename the .env.example file to .env and change the values to your needs. Empty default means that the variable is required.

Name Description Default
DATABASE_URL The database url sqlite://db.sqlite3
SECRET_KEY The secret key for JWT
HOST The host to bind localhost
PORT The port to run the server 8080
RATE_LIMIT_BURST_SIZE The burst size for rate limiter 30
RATE_LIMIT_PER_SECOND The time to reset the burst 60
API_CONTACT_NAME The name of the API contact
API_CONTACT_URL The url of the API contact
API_CONTACT_EMAIL The email of the API contact
API_TITLE The title of the API RESTful Todo API documentation

Testing

Prerequisites

just tests

Development

For development you need to install just and dotenv-cli. With just you can run all needed commands with one command, type just folloing by the command you want to run.
Available commands:

  • just build to build the RESTful API
  • just ci to run the CI
  • just fmt to format everything
  • just fmt-check to check the format of everything
  • just linter to run Rust linter (clippy)
  • just tests to run the tests

Soon

  • Swagger UI for API documentation
  • Rate limiting
  • CI with Github Actions
  • Unit tests
  • Dockerize the server
  • JustFile for easy setup, useing just

License

This project is licensed under the MIT License - see the LICENSE file for details