If you like this project, please consider supporting me ❤️
This monorepo is a minimal CRUD service exposing a couple of endpoints over REST, with a front-end based on React so you can play with it from your browser.
While the code is surprisingly simple, under the hood this is using:
- Quarkus REST for REST API endpoints with OpenAPI documentation
- Quarkus WebSockets Next for real-time WebSocket communication
- Quarkus RESTEasy Problem for consistent REST API error handling
- Quarkus Quinoa to handle allowing this monorepo to serve React and Java code
- Hibernate ORM with Panache to perform the CRUD operations on the database
- PostgreSQL database; automatically starts an embedded DB
- Liquibase to automatically update database
- React + PrimeReact for a top notch user interface including lazy datatable
- React Hook Forms to validate user input data
- React Websocket to handle websocket connections
- TanStack Query for powerful asynchronous state management for TypeScript
- Orval to generate TanStack Query client Typescript from the OpenAPI definition
To compile and run this demo you will need:
- JDK 17+
- Apache Maven
This project uses Orval to generate the TanStack Query client Typescript from the OpenAPI definition.
The Maven Quarkus plugin provides a development mode that supports live coding. To try this out:
$ ./mvnw quarkus:dev
Watch as it starts up a temporary PostreSQL database just for this session. In this mode you can make changes to the code and have the changes immediately applied, by just refreshing your browser.
💡 Hot reload works add a new REST endpoint and see it update in realtime. Try it!
Now open your web browser to http://localhost:8080/ to see it in action.
When you're done iterating in developer mode, you can run the application as a conventional jar file.
First compile it:
$ ./mvnw clean package
Then run it with:
$ java -jar ./target/quarkus-app/quarkus-run.jar
Or build it as a single executable JAR file (known as an uber-jar):
$ ./mvnw clean package -Dquarkus.package.type=uber-jar
Then run it with:
$ java -jar ./target/quarkus-primereact-{version}-runner.jar
Navigate to: http://localhost:8080/
You can easily build a Docker image of this application with the following command:
$ ./mvnw -Pdocker
You will be able to run this binary directly where ${version} is the current project version:
$ docker run -i --rm -p 8000:8000 melloware/quarkus-primereact:latest
💡 Now observe the time it took to boot, and remember: that time was mostly spent to generate the tables in your database and import the initial data.
Navigate to: http://localhost:8080/index.html