Skip to content

Template options

CesarD edited this page Dec 15, 2022 · 3 revisions

Monaco offers a variety of options for generating a solution. For listing a quick and brief list of these options, you can always run the command line:

dotnet new monaco-solution -h

Which will return the following output:

Monaco Solution Template (C#)
Author: One Beyond
Description: Solution template for .NET projects

Usage:
  dotnet new monaco-solution [options] [template options]

Options:
  -n, --name <name>       The name for the output being created. If no name is specified, the name of the output directory is used.
  -o, --output <output>   Location to place the generated output.
  --dry-run               Displays a summary of what would happen if the given command line were run if it would result in a template creation.
  --force                 Forces content to be generated even if it would change existing files.
  --no-update-check       Disables checking for the template package updates when instantiating a template.
  --project <project>     The project that should be used for context evaluation.
  -lang, --language <C#>  Specifies the template language to instantiate.
  --type <project>        Specifies the template type to instantiate.

Template options:
  -e, --excludeCommon                   Exclude all the Common.* projects from the solution generated
                                        Type: bool
                                        Default: false
  -f, --filesSupport                    Include support for Azure BlobStorage and file handling structure
                                        Type: bool
                                        Default: false
  -m, --massTransitIntegration          Includes MassTransit for integration events
                                        Type: bool
                                        Default: false
  -ap, --apiGateway                     Include API Gateway project with YARP implementation
                                        Type: bool
                                        Default: false
  -di, --disableAuth                    Disable Authentication and Authorization implementation for the solution
                                        Type: bool
                                        Default: false
  -k, --keycloakConfig                  Include Keycloak JSON configuration file for generating new realm
                                        Type: bool
                                        Default: false
  -ke, --keycloakRealm <keycloakRealm>  Name to be used for the generated Keycloak Realm configuration
                                        Type: string
                                        Default: monaco-template

Below there's some detail about each of the options listed above.

  • --excludecommon / -e

    This option will exclude all the Common.* projects from the solution generated and will only leave the specific implementation projects.

    Useful when the common libraries have been separated into another repository and you only need to implement a new solution with no common libraries.

    Common Projects Exclude

  • --filesSupport / -f

    This option will include a helper library project for simpler handling of the Azure Blob Storage files and will provide some structure for handling files through the app: Domain entities, Application features and API endpoints.

  • --massTransitIntegration / -m

    This option will include support for setting up MassTransit on the Application and at the API configuration level in order to allow to send integration messages from this solution. A new library will also be included to expose the messages classes to publish via MassTransit.

    A default bus configuration will point to a local RabbitMQ broker when running in Development configuration, while in any other configuration (ie. Release), it will point towards an Azure Service Bus.

  • --apiGateway / -ap

    This option will include a web app project with an API Gateway that leverages YARP for its implementation.

    Useful if you need to have more than 1 API in your solution and you want to perform an easy implementation of an API Gateway.

  • --disableAuth / -di

    This option will exclude all authentication and authorization configuration in the API project. It will also remove the HttpsRedirection from the middleware.

    Useful if you want to generate the API project for residing behind an API Gateway and you don't want to include the authentication/authorization overhead in the internal APIs (normally because the API GW will take care of that). It will also assume HTTPS termination by the API GW.

  • --keycloakConfig / -k

    This option will include a default Keycloak configuration file in the solution with some pre-configured clients and permissions.

    Useful if you want to quickly setup the API with an identity provider like Keycloak.

  • --keycloakRealm / -ke This option will set the Keycloak Realm name if the Keycloak configuration has been included by the previous parameter. This helps customize the Keycloak configuration beyond its default values.