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)
- You can download it from micronaut website.
- Unzip the downloaded zip file into your system
- Create the MICRONAUT_HOME environment variable with the installation directory path and also update the PATH variable so that it gets reflected correctly.
- A code editor (like VS Code or IntelliJ IDEA)
π Step 1: Create a New Project
Open your terminal and run the following command:
1 2 3 4 5 |
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
1 2 3 |
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:
1 2 3 4 |
cd helloworld |
ποΈ Step 2: Project Structure Overview
Your project will have the following structure:
1 2 3 4 5 6 7 8 9 10 11 12 |
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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
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
1 2 3 4 |
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.micronaut
package - Built and tested a simple controller
Micronaut makes it easy to start quickly, with minimal setup and fast performance.