Skip to content

new microservices

The new microservices command creates a microservices solution with 2 demo microservice projects

This template is designed for making distributed microservices applications. Communication between them is done via the CAP framework configured with RabbitMQ. This framework abstracts a lot of the logic required for building this kind of applications, like message consumers and publishers, events, etc.

The template is built around .NET Aspire. The novel framework Microsoft is developing for streamlining development in ASP.NET Core. It provides a set of tools and libraries that simplify the process of building modern web applications, including microservices. Like resource orchestration, tooling, etc.

To run the project you just need to have docker installed and run the AppHost project. That’s the magic of Aspire!!. It will install the images of all the required services, like databases and message queues. No configuration is required as Aspire will take care of that for you, passing the required connection string to each project on start up.

Options

Option Alias Description Required Example
--name -n Project name Yes --name MySimpleApi
--output -o The output directory No --output ./projects/simple
--skip-interactive - Skips the interactive prompt and uses the default values for all options No --skip-interactive

Omitting the --output option will create the project in the current directory.

Usage

Terminal window
apiand new microservices --name MySimpleApi

Features

  • FastEndpoints: Pre-configured API endpoints using the FastEndpoints framework,
  • RabbitMQ: Message broker for inter-service communication
  • MongoDB: Ready-to-use database integration, with more DBs to come
  • Minimal Configuration: Faster setup with sensible defaults
  • Is the only template with a predefined generate project command

When to Use

The microservices architecture is ideal for:

  • Large-scale applications with distinct business capabilities
  • Systems requiring independent deployment and scaling of components
  • Projects with multiple teams working in parallel
  • Applications where different services have different resource requirements
  • Systems that need resilience through service isolation
  • Solutions that may need to evolve different parts at different rates
  • Projects where different microservices might use different technologies or data stores