Back to Blog
December 2, 202515 min readArion Interactive Team

Quarkus: Supersonic Subatomic Java for Modern Backends

Discover why Quarkus is revolutionizing Java backend development with blazing fast startup times, minimal memory footprint, and cloud-native features.

JavaQuarkusBackendMicroservicesTutorial
Quarkus: Supersonic Subatomic Java for Modern Backends

If you think Java is slow and heavyweight, you haven't met Quarkus yet. This revolutionary framework is turning Java into a lean, mean, cloud-native machine—perfect for microservices, serverless, and Kubernetes deployments.

What Makes Quarkus Special?

Quarkus isn't just another Java framework. It's a complete rethinking of how Java applications should work in the cloud-native era.

Lightning-Fast Startup

Traditional Java apps take seconds to start. Quarkus apps start in milliseconds:

  • Traditional Spring Boot: ~3-5 seconds
  • Quarkus JVM Mode: ~0.5-1 second
  • Quarkus Native: ~0.01-0.05 seconds (10-50ms!)

Minimal Memory Footprint

Memory usage that makes sense for containers:

  • Traditional Java: 200-500 MB
  • Quarkus JVM: 70-100 MB
  • Quarkus Native: 15-30 MB

Developer Joy

Live coding that actually works:

  • Change your code and see results instantly—no restart!
  • Debug-friendly with full stack traces
  • Works with your favorite IDEs

Why Quarkus is Perfect for Backend Development

1. Cloud-Native by Design

Built for Kubernetes from day one:

  • Native Kubernetes integration
  • Optimized for containers
  • Health checks and metrics out of the box
  • Perfect for microservices architecture

2. Extensive Extensions Ecosystem

Everything you need, ready to use:

  • REST APIs (RESTEasy Reactive)
  • Database access (Hibernate Panache)
  • Security (OAuth2, JWT, OIDC)
  • Messaging (Kafka, AMQP)
  • Reactive programming (Mutiny)
  • And 200+ more extensions!

3. Standards-Based

Use familiar Java standards:

  • JAX-RS for REST
  • JPA for persistence
  • CDI for dependency injection
  • MicroProfile for cloud-native APIs

Getting Started with Quarkus

Let's build your first Quarkus backend!

Step 1: Create Your Project

Use the Quarkus CLI:

# Install Quarkus CLI
curl -Ls https://sh.jbang.dev | bash -s - trust add https://repo1.maven.org/maven2/io/quarkus/quarkus-cli/
curl -Ls https://sh.jbang.dev | bash -s - app install --fresh --force quarkus@quarkusio

# Create a new project
quarkus create app com.arion:backend-api \
  --extension='resteasy-reactive-jackson,hibernate-orm-panache,jdbc-postgresql'

cd backend-api

Or use the web interface: code.quarkus.io

Step 2: Your First REST Endpoint

Create a simple REST API in src/main/java/com/arion/GreetingResource.java:

package com.arion;

import jakarta.ws.rs.*;
import jakarta.ws.rs.core.MediaType;

@Path("/api/greeting")
@Produces(MediaType.APPLICATION_JSON)
public class GreetingResource {

    @GET
    public Greeting hello(@QueryParam("name") String name) {
        return new Greeting("Hello " + (name != null ? name : "World") + "!");
    }

    public record Greeting(String message) {}
}

Step 3: Start Development Mode

# Start in dev mode with live reload
quarkus dev

Visit http://localhost:8080/api/greeting?name=Developer and see your API in action!

Change your code, save, and watch it reload instantly—no restart needed!

Building a Complete CRUD API

Let's create a real-world example with database integration.

Step 1: Define Your Entity

package com.arion.entity;

import io.quarkus.hibernate.orm.panache.PanacheEntity;
import jakarta.persistence.Entity;

@Entity
public class Product extends PanacheEntity {
    public String name;
    public String description;
    public Double price;
    public Integer stock;
}

Step 2: Create the REST Resource

package com.arion.resource;

import com.arion.entity.Product;
import jakarta.transaction.Transactional;
import jakarta.ws.rs.*;
import jakarta.ws.rs.core.Response;
import java.util.List;

@Path("/api/products")
@Produces("application/json")
@Consumes("application/json")
public class ProductResource {

    @GET
    public List<Product> list() {
        return Product.listAll();
    }

    @GET
    @Path("/{id}")
    public Product get(@PathParam("id") Long id) {
        return Product.findById(id);
    }

    @POST
    @Transactional
    public Response create(Product product) {
        product.persist();
        return Response.status(201).entity(product).build();
    }

    @PUT
    @Path("/{id}")
    @Transactional
    public Product update(@PathParam("id") Long id, Product updated) {
        Product product = Product.findById(id);
        product.name = updated.name;
        product.description = updated.description;
        product.price = updated.price;
        product.stock = updated.stock;
        return product;
    }

    @DELETE
    @Path("/{id}")
    @Transactional
    public Response delete(@PathParam("id") Long id) {
        Product.deleteById(id);
        return Response.noContent().build();
    }
}

Step 3: Configure Database

Edit application.properties:

# Database
quarkus.datasource.db-kind=postgresql
quarkus.datasource.username=postgres
quarkus.datasource.password=postgres
quarkus.datasource.jdbc.url=jdbc:postgresql://localhost:5432/products

# Hibernate
quarkus.hibernate-orm.database.generation=drop-and-create
quarkus.hibernate-orm.log.sql=true

Advanced Features

Reactive Programming with Mutiny

Build reactive, non-blocking APIs:

@GET
@Path("/reactive")
public Uni<List<Product>> listReactive() {
    return Product.listAll()
        .map(products -> (List<Product>) products);
}

Security with JWT

Secure your API easily:

quarkus extension add smallrye-jwt
@GET
@RolesAllowed("admin")
@Path("/admin")
public String adminOnly() {
    return "Secret admin data";
}

OpenAPI & Swagger

Automatic API documentation:

quarkus extension add smallrye-openapi

Visit http://localhost:8080/q/swagger-ui for interactive API docs!

Health Checks

Built-in health endpoints:

@ApplicationScoped
public class DatabaseHealthCheck implements HealthCheck {
    @Override
    public HealthCheckResponse call() {
        return HealthCheckResponse
            .named("database")
            .up()
            .build();
    }
}

Testing Your API

Quarkus makes testing easy:

@QuarkusTest
public class ProductResourceTest {

    @Test
    public void testListEndpoint() {
        given()
            .when().get("/api/products")
            .then()
            .statusCode(200);
    }
}

Building for Production

JVM Mode (Fast & Compatible)

./mvnw clean package
java -jar target/quarkus-app/quarkus-run.jar

Native Mode (Blazing Fast!)

./mvnw clean package -Pnative
./target/backend-api-1.0.0-SNAPSHOT-runner

Native compilation takes longer but gives you:

  • Sub-50ms startup time
  • ~15-30MB memory footprint
  • Perfect for serverless and containers

Deploying to Production

Docker Container

FROM registry.access.redhat.com/ubi8/openjdk-17:1.14

COPY target/quarkus-app/lib/ /deployments/lib/
COPY target/quarkus-app/*.jar /deployments/
COPY target/quarkus-app/app/ /deployments/app/
COPY target/quarkus-app/quarkus/ /deployments/quarkus/

EXPOSE 8080
CMD ["java", "-jar", "/deployments/quarkus-run.jar"]

Kubernetes

quarkus extension add kubernetes
./mvnw clean package -Dquarkus.kubernetes.deploy=true

Best Practices We Follow

1. Use Panache for Database Access

Simplifies JPA with active record pattern:

List<Product> products = Product.list("price > ?1", 10.0);

2. Leverage Dev Services

Automatic database containers in dev mode—zero configuration!

3. Use Configuration Profiles

%dev.quarkus.hibernate-orm.database.generation=drop-and-create
%prod.quarkus.hibernate-orm.database.generation=none

4. Monitor with Metrics

quarkus extension add micrometer-registry-prometheus

5. Implement Proper Error Handling

@Provider
public class ErrorMapper implements ExceptionMapper<Exception> {
    @Override
    public Response toResponse(Exception e) {
        return Response.status(500)
            .entity(new ErrorResponse(e.getMessage()))
            .build();
    }
}

Why We Love Quarkus

At Arion Interactive, Quarkus has become our go-to framework for:

  • Microservices: Lightning-fast startup and low memory usage
  • Serverless: Native compilation perfect for AWS Lambda
  • APIs: RESTful and GraphQL APIs that scale
  • Real-time: Reactive streams and WebSocket support
  • Cloud-Native: Kubernetes-ready with minimal configuration

Conclusion

Quarkus represents the future of Java backend development. It's fast, efficient, developer-friendly, and production-ready. Whether you're building microservices, serverless functions, or traditional web applications, Quarkus delivers the performance and developer experience you need.

Ready to supercharge your Java backend? Let's build something amazing with Quarkus!

Visit quarkus.io to learn more and join the revolution!