Micronaut is a modern JVM-based framework designed to create lightweight, fast, and cloud-native microservices. In this post, we’ll walk you on installing Micronaut CLI and creating your very first Micronaut project. No complex termsβjust a simple and clear guide to get you started!

π οΈ What You Need in Installing Micronaut CLI
Before we start, make sure you have the following installed on your machine:
- Java 17 or later. I am using Java 21
- Micronaut CLI (You can install it using SDKMAN or your OS package manager)
- A code editor (like VS Code or IntelliJ IDEA)
π Step 1: Create a New Project
Open your terminal and run the following command:
mn create-app com.kscodes.micronaut.helloworld
This command will:
- Create a new project using Micronaut CLI
- By default it will create a gradle project.
- If you need a maven project then use below command
mn create-app com.kscodes.micronaut.helloworld --build=maven --lang=java
- Set the base package to
com.kscodes.micronaut.helloworld
After this, navigate into the project directory:
cd helloworld
ποΈ Step 2: Project Structure Overview
Your project will have the following structure:
helloworld/
βββ src/
β βββ main/
β βββ java/
β βββ com/kscodes/micronaut/helloworld/
β βββ Application.java
β
βββ application.yml
βββ build.gradle (or pom.xml)
βοΈ Step 3: Create a Controller
Now, add a simple REST controller.
Create a new file:src/main/java/com/kscodes/micronaut/helloworld/HelloController.java
package com.kscodes.micronaut.helloworld;
import io.micronaut.http.annotation.Controller;
import io.micronaut.http.annotation.Get;
@Controller("/hello")
public class HelloController {
@Get("/")
public String sayHello() {
return "Hello from KSCodes. Welcome to my First Micronaut App!";
}
}
This controller handles HTTP GET requests to /hello.
A mvnw.bat will be created inside the helloworld folder. Go to that folder and then execute the below command.
βΆοΈ Step 4: Run the Application
mvnw mn:run
π Step 5: Test Your Endpoint
Open your browser or a tool like Postman and visit:
http://localhost:8080/hello
You should see this message:

β Summary
In this tutorial, you:
- Created a Micronaut project using CLI
- Used Java with the
com.kscodes.micronautpackage - Built and tested a simple controller
Micronaut makes it easy to start quickly, with minimal setup and fast performance.