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-apiFor the scripts:
cargo install justBy 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.shjust services-upjust migrate-runjust serveFor once:
just testFor watching mode:
just test-watchEndpoint tests are located at
/testsfolder
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.
