A comprehensive, low-latency REST API for managing users and their todos, built with Quarkus, Hibernate Panache, and PostgreSQL.
- Full CRUD operations for Users and Todos
- RESTful API design with best practices
- Bean Validation with comprehensive error handling
- Pagination and filtering support
- Optimized database queries with indexes for low latency
- Connection pooling configured for high performance
- Comprehensive unit tests with REST Assured
- Global exception handling
For complete API documentation, see API_DOCUMENTATION.md
This project uses Quarkus, the Supersonic Subatomic Java Framework.
- Framework: Quarkus 3.29.0
- ORM: Hibernate ORM with Panache
- Database: PostgreSQL
- Testing: JUnit 5 + REST Assured
- Java: 21
If you want to learn more about Quarkus, please visit its website: https://quarkus.io/.
GET /api/v1/users- Get all users (with pagination)GET /api/v1/users/{id}- Get user by IDPOST /api/v1/users- Create new userPUT /api/v1/users/{id}- Update userDELETE /api/v1/users/{id}- Delete userGET /api/v1/users/{id}/stats- Get user statistics
GET /api/v1/todos- Get all todos (with filtering)GET /api/v1/todos/{id}- Get todo by IDGET /api/v1/todos/user/{userId}- Get user's todosPOST /api/v1/todos- Create new todoPUT /api/v1/todos/{id}- Update todoPATCH /api/v1/todos/{id}/toggle- Toggle completionDELETE /api/v1/todos/{id}- Delete todo
Before running the application, set up PostgreSQL:
CREATE DATABASE todos_db;
CREATE USER postgres WITH PASSWORD 'postgres';
GRANT ALL PRIVILEGES ON DATABASE todos_db TO postgres;Update src/main/resources/application.properties with your database credentials if needed.
You can run your application in dev mode that enables live coding using:
./mvnw quarkus:devNOTE: Quarkus now ships with a Dev UI, which is available in dev mode only at http://localhost:8080/q/dev/.
The application can be packaged using:
./mvnw packageIt produces the quarkus-run.jar file in the target/quarkus-app/ directory.
Be aware that it’s not an über-jar as the dependencies are copied into the target/quarkus-app/lib/ directory.
The application is now runnable using java -jar target/quarkus-app/quarkus-run.jar.
If you want to build an über-jar, execute the following command:
./mvnw package -Dquarkus.package.jar.type=uber-jarThe application, packaged as an über-jar, is now runnable using java -jar target/*-runner.jar.
You can create a native executable using:
./mvnw package -DnativeOr, if you don't have GraalVM installed, you can run the native executable build in a container using:
./mvnw package -Dnative -Dquarkus.native.container-build=trueYou can then execute your native executable with: ./target/quarks-users-todo-1.0.0-SNAPSHOT-runner
If you want to learn more about building native executables, please consult https://quarkus.io/guides/maven-tooling.
- REST (guide): A Jakarta REST implementation utilizing build time processing and Vert.x. This extension is not compatible with the quarkus-resteasy extension, or any of the extensions that depend on it.
- REST Jackson (guide): Jackson serialization support for Quarkus REST. This extension is not compatible with the quarkus-resteasy extension, or any of the extensions that depend on it
- Hibernate ORM with Panache (guide): Simplify your persistence code for Hibernate ORM via the active record or the repository pattern
- JDBC Driver - PostgreSQL (guide): Connect to the PostgreSQL database via JDBC
Create your first JPA entity
Related Hibernate with Panache section...
Easily start your REST Web Services