A Rust-based issue and project tracking API built with Axum and Diesel ORM.
A lightweight project and issue tracking API built in Rust, using Axum for the web framework and Diesel ORM for PostgreSQL database integration. This service provides CRUD operations for managing projects and issues, supports real-time updates, detailed issue tracking, and secure data storage, making it ideal for team collaboration and agile development workflows.
β Create, update, and delete projects
β Manage issues within projects
β Track project statuses
β RESTful API design with structured JSON responses
β High-performance Rust backend using Axum
β PostgreSQL database with Diesel ORM
| Technology | Purpose |
|---|---|
| Rust π¦ | Systems programming language |
| Axum β‘ | Web framework |
| Diesel π’οΈ | ORM for PostgreSQL |
| Tokio β³ | Async runtime |
| Serde π¦ | Serialization/Deserialization |
Install Rust using Rustup:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | shInstall Diesel CLI:
cargo install diesel_cli --no-default-features --features postgresEnsure Docker is installed:
π Docker Installation Guide
To simplify database setup, use Docker to run PostgreSQL and pgAdmin.
docker-compose up -dThis will:
- Start a PostgreSQL 16 database container.
- Start pgAdmin 4 for managing the database.
- Persist data using Docker volumes.
| Key | Value |
|---|---|
| Host | localhost |
| Port | 5432 |
| Database | mydb |
| Username | admin |
| Password | adminpassword |
- Open pgAdmin:
http://localhost:5050 - Login Credentials:
- Email:
admin@admin.com - Password:
admin
- Email:
- Click "Add New Server", enter:
- Host:
postgres_db - Username:
admin - Password:
adminpassword
- Host:
After setting up the database, apply migrations:
- Set up Diesel
diesel setup- Run Migrations
diesel migration run- Reset Database (Caution)
diesel database reset
diesel migration run- Clone the repository:
git clone https://github.com/danielphilipjohnson/rust-ticket-manager.git
cd ticket-manager- Set up environment variables (
.envfile):
DATABASE_URL=postgres://admin:adminpassword@localhost/mydb- Build the project:
cargo build- Run the tests:
cargo test- Start the server:
cargo runThe server will start on http://localhost:3000.
curl -X POST http://localhost:3000/api/projects \
-H "Content-Type: application/json" \
-d '{"name": "New Project", "description": "Project description"}'curl -X GET http://localhost:3000/api/projectscurl -X PUT http://localhost:3000/api/projects/1 \
-H "Content-Type: application/json" \
-d '{"name": "Updated Name", "description": "Updated description"}'curl -X DELETE http://localhost:3000/api/projects/1curl -X POST http://localhost:3000/api/projects/1/issues \
-H "Content-Type: application/json" \
-d '{"title": "Bug", "description": "Issue details", "created_by": "dev@example.com", "status": "open"}'curl -X GET http://localhost:3000/api/projects/1/issuescurl -X PUT http://localhost:3000/api/projects/1/issues/1 \
-H "Content-Type: application/json" \
-d '{"status": "resolved"}'curl -X DELETE http://localhost:3000/api/projects/1/issues/1{
"error": "Project with ID 1 not found"
}Possible Errors:
- 404 Not Found: Resource not found.
- 400 Bad Request: Invalid request.
- 500 Internal Server Error: Unexpected failure.
cargo testRun specific test:
cargo test test_create_project- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
π Read the guide on my blog:
π Building a Ticket Manager API with Rust and Axum