DEV Community

unni mana
unni mana

Posted on

I Wrote a Book on Quarkus (And Here is a Free Chapter to Prove It)

For years, Spring Boot was my go-to for Java microservices. It worked, so I didn't question it. But as we started moving more services to Kubernetes and AWS Lambda, the problems became impossible to ignore.

Cold starts taking 5-10 seconds.
Containers eating up 800MB+ of memory.
Wasting money just to keep services alive.

Then I found Quarkus. It starts in ~0.01 seconds as a native image and runs on a fraction of the memory. It was a game-changer.

So I wrote a book about it.

*πŸ“š The Book: Practical Quarkus: From Zero to Native
*

It is a hands-on guide for Java developers who want to build cloud-native microservices that actually work. Every command and code block in the book has been tested on a real machine. No fluff. No copy-paste errors.

You can find it here on Amazon: Practical Quarkus: From Zero to Native

But I am not here to just ask you to buy a book. I am here to give you something useful first.

🎁 Your Free Chapter: "Why Quarkus?"

Since the first 10% of the book is free on Amazon as the "Look Inside" sample, I want to share exactly what you will learn in Chapter 1. It answers the most important question: "Should I even care about Quarkus?"

Here is a taste.

πŸš€ Build Your First Quarkus Endpoint (In Under 10 Minutes)

This is the exact code from Chapter 1. You can run it on your laptop right now.

  1. Create a new Quarkus project using Maven:

mvn io.quarkus.platform:quarkus-maven-plugin:3.14.0:create \
-DprojectGroupId=org.example \
-DprojectArtifactId=code-with-quarkus \
-Dextensions=resteasy-reactive
cd code-with-quarkus
./mvnw quarkus:dev

*2. Add a REST endpoint:
*

Create the file src/main/java/org/example/GreetingResource.java:

`package org.example;

import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.MediaType;

@path("/hello")
public class GreetingResource {

@GET
@Produces(MediaType.TEXT_PLAIN)
public String hello() {
    return "Hello from Quarkus. Spring Boot took 3 seconds. I took 0.3.";
}
Enter fullscreen mode Exit fullscreen mode

}`

3. See it works:
Open your browser to http://localhost:8080/hello

You will see the message: Hello from Quarkus. Spring Boot took 3 seconds. I took 0.3.

That is it. You just ran your first Quarkus app. The dev mode even supports hot reloadβ€”change the message and save the file, and it updates instantly. No restart.

Use Quarkus if... Stick with Spring Boot if...
Startup time under 1 second matters: Startup time doesn't matter (long-running servers)
Running on Lambda, Fargate, or Knative: Running on traditional EC2 or dedicated servers
Memory is expensive (< 200MB per pod): You have plenty of RAM (2GB+ per pod)
You want native compilation with GraalVM: You rely on heavy reflection or dynamic proxies
Building 20+ microservices: Building one monolithic application

*πŸ“– What's Next in the Book?
*

If you found this useful, the book goes much further. The first four chapters (available now) cover:

Chapter 2: Full CRUD with PostgreSQL and Panache (20 lines of code)

Chapter 3: Validation and proper HTTP error handling (404, 400)

Chapter 4: Logging and configuration for dev/prod environments
Enter fullscreen mode Exit fullscreen mode

The book is 31% complete. When you buy it now, you pay once and get all future chapters (including the one on native executables) for free.

πŸ”— Get the Book & Code

Amazon (Live Now):[Practical Quarkus: From Zero to Native](https://www.amazon.com/dp/B0H2JR9DLD)

GitHub (All code examples): (github.com/unnivm/practical-quarkus)
Enter fullscreen mode Exit fullscreen mode

*❓ Questions?
*

Ask me anything in the comments below. I will answer every one.

If you pick up the book, please leave a review on Amazon. It helps other Java developers find it.

Happy coding.

Top comments (0)