Software Development

Micronaut CLI (mn) Features Overview

The Micronaut CLI (mn) enables developers to bootstrap, build, and configure Micronaut projects. It supports various commands for project scaffolding, testing, feature inclusion, and runtime operations. Let us delve into understanding how to list all available features in the Micronaut CLI using the mn command in our Micronaut CLI (mn) features overview.

1. What is Micronaut?

Micronaut is a modern, JVM-based, full-stack framework specifically designed for building modular, high-performance microservices, serverless applications, and cloud-native systems. It offers first-class support for Java, Kotlin, and Groovy, making it a flexible choice for JVM developers.

Unlike traditional Java frameworks that rely heavily on runtime reflection and proxies (such as Spring), Micronaut uses compile-time annotation processing for dependency injection, AOP (Aspect-Oriented Programming), and configuration. This unique approach drastically reduces memory usage and startup time, making it ideal for microservices and serverless environments like AWS Lambda or Google Cloud Functions.

Micronaut also integrates seamlessly with GraalVM to enable ahead-of-time (AOT) compilation into native executables, further improving performance and resource efficiency.

Key features of Micronaut include:

  • Compile-time dependency injection: No reflection or runtime proxies, leading to better performance and smaller memory footprint.
  • Fast startup time and low memory usage: Ideal for microservices and containerized environments.
  • Seamless integration with GraalVM: Supports building native images for ultra-fast execution and minimal memory use.
  • Reactive and non-blocking: Includes built-in support for reactive programming using RxJava, Project Reactor, etc.
  • Built-in HTTP server/client: Lightweight Netty-based web server and declarative HTTP clients with easy configuration.
  • Cloud-native readiness: Support for service discovery, distributed tracing, configuration management, and more.
  • Modular architecture: Encourages separation of concerns and better maintainability.

1.1 What is Micronaut CLI?

The Micronaut CLI (Command Line Interface) is a development tool that simplifies the process of creating and managing Micronaut applications. It provides a quick and efficient way to bootstrap projects, generate application components, and execute various tasks — all from your terminal.

It comes with intelligent code generation capabilities, which reduces the boilerplate and enforces consistent project structure. This makes it especially helpful for teams or individuals working on multiple services within a microservices architecture.

The CLI allows you to:

  • Generate new Micronaut projects: Quickly scaffold applications with the desired language (Java/Kotlin/Groovy), test framework, and build tool (Gradle/Maven).
  • Create application components: Generate controllers, services, repositories, and other common artifacts with ease.
  • Run the application locally: Use the built-in development server to test your application quickly.
  • Build and test: Compile your app, run tests, or create executable JARs directly using CLI commands.
  • Manage features: Enable or disable features (e.g., security, metrics, database integration) during project creation.

Whether you’re a solo developer or part of a larger team, the Micronaut CLI can significantly improve your productivity by automating repetitive tasks and reducing manual errors. You can also explore the Micronaut Documentation for more advanced CLI usage.

2. Installing Micronaut CLI (macOS & Windows)

2.1 On macOS

You can install Micronaut CLI on macOS using SDKMAN (recommended for ease and version control) or by manually downloading and setting it up.

2.1.1 Using SDKMAN (Recommended)

SDKMAN is a popular tool for managing parallel versions of multiple SDKs on Unix-based systems. It’s the easiest way to install and manage Micronaut CLI on macOS.

  • Step 1 – Install SDKMAN: Open Terminal and run:
    curl -s "https://get.sdkman.io" | bash

    This downloads and installs SDKMAN on your system.

  • Step 2 – Initialize SDKMAN: Once installed, you must initialize it in the current shell session:
    source "$HOME/.sdkman/bin/sdkman-init.sh"
  • Step 3 – Install Micronaut CLI: Use SDKMAN to install the latest stable version of Micronaut:
    sdk install micronaut
  • Step 4 – Verify installation: Confirm that Micronaut CLI is successfully installed by checking its version:
    mn --version

2.1.2 Manual Installation

If you prefer not to use SDKMAN, you can install Micronaut CLI manually. This method gives you more control but requires a bit more setup.

  • Step 1 – Download the CLI: Visit the official Micronaut Download Page and download the latest CLI zip file for your OS.
  • Step 2 – Extract the zip: Unzip the downloaded file to a directory of your choice. For example:
    sudo unzip micronaut-X.Y.Z.zip -d /opt/micronaut

    Replace X.Y.Z with the actual version number.

  • Step 3 – Add to PATH: Open (or create) your shell profile file (like ~/.zshrc or ~/.bash_profile) and add:
    export PATH="/opt/micronaut/bin:$PATH"

    Then reload your terminal or run:

    source ~/.zshrc
  • Step 4 – Verify installation: Check that Micronaut CLI is accessible:
    mn --version

2.2 On Windows

As SDKMAN does not natively support Windows, the recommended approach is to install the Micronaut CLI manually. This method is straightforward and only requires a few system configuration steps.

2.2.1 Manual Installation

  • Step 1 – Download the CLI: Visit the official Micronaut download page and download the latest ZIP file for Windows. Make sure to download the version compatible with your system architecture (usually 64-bit).
  • Step 2 – Extract the archive:
    After downloading, right-click the ZIP file and choose “Extract All”. Extract it to a directory you can easily access, for example:

    C:\micronaut

    Inside this folder, you should see a bin directory containing the mn command.

  • Step 3 – Add Micronaut to your system PATH:
    This step ensures you can run the mn command from any Command Prompt window:

    • Right-click This PC or My Computer and select Properties.
    • Click on Advanced system settings.
    • In the System Properties dialog, click the Environment Variables button.
    • Under System variables, find and select the Path variable, then click Edit.
    • Click New and add the path to the bin directory, e.g.:
      C:\micronaut\bin
    • Click OK to save and close all dialog windows.
  • Step 4 – Verify the installation: Open a new Command Prompt window (this is important—make sure to open a new one so the PATH changes take effect), and run:
    mn --version

    If installed correctly, this will display the installed Micronaut CLI version.

If you encounter any issues, ensure that there are no extra spaces in the PATH entry and that you’ve extracted the correct folder structure. While SDKMAN is not natively supported on Windows, advanced users running WSL (Windows Subsystem for Linux) can use SDKMAN inside a Linux shell. However, for most users, the manual installation method described above is sufficient and stable.

3. List of All Features

Here are commonly available features in the Micronaut CLI with a brief description:

FeatureDescription
data-jdbcProvides support for JDBC repositories using Micronaut Data.
data-jpaEnables JPA support with Hibernate ORM integration.
data-mongodbSupport for MongoDB repositories using Micronaut Data.
securityBase feature for adding authentication and authorization support.
security-jwtEnables JWT-based authentication.
security-sessionAdds session-based authentication mechanisms.
kafkaIntegrates Apache Kafka messaging support.
rabbitmqIntegrates RabbitMQ messaging support.
openapiGenerates OpenAPI documentation from annotations.
micrometerProvides application metrics using Micrometer.
graalvmPrepares the application for native image compilation using GraalVM.
spockUses Spock framework for testing instead of JUnit.
tracing-jaegerIntegrates distributed tracing using Jaeger.
tracing-zipkinSupports distributed tracing with Zipkin.
managementAdds actuator-style endpoints for monitoring and health checks.
emailSupports sending emails through various providers like SMTP or SendGrid.
redis-lettuceProvides Redis support using the Lettuce client.
azure-functionScaffolds a Micronaut app for Azure Functions deployment.
google-cloud-functionEnables deployment to Google Cloud Functions.
aws-lambdaEnables running Micronaut apps as AWS Lambda functions.

4. Filter Features

You can filter features using terminal commands such as:

mn features | grep <keyword>

Here are some commonly used filter keywords with matching features and explanations:

Filter KeywordMatched FeatureDescription
securitysecurityCore security configuration and authentication support for Micronaut.
security-jwtJWT bearer token authentication integration.
security-sessionProvides session-based login authentication.
security-annotationsIncludes annotations like @Secured for role-based access control.
security-oauth2OAuth2 login and token management support.
tracingtracing-jaegerDistributed tracing integration using Jaeger.
tracing-zipkinEnables Zipkin-based trace visualization for microservices.
awsaws-lambdaScaffolds Micronaut apps for AWS Lambda deployment.
aws-api-gatewayIntegrates AWS API Gateway routing to Lambda functions.
aws-cloudwatchEnables CloudWatch logging and metrics.
aws-secrets-managerSupport for fetching configuration from AWS Secrets Manager.
datadata-jdbcMicronaut Data repository support with JDBC.
data-jpaEnables Hibernate and JPA integration for ORM mapping.
data-mongodbMicronaut Data support for MongoDB NoSQL databases.
data-r2dbcReactive Relational Database Connectivity support.
cloudgoogle-cloud-functionSupport for deploying functions on Google Cloud Functions.
azure-functionDeploy Micronaut apps as Azure Functions.
aws-lambdaRun Micronaut apps on AWS Lambda (also matches in AWS group).

This filtering approach helps you quickly explore relevant capabilities in your tech stack, especially when bootstrapping targeted microservices.

5. Conclusion

Micronaut CLI provides a comprehensive set of features to enhance microservice development with seamless integrations for databases, messaging systems, authentication, cloud functions, and observability tools. Using mn features, developers can explore and include only the features they need, ensuring modularity and performance. The ability to filter features by category (e.g., security, cloud, data) further improves developer productivity, allowing for quick bootstrapping of relevant components. Whether you’re building cloud-native services or serverless functions, the CLI’s feature set gives you fine-grained control over your application stack.

Yatin Batra

An experience full-stack engineer well versed with Core Java, Spring/Springboot, MVC, Security, AOP, Frontend (Angular & React), and cloud technologies (such as AWS, GCP, Jenkins, Docker, K8).
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Back to top button