Oxide Todo
February 17, 2023 ยท View on GitHub
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! ๐
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
- The API documentation is available at
{HOST}:{PORT}/docs/swagger/(default: http://localhost:8080/docs/swagger/) - The OpenAPI specification is available at
{HOST}:{PORT}/docs/openapi.json(default: http://localhost:8080/docs/openapi.json)
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 buildto build the RESTful APIjust cito run the CIjust fmtto format everythingjust fmt-checkto check the format of everythingjust linterto run Rust linter (clippy)just teststo 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