Book Image

Full Stack Quarkus and React

By : Marc Nuri San Felix
Book Image

Full Stack Quarkus and React

By: Marc Nuri San Felix

Overview of this book

React has established itself as one of the most popular and widely adopted frameworks thanks to its simple yet scalable app development abilities. Quarkus comes across as a fantastic alternative for backend development by boosting developer productivity with features such as pre-built integrations, application services, and more that bring a new, revolutionary developer experience to Java. To make the best use of both, this hands-on guide will help you get started with Quarkus and React to create and deploy an end-to-end web application. This book is divided into three parts. In the first part, you’ll begin with an introduction to Quarkus and its features, learning how to bootstrap a Quarkus project from the ground up to create a tested and secure HTTP server for your backend. The second part focuses on the frontend, showing you how to create a React project from scratch to build the application’s user interface and integrate it with the Quarkus backend. The last part guides you through creating cluster configuration manifests and deploying them to Kubernetes as well as other alternatives, such as Fly.io. By the end of this full stack development book, you’ll be confident in your skills to combine the robustness of both frameworks to create and deploy standalone, fully functional web applications.
Table of Contents (21 chapters)
1
Part 1– Creating a Backend with Quarkus
8
Part 2– Creating a Frontend with React
14
Part 3– Deploying Your Application to the Cloud

Bootstrapping a Quarkus application

Quarkus provides several options for bootstrapping an application. The easiest method involves using the https://code.quarkus.io page. You can also generate a new application by using the provided command-line interface (CLI) tool or even by running a Maven goal. We’ll be using the web interface since it’s the simplest approach and has a very straightforward wizard to customize the options and extension dependencies. However, you are free to explore other alternatives.

Maven goal

Maven is a build automation and project management tool mainly used in Java. A goal is a specific task that you can perform through Maven. Tasks such as compiling, packaging, and testing in Maven projects are performed via goal executions.

We are going to generate a Java 17 project with Maven and the latest available Quarkus version. Quarkus provides a web-based tool that allows you to create and customize an initial project. Let us take advantage of that by going through the following steps:

  1. Navigate with your web browser to https://code.quarkus.io.

You’ll be greeted with the following wizard:

Figure 1.1 – A screenshot of the code.quarkus.io web interface

Figure 1.1 – A screenshot of the code.quarkus.io web interface

  1. In the Group field, set the Maven project Group ID.

The generated project will include a package named with this value containing some sample starter code. I’m going to use com.example.fullstack, but you can use any other value.

  1. In the Artifact field, define the Maven artifact ID. In my case, I will use reactive.
  2. Select the base dependencies for our project. For now, we are only going to add a dependency to enable the implementation of HTTP endpoints. Since we want to take full advantage of Quarkus’ reactive features, we’ll use RESTEasy Reactive. You can filter through the dependencies by typing into the Filters text field and then checking the required dependency checkbox:
Figure 1.2 – A screenshot of the dependency selection section in the code.quarkus.io web interface

Figure 1.2 – A screenshot of the dependency selection section in the code.quarkus.io web interface

In the following chapters, we’ll be including more dependencies as we add functionality to the project.

  1. Click on the Generate your app button and download a ZIP package with the bootstrapped project.

Now that you have generated your Quarkus application, let us learn about the structure of the project and what features each of the project’s initial dependencies and plugins provides.