A REST API using Axum for managing printer supplies, such as toners and drums. The project includes CRUD functionalities for various resources and inventory movement tracking.
- Axum: Asynchronous web framework for Rust.
- SQLx: For interaction with the database and migrations.
- Just: For utility scripts.
- Docker: For database container.
- Swagger: API documentation.
- CRUD operations for movements, printers, brands, drums, and toners.
- Inventory management for toners and drums.
- Docker Compose setup for easy deployment.
- Database migrations included, executable via CLI or endpoint.
- Error handling with thiserror for descriptive error responses.
- Includes development, production, and test environments.
- Includes unit and integration tests.
- API documentation available with Swagger UI.
- Rust (latest stable version)
- Docker and Docker Compose
- Just for scripts
git clone https://github.com/allansomensi/printer-supplies-api.git
cd printer-supplies-api
For the scripts:
cargo install just
By default, the selected file is .env.development
, so there's no need to run this command in a development environment.
If you're running in a production environment, execute the command below to ensure the correct environment variables are loaded.
source scripts/set_env.sh
just services-up
just migrate-run
just serve
For once:
just test
For watching mode:
just test-watch
Endpoint tests are located at
/tests
folder
API endpoints and usage details are documented using Swagger UI
and OpenAPI
with Utoipa
.
The full documentation is available in the openapi.json
file, which can be accessed and imported as needed. Run the application and navigate to /swagger-ui
to view the interactive Swagger documentation.