diff --git a/.NET-Templates.sln b/.NET-Templates.sln
index df00e41..911835f 100644
--- a/.NET-Templates.sln
+++ b/.NET-Templates.sln
@@ -318,6 +318,15 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "BlazorWebAppMicrosoftIdenti
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebApp1", "templates\BlazorWebAppMicrosoftIdentityPlatform\WebApp1\WebApp1.csproj", "{A51BB60B-104E-40D9-82BB-76CC66DD9D14}"
EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{8EC462FD-D22E-90A8-E5CE-7E832BA40C5D}"
+ ProjectSection(SolutionItems) = preProject
+ README.md = README.md
+ validate-build.ps1 = validate-build.ps1
+ validate-build.sh = validate-build.sh
+ validate-packages.ps1 = validate-packages.ps1
+ validate-packages.sh = validate-packages.sh
+ EndProjectSection
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
diff --git a/README.md b/README.md
index 3ad98ac..953083c 100644
--- a/README.md
+++ b/README.md
@@ -8,6 +8,7 @@
[![NuGet Downloads](https://img.shields.io/nuget/dt/VladislavAntonyuk.DotNetTemplates.svg?style=flat-square)](https://www.nuget.org/packages/VladislavAntonyuk.DotNetTemplates)
Table of contents:
+* [Modular Monolith](#modular-monolith)
* [Blazor WebApp Microsoft Identity Platform](#blazor-webapp-microsoft-identity-platform)
* [Onion Architecture Templates](#onion-architecture-templates)
+ [Onion Architecture Cross-Platform Application](#onion-architecture-cross-platform-application)
@@ -43,14 +44,14 @@ Table of contents:
[Table of contents generated with markdown-toc]: <>
-## Blazor Maui Shared
+## Modular Monolith
-Creates .NET MAUI application, Blazor WevApp and Blazor WebAssembly projects with shared UI.
+Creates a Modular Monolith application.
Create solution:
```pwsh
-dotnet new blazor-maui-shared -n MyProductName --ApplicationId com.vladislavantonyuk.myapp
+dotnet new modular-monolith -n MyProductName --module1 MyModule1Name --module2 MyModule2Name
```
## Blazor WebApp Microsoft Identity Platform
@@ -73,6 +74,7 @@ Create solution:
```pwsh
dotnet new onion-app -n MyProductName --entityName MyEntityName
+```
### Onion Architecture Cross-Platform Application Repository
@@ -367,7 +369,7 @@ The final application id: `com.vladislavantonyuk.myapp.myapp-TodayExtension`.
## Build
```pwsh
-dotnet pack
+dotnet pack .\VladislavAntonyukDotnetTemplates.csproj
```
## Install Templates
diff --git a/templates/BlazorWebAppMicrosoftIdentityPlatform/WebApp1/WebApp1.csproj b/templates/BlazorWebAppMicrosoftIdentityPlatform/WebApp1/WebApp1.csproj
index 5c0a7f3..061b078 100644
--- a/templates/BlazorWebAppMicrosoftIdentityPlatform/WebApp1/WebApp1.csproj
+++ b/templates/BlazorWebAppMicrosoftIdentityPlatform/WebApp1/WebApp1.csproj
@@ -8,6 +8,6 @@
-
+
diff --git a/templates/ModularMonolith/.editorconfig b/templates/ModularMonolith/.editorconfig
new file mode 100644
index 0000000..2d2eaf7
--- /dev/null
+++ b/templates/ModularMonolith/.editorconfig
@@ -0,0 +1,216 @@
+# To learn more about .editorconfig see https://aka.ms/editorconfigdocs
+###############################
+# Core EditorConfig Options #
+###############################
+# All files
+[*]
+end_of_line = crlf
+indent_style = tab
+csharp_style_namespace_declarations = file_scoped
+resharper_arrange_redundant_parentheses_highlighting = hint
+resharper_arrange_this_qualifier_highlighting = hint
+resharper_arrange_type_member_modifiers_highlighting = hint
+resharper_arrange_type_modifiers_highlighting = hint
+resharper_braces_for_for = required
+resharper_braces_for_foreach = required
+resharper_braces_for_ifelse = required
+resharper_braces_for_while = required
+resharper_built_in_type_reference_style_for_member_access_highlighting = hint
+resharper_built_in_type_reference_style_highlighting = hint
+resharper_redundant_base_qualifier_highlighting = warning
+resharper_suggest_var_or_type_built_in_types_highlighting = hint
+resharper_suggest_var_or_type_elsewhere_highlighting = hint
+resharper_suggest_var_or_type_simple_types_highlighting = hint
+resharper_xml_indent_style = tab
+resharper_xml_use_indent_from_vs = false
+resharper_xmldoc_indent_style = tab
+resharper_xmldoc_use_indent_from_vs = false
+trim_trailing_whitespace = true
+csharp_new_line_before_members_in_object_initializers = true
+csharp_preferred_modifier_order = public, private, protected, internal, new, abstract, virtual, sealed, override, static, readonly, extern, unsafe, volatile, async:suggestion
+csharp_style_var_elsewhere = true:suggestion
+csharp_style_var_for_built_in_types = true:suggestion
+csharp_style_var_when_type_is_apparent = true:suggestion
+csharp_using_directive_Module2ment = inside_namespace:silent
+dotnet_naming_rule.private_constants_rule.severity = warning
+dotnet_naming_rule.private_constants_rule.style = upper_camel_case_style
+dotnet_naming_rule.private_constants_rule.symbols = private_constants_symbols
+dotnet_naming_rule.private_instance_fields_rule.severity = warning
+dotnet_naming_rule.private_instance_fields_rule.style = lower_camel_case_style
+dotnet_naming_rule.private_instance_fields_rule.symbols = private_instance_fields_symbols
+dotnet_naming_rule.private_static_fields_rule.severity = warning
+dotnet_naming_rule.private_static_fields_rule.style = lower_camel_case_style_1
+dotnet_naming_rule.private_static_fields_rule.symbols = private_static_fields_symbols
+dotnet_naming_rule.private_static_readonly_rule.severity = warning
+dotnet_naming_rule.private_static_readonly_rule.style = upper_camel_case_style
+dotnet_naming_rule.private_static_readonly_rule.symbols = private_static_readonly_symbols
+dotnet_naming_style.lower_camel_case_style.capitalization = camel_case
+dotnet_naming_style.lower_camel_case_style_1.capitalization = camel_case
+dotnet_naming_style.lower_camel_case_style_1.required_prefix = _
+dotnet_naming_style.upper_camel_case_style.capitalization = pascal_case
+dotnet_naming_symbols.private_constants_symbols.applicable_accessibilities = private
+dotnet_naming_symbols.private_constants_symbols.applicable_kinds = field
+dotnet_naming_symbols.private_constants_symbols.required_modifiers = const
+dotnet_naming_symbols.private_instance_fields_symbols.applicable_accessibilities = private
+dotnet_naming_symbols.private_instance_fields_symbols.applicable_kinds = field
+dotnet_naming_symbols.private_static_fields_symbols.applicable_accessibilities = private
+dotnet_naming_symbols.private_static_fields_symbols.applicable_kinds = field
+dotnet_naming_symbols.private_static_fields_symbols.required_modifiers = static
+dotnet_naming_symbols.private_static_readonly_symbols.applicable_accessibilities = private
+dotnet_naming_symbols.private_static_readonly_symbols.applicable_kinds = field
+dotnet_naming_symbols.private_static_readonly_symbols.required_modifiers = static, readonly
+dotnet_style_parentheses_in_arithmetic_binary_operators = never_if_unnecessary:none
+dotnet_style_parentheses_in_other_binary_operators = never_if_unnecessary:none
+dotnet_style_parentheses_in_relational_binary_operators = never_if_unnecessary:none
+dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
+dotnet_style_predefined_type_for_member_access = true:suggestion
+dotnet_style_qualification_for_event = false:suggestion
+dotnet_style_qualification_for_field = false:suggestion
+dotnet_style_qualification_for_method = false:suggestion
+dotnet_style_qualification_for_property = false:suggestion
+dotnet_style_require_accessibility_modifiers = for_non_interface_members:suggestion
+
+# Microsoft .NET properties
+csharp_preserve_single_line_blocks = true
+dotnet_naming_rule.constants_rule.severity = warning
+dotnet_naming_rule.constants_rule.style = upper_camel_case_style
+dotnet_naming_rule.constants_rule.symbols = constants_symbols
+dotnet_naming_symbols.constants_symbols.applicable_accessibilities = public, internal, protected, protected_internal, private_protected
+dotnet_naming_symbols.constants_symbols.applicable_kinds = field
+dotnet_naming_symbols.constants_symbols.required_modifiers = const
+
+# ReSharper properties
+resharper_align_linq_query = true
+resharper_align_multiline_argument = true
+resharper_align_multiline_calls_chain = true
+resharper_align_multiline_extends_list = true
+resharper_align_multiline_for_stmt = true
+resharper_align_multline_type_parameter_constrains = true
+resharper_align_multline_type_parameter_list = true
+resharper_align_tuple_components = true
+resharper_csharp_align_multiline_parameter = false
+resharper_csharp_align_multiple_declaration = true
+resharper_csharp_indent_style = tab
+resharper_csharp_naming_rule.constants = AaBb, aaBb
+resharper_csharp_naming_rule.private_constants = AaBb
+resharper_csharp_naming_rule.private_static_fields = _ + aaBb
+resharper_csharp_naming_rule.private_static_readonly = AaBb
+resharper_csharp_stick_comment = false
+resharper_csharp_wrap_chained_method_calls = chop_if_long
+resharper_csharp_wrap_extends_list_style = chop_if_long
+resharper_csharp_wrap_parameters_style = chop_if_long
+resharper_enforce_line_ending_style = true
+resharper_keep_existing_arrangement = false
+resharper_max_initializer_elements_on_line = 0
+resharper_nested_ternary_style = compact
+resharper_Module2_attribute_on_same_line = false
+resharper_Module2_expr_accessor_on_single_line = true
+resharper_Module2_expr_method_on_single_line = true
+resharper_Module2_expr_property_on_single_line = true
+resharper_Module2_simple_accessor_on_single_line = false
+resharper_Module2_simple_anonymousmethod_on_single_line = false
+resharper_Module2_simple_embedded_statement_on_same_line = false
+resharper_Module2_simple_initializer_on_single_line = false
+resharper_use_indent_from_vs = false
+resharper_wrap_array_initializer_style = chop_always
+resharper_wrap_chained_binary_expressions = chop_if_long
+resharper_wrap_object_and_collection_initializer_style = chop_always
+# Code files
+[*.{cs,csx,vb,vbx}]
+charset = utf-8-bom
+indent_size = 4
+insert_final_newline = false
+###############################
+# .NET Coding Conventions #
+###############################
+[*.{cs,vb}]
+dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion
+dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style
+dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
+dotnet_naming_style.pascal_case_style.capitalization = pascal_case
+dotnet_naming_symbols.constant_fields.applicable_accessibilities = *
+dotnet_naming_symbols.constant_fields.applicable_kinds = field
+dotnet_naming_symbols.constant_fields.required_modifiers = const
+dotnet_sort_system_directives_first = true
+dotnet_style_coalesce_expression = true:suggestion
+dotnet_style_collection_initializer = true:suggestion
+dotnet_style_explicit_tuple_names = true:suggestion
+dotnet_style_null_propagation = true:suggestion
+dotnet_style_object_initializer = true:suggestion
+dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent
+dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent
+dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent
+dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent
+dotnet_style_predefined_type_for_locals_parameters_members = true:silent
+dotnet_style_predefined_type_for_member_access = true:silent
+dotnet_style_prefer_auto_properties = true:silent
+dotnet_style_prefer_conditional_expression_over_assignment = true:silent
+dotnet_style_prefer_conditional_expression_over_return = true:silent
+dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
+dotnet_style_prefer_inferred_tuple_names = true:suggestion
+dotnet_style_prefer_is_null_check_over_reference_equality_method = true:silent
+dotnet_style_qualification_for_event = false:silent
+dotnet_style_qualification_for_field = false:silent
+dotnet_style_qualification_for_method = false:silent
+dotnet_style_qualification_for_property = false:silent
+dotnet_style_readonly_field = true:suggestion
+dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent
+###############################
+# C# Coding Conventions #
+###############################
+[*.cs]
+csharp_indent_case_contents_when_block = true
+csharp_indent_case_contents = true
+csharp_indent_labels = flush_left
+csharp_indent_switch_labels = true
+csharp_new_line_before_catch = true
+csharp_new_line_before_else = true
+csharp_new_line_before_finally = true
+csharp_new_line_before_members_in_anonymous_types = true
+csharp_new_line_before_members_in_object_initializers = true
+csharp_new_line_before_open_brace = all
+csharp_new_line_between_query_expression_clauses = true
+csharp_prefer_braces = true:silent
+csharp_prefer_simple_default_expression = true:suggestion
+csharp_preferred_modifier_order = public, private, protected, internal, static, extern, new, virtual, abstract, sealed, override, readonly, unsafe, volatile, async:suggestion
+csharp_preserve_single_line_blocks = true
+csharp_preserve_single_line_statements = true
+csharp_space_after_cast = false
+csharp_space_after_colon_in_inheritance_clause = true
+csharp_space_after_keywords_in_control_flow_statements = true
+csharp_space_around_binary_operators = before_and_after
+csharp_space_before_colon_in_inheritance_clause = true
+csharp_space_between_method_call_empty_parameter_list_parentheses = false
+csharp_space_between_method_call_name_and_opening_parenthesis = false
+csharp_space_between_method_call_parameter_list_parentheses = false
+csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
+csharp_space_between_method_declaration_parameter_list_parentheses = false
+csharp_space_between_parentheses = false
+csharp_style_conditional_delegate_call = true:suggestion
+csharp_style_deconstructed_variable_declaration = true:suggestion
+csharp_style_expression_bodied_accessors = true:silent
+csharp_style_expression_bodied_constructors = false:silent
+csharp_style_expression_bodied_indexers = true:silent
+csharp_style_expression_bodied_methods = false:silent
+csharp_style_expression_bodied_operators = false:silent
+csharp_style_expression_bodied_properties = true:silent
+csharp_style_inlined_variable_declaration = true:suggestion
+csharp_style_pattern_local_over_anonymous_function = true:suggestion
+csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
+csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
+csharp_style_throw_expression = true:suggestion
+csharp_style_var_elsewhere = true:silent
+csharp_style_var_for_built_in_types = true:silent
+csharp_style_var_when_type_is_apparent = true:silent
+dotnet_analyzer_diagnostic.category-.severity = unset
+dotnet_analyzer_diagnostic.severity = unset
+dotnet_diagnostic..severity = unset
+dotnet_separate_import_directive_groups = false
+indent_style = tab
+indent_size = 4
+tab_width = 4
+
+[*.{appxmanifest,axml,build,config,csproj,dbml,discomap,dtd,jsproj,lsproj,njsproj,nuspec,proj,props,proto,StyleCop,targets,tasks,vbproj,xaml,xamlx,xml,xoml,xsd,asax,ascx,aspx,cs,cshtml,css,htm,html,js,json,jsx,master,razor,resjson,resw,resx,skin,ts,tsx,vb}]
+indent_size = 4
+indent_style = tab
+tab_width = 4
\ No newline at end of file
diff --git a/templates/ModularMonolith/.github/FUNDING.yml b/templates/ModularMonolith/.github/FUNDING.yml
new file mode 100644
index 0000000..52d9f3e
--- /dev/null
+++ b/templates/ModularMonolith/.github/FUNDING.yml
@@ -0,0 +1 @@
+custom: ["https://www.buymeacoffee.com/vlad.antonyuk"]
\ No newline at end of file
diff --git a/templates/ModularMonolith/.github/dependabot.yml b/templates/ModularMonolith/.github/dependabot.yml
new file mode 100644
index 0000000..05cad52
--- /dev/null
+++ b/templates/ModularMonolith/.github/dependabot.yml
@@ -0,0 +1,39 @@
+version: 2
+updates:
+- package-ecosystem: nuget
+ directory: "/"
+ schedule:
+ interval: daily
+ reviewers:
+ - "VladislavAntonyuk"
+ assignees:
+ - "VladislavAntonyuk"
+ open-pull-requests-limit: 10
+ groups:
+ Aspire:
+ patterns:
+ - "Aspire*"
+ HotChocolate:
+ patterns:
+ - "HotChocolate*"
+ Microsoft:
+ patterns:
+ - "Microsoft*"
+ MassTransit:
+ patterns:
+ - "MassTransit*"
+ Syncfusion:
+ patterns:
+ - "Syncfusion*"
+ CommunityToolkit:
+ patterns:
+ - "CommunityToolkit*"
+ OpenTelementry:
+ patterns:
+ - "OpenTelementry*"
+ Testcontainers:
+ patterns:
+ - "Testcontainers*"
+ xUnit:
+ patterns:
+ - "xunit*"
diff --git a/templates/ModularMonolith/.github/workflows/main_App1_client.yml b/templates/ModularMonolith/.github/workflows/main_App1_client.yml
new file mode 100644
index 0000000..90b3987
--- /dev/null
+++ b/templates/ModularMonolith/.github/workflows/main_App1_client.yml
@@ -0,0 +1,95 @@
+name: Build and deploy client
+
+on:
+ push:
+ branches: [ main ]
+ paths:
+ - 'src/Client/**'
+ - '.github/workflows/main_world-explorer_client.yml'
+ pull_request:
+ branches: [ main ]
+ paths:
+ - 'src/Client/**'
+ - '.github/workflows/main_world-explorer_client.yml'
+
+concurrency:
+ group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
+ cancel-in-progress: true
+
+env:
+ VERSION: 2.0.${{github.run_number}}.0
+
+jobs:
+ buildClient:
+ runs-on: ${{ matrix.os }}
+ strategy:
+ fail-fast: false
+ matrix:
+ os: [windows-latest]
+ #os: [windows-latest, macos-latest]
+
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: Set up .NET
+ uses: actions/setup-dotnet@v4
+ with:
+ dotnet-version: '9.x'
+
+ - name: Install workloads
+ run: dotnet workload install maui
+
+ - name: Prepare build
+ run: |
+ (Get-Content src\Client\Client\Platforms\Windows\Package.appxmanifest).Replace('1.0.0.0', '${{ env.VERSION }}') | Set-Content src\Client\Client\Platforms\Windows\Package.appxmanifest
+ (Get-Content src\Client\Client\Client.csproj).Replace('1.0', '${{ env.VERSION }}') | Set-Content src\Client\Client\Client.csproj
+ (Get-Content src\Client\Client\Client.csproj).Replace('1', '${{github.run_number}}') | Set-Content src\Client\Client\Client.csproj
+
+ - name: Build Client (Android)
+ run: |
+ dotnet publish src/Client/Client/Client.csproj -f net9.0-android /p:Version="${{ env.VERSION }}"
+ mkdir output\android
+ copy ".\src\Client\Client\bin\Release\net9.0-android\publish\com.vladislavantonyuk.worldexplorer.aab" "output\android"
+
+ - name: Build Client (Apple)
+ run: |
+ dotnet build src/Client/Client/Client.csproj -f net9.0-ios /p:Version="${{ env.VERSION }}"
+ dotnet publish src/Client/Client/Client.csproj -f net9.0-maccatalyst /p:Version="${{ env.VERSION }}"
+ mkdir output\maccatalyst
+ copy ".\src\Client\Client\bin\Release\net9.0-maccatalyst\**\*.pkg" "output\maccatalyst"
+
+ - name: Build Client (Windows)
+ run: |
+ dotnet publish src/Client/Client/Client.csproj -f net9.0-windows10.0.19041.0 /p:Version="${{ env.VERSION }}"
+ mkdir output\windows
+ copy ".\src\Client\Client\bin\Release\net9.0-windows10.0.19041.0\win10-x64\AppPackages\**\*.msix" "output\windows"
+
+ - name: Upload artifact for deployment job
+ uses: actions/upload-artifact@v4
+ with:
+ name: client
+ path: output
+ retention-days: 7
+
+ deployClient:
+ runs-on: windows-latest
+ needs: buildClient
+ if: github.event_name != 'pull_request'
+ environment:
+ name: 'Production'
+
+ steps:
+ - name: Download artifact from build job
+ uses: actions/download-artifact@v4
+ with:
+ name: client
+ path: "${{ github.workspace }}/client"
+
+ # - name: Deploy Windows App to Microsoft Store
+ # uses: isaacrlevin/windows-store-action
+ # with:
+ # tenant-id: ${{ secrets.AZURE_AD_TENANT_ID }}
+ # client-id: ${{ secrets.AZURE_AD_APPLICATION_CLIENT_ID }}
+ # client-secret: ${{ secrets.AZURE_AD_APPLICATION_SECRET }}
+ # app-id: ${{ secrets.STORE_APP_ID }}
+ # package-path: "${{ github.workspace }}/client/windows/WorldExplorer.msix"
diff --git a/templates/ModularMonolith/.github/workflows/main_App1_webapp.yml b/templates/ModularMonolith/.github/workflows/main_App1_webapp.yml
new file mode 100644
index 0000000..9c594df
--- /dev/null
+++ b/templates/ModularMonolith/.github/workflows/main_App1_webapp.yml
@@ -0,0 +1,123 @@
+name: Build and deploy webapp
+
+on:
+ push:
+ branches: [ main ]
+ paths:
+ - 'src/Web/**'
+ - 'src/Common/**'
+ - 'src/Modules/**'
+ - '.github/workflows/main_world-explorer_webapp.yml'
+ pull_request:
+ branches: [ main ]
+ paths:
+ - 'src/Web/**'
+ - 'src/Common/**'
+ - 'src/Modules/**'
+ - '.github/workflows/main_world-explorer_webapp.yml'
+
+concurrency:
+ group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
+ cancel-in-progress: true
+
+env:
+ VERSION: 2.0.${{github.run_number}}.0
+
+jobs:
+ buildWebApp:
+ runs-on: windows-latest
+
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: Set up .NET
+ uses: actions/setup-dotnet@v4
+ with:
+ dotnet-version: '9.x'
+
+ - name: Publish WebApp
+ run: dotnet publish src/Web/WorldExplorer.Web/WorldExplorer.Web.csproj -o '${{env.DOTNET_ROOT}}/webapp' /p:Version="${{ env.VERSION }}"
+
+ - name: Publish WebApi
+ run: dotnet publish src/Web/WorldExplorer.ApiService/WorldExplorer.ApiService.csproj -o '${{env.DOTNET_ROOT}}/webapi' /p:Version="${{ env.VERSION }}"
+
+ - name: Upload artifact for webapp job
+ uses: actions/upload-artifact@v4
+ with:
+ name: webapp
+ path: ${{env.DOTNET_ROOT}}/webapp
+ retention-days: 1
+
+ - name: Upload artifact for webapi job
+ uses: actions/upload-artifact@v4
+ with:
+ name: webapi
+ path: ${{env.DOTNET_ROOT}}/webapi
+ retention-days: 1
+
+ deployWebApi:
+ runs-on: windows-latest
+ needs: buildWebApp
+ if: github.event_name != 'pull_request'
+ environment:
+ name: 'Production'
+ url: ${{ steps.deploy-to-webapi.outputs.webapp-url }}
+
+ steps:
+ - name: Download artifact from build job
+ uses: actions/download-artifact@v4
+ with:
+ name: webapi
+
+ - uses: cschleiden/replace-tokens@v1
+ env:
+ AAD_B2C_CLAIMS_BASIC_AUTH_USERNAME: ${{ secrets.AAD_B2C_CLAIMS_BASIC_AUTH_USERNAME }}
+ AAD_B2C_CLAIMS_BASIC_AUTH_PASSWORD: ${{ secrets.AAD_B2C_CLAIMS_BASIC_AUTH_PASSWORD }}
+ AAD_B2C_CLIENT_SECRET: ${{ secrets.AAD_B2C_CLIENT_SECRET }}
+ AAD_B2C_GRAPH_CLIENT_SECRET: ${{ secrets.AAD_B2C_GRAPH_CLIENT_SECRET }}
+ GOOGLE_SEARCH_APIKEY: ${{ secrets.GOOGLE_SEARCH_APIKEY }}
+ with:
+ tokenPrefix: '#{'
+ tokenSuffix: '}#'
+ files: '["**/appsettings.json", "**/modules.**.json"]'
+
+ - name: Deploy to Azure Web App
+ id: deploy-to-webapi
+ uses: azure/webapps-deploy@v3
+ with:
+ app-name: 'world-explorer-api'
+ slot-name: 'Production'
+ publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_680706DABCBA4243912E52268C835D16 }}
+ package: .
+
+ deployWebApp:
+ runs-on: windows-latest
+ needs: deployWebApi
+ if: github.event_name != 'pull_request'
+ environment:
+ name: 'Production'
+ url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
+
+ steps:
+ - name: Download artifact from build job
+ uses: actions/download-artifact@v4
+ with:
+ name: webapp
+
+ - uses: cschleiden/replace-tokens@v1
+ env:
+ AAD_B2C_CLIENT_SECRET: ${{ secrets.AAD_B2C_CLIENT_SECRET }}
+ WORLD_EXPLORER_API_CLIENT_SCOPES: ${{ secrets.WORLD_EXPLORER_API_CLIENT_SCOPES }}
+ with:
+ tokenPrefix: '#{'
+ tokenSuffix: '}#'
+ files: '["**/appsettings.json"]'
+
+ - name: Deploy to Azure Web App
+ id: deploy-to-webapp
+ uses: azure/webapps-deploy@v3
+ with:
+ app-name: 'world-explorer'
+ slot-name: 'Production'
+ publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_649309CDF7F74F7B9D0D75A9017C1111 }}
+ package: .
diff --git a/templates/ModularMonolith/.gitignore b/templates/ModularMonolith/.gitignore
new file mode 100644
index 0000000..068788e
--- /dev/null
+++ b/templates/ModularMonolith/.gitignore
@@ -0,0 +1,408 @@
+# globs
+Makefile.in
+*.userprefs
+*.usertasks
+config.make
+config.status
+aclocal.m4
+install-sh
+autom4te.cache/
+*.tar.gz
+tarballs/
+test-results/
+
+# Mac bundle stuff
+*.dmg
+*.app
+
+# content below from: https://github.com/github/gitignore/blob/main/Global/macOS.gitignore
+# General
+.DS_Store
+.AppleDouble
+.LSOverride
+
+# Icon must end with two \r
+Icon
+
+
+# Thumbnails
+._*
+
+# Files that might appear in the root of a volume
+.DocumentRevisions-V100
+.fseventsd
+.Spotlight-V100
+.TemporaryItems
+.Trashes
+.VolumeIcon.icns
+.com.apple.timemachine.donotpresent
+
+# Directories potentially created on remote AFP share
+.AppleDB
+.AppleDesktop
+Network Trash Folder
+Temporary Items
+.apdisk
+
+# content below from: https://github.com/github/gitignore/blob/main/Global/Windows.gitignore
+# Windows thumbnail cache files
+Thumbs.db
+ehthumbs.db
+ehthumbs_vista.db
+
+# Dump file
+*.stackdump
+
+# Folder config file
+[Dd]esktop.ini
+
+# Recycle Bin used on file shares
+$RECYCLE.BIN/
+
+# Windows Installer files
+*.cab
+*.msi
+*.msix
+*.msm
+*.msp
+
+# Windows shortcuts
+*.lnk
+
+# content below from: https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
+## Ignore Visual Studio temporary files, build results, and
+## files generated by popular Visual Studio add-ons.
+##
+## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
+
+# User-specific files
+*.suo
+*.user
+*.userosscache
+*.sln.docstates
+
+# User-specific files (MonoDevelop/Xamarin Studio)
+*.userprefs
+
+# Build results
+[Dd]ebug/
+[Dd]ebugPublic/
+[Rr]elease/
+[Rr]eleases/
+x64/
+x86/
+bld/
+[Bb]in/
+[Oo]bj/
+[Ll]og/
+
+# Visual Studio 2015/2017 cache/options directory
+.vs/
+.vscode/
+# Uncomment if you have tasks that create the project's static files in wwwroot
+#wwwroot/
+
+# Visual Studio 2017 auto generated files
+Generated\ Files/
+
+# MSTest test Results
+[Tt]est[Rr]esult*/
+[Bb]uild[Ll]og.*
+
+# NUNIT
+*.VisualState.xml
+TestResult.xml
+
+# Build Results of an ATL Project
+[Dd]ebugPS/
+[Rr]eleasePS/
+dlldata.c
+
+# Benchmark Results
+BenchmarkDotNet.Artifacts/
+
+# .NET Core
+project.lock.json
+project.fragment.lock.json
+artifacts/
+
+# StyleCop
+StyleCopReport.xml
+
+# Files built by Visual Studio
+*_i.c
+*_p.c
+*_h.h
+*.ilk
+*.meta
+*.obj
+!**/[Aa]ssets/*.obj
+*.iobj
+*.pch
+*.pdb
+*.ipdb
+*.pgc
+*.pgd
+*.rsp
+*.sbr
+*.tlb
+*.tli
+*.tlh
+*.tmp
+*.tmp_proj
+*_wpftmp.csproj
+*.log
+*.vspscc
+*.vssscc
+.builds
+*.pidb
+*.svclog
+*.scc
+
+# Chutzpah Test files
+_Chutzpah*
+
+# Visual C++ cache files
+ipch/
+*.aps
+*.ncb
+*.opendb
+*.opensdf
+*.sdf
+*.cachefile
+*.VC.db
+*.VC.VC.opendb
+
+# Visual Studio profiler
+*.psess
+*.vsp
+*.vspx
+*.sap
+
+# Visual Studio Trace Files
+*.e2e
+
+# TFS 2012 Local Workspace
+$tf/
+
+# Guidance Automation Toolkit
+*.gpState
+
+# ReSharper is a .NET coding add-in
+_ReSharper*/
+*.[Rr]e[Ss]harper
+*.DotSettings.user
+
+# JustCode is a .NET coding add-in
+.JustCode
+
+# TeamCity is a build add-in
+_TeamCity*
+
+# DotCover is a Code Coverage Tool
+*.dotCover
+
+# AxoCover is a Code Coverage Tool
+.axoCover/*
+!.axoCover/settings.json
+
+# Visual Studio code coverage results
+*.coverage
+*.coveragexml
+
+# NCrunch
+_NCrunch_*
+.*crunch*.local.xml
+nCrunchTemp_*
+
+# MightyMoose
+*.mm.*
+AutoTest.Net/
+
+# Web workbench (sass)
+.sass-cache/
+
+# Installshield output folder
+[Ee]xpress/
+
+# DocProject is a documentation generator add-in
+DocProject/buildhelp/
+DocProject/Help/*.HxT
+DocProject/Help/*.HxC
+DocProject/Help/*.hhc
+DocProject/Help/*.hhk
+DocProject/Help/*.hhp
+DocProject/Help/Html2
+DocProject/Help/html
+
+# Click-Once directory
+publish/
+
+# Publish Web Output
+*.[Pp]ublish.xml
+*.azurePubxml
+# Note: Comment the next line if you want to checkin your web deploy settings,
+# but database connection strings (with potential passwords) will be unencrypted
+*.pubxml
+*.publishproj
+
+# Microsoft Azure Web App publish settings. Comment the next line if you want to
+# checkin your Azure Web App publish settings, but sensitive information contained
+# in these scripts will be unencrypted
+PublishScripts/
+
+# NuGet Packages
+*.nupkg
+# The packages folder can be ignored because of Package Restore
+**/[Pp]ackages/*
+# except build/, which is used as an MSBuild target.
+!**/[Pp]ackages/build/
+# Uncomment if necessary however generally it will be regenerated when needed
+#!**/[Pp]ackages/repositories.config
+# NuGet v3's project.json files produces more ignorable files
+*.nuget.props
+*.nuget.targets
+
+# Microsoft Azure Build Output
+csx/
+*.build.csdef
+
+# Microsoft Azure Emulator
+ecf/
+rcf/
+
+# Windows Store app package directories and files
+AppPackages/
+BundleArtifacts/
+Package.StoreAssociation.xml
+_pkginfo.txt
+*.appx
+
+# Visual Studio cache files
+# files ending in .cache can be ignored
+*.[Cc]ache
+# but keep track of directories ending in .cache
+!*.[Cc]ache/
+
+# Others
+ClientBin/
+~$*
+*~
+*.dbmdl
+*.dbproj.schemaview
+*.jfm
+*.pfx
+*.publishsettings
+orleans.codegen.cs
+
+# Including strong name files can present a security risk
+# (https://github.com/github/gitignore/pull/2483#issue-259490424)
+#*.snk
+
+# Since there are multiple workflows, uncomment next line to ignore bower_components
+# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
+#bower_components/
+
+# RIA/Silverlight projects
+Generated_Code/
+
+# Backup & report files from converting an old project file
+# to a newer Visual Studio version. Backup files are not needed,
+# because we have git ;-)
+_UpgradeReport_Files/
+Backup*/
+UpgradeLog*.XML
+UpgradeLog*.htm
+ServiceFabricBackup/
+*.rptproj.bak
+
+# SQL Server files
+*.mdf
+*.ldf
+*.ndf
+
+# Business Intelligence projects
+*.rdl.data
+*.bim.layout
+*.bim_*.settings
+*.rptproj.rsuser
+
+# Microsoft Fakes
+FakesAssemblies/
+
+# GhostDoc plugin setting file
+*.GhostDoc.xml
+
+# Node.js Tools for Visual Studio
+.ntvs_analysis.dat
+node_modules/
+
+# Visual Studio 6 build log
+*.plg
+
+# Visual Studio 6 workspace options file
+*.opt
+
+# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
+*.vbw
+
+# Visual Studio LightSwitch build output
+**/*.HTMLClient/GeneratedArtifacts
+**/*.DesktopClient/GeneratedArtifacts
+**/*.DesktopClient/ModelManifest.xml
+**/*.Server/GeneratedArtifacts
+**/*.Server/ModelManifest.xml
+_Pvt_Extensions
+
+# Paket dependency manager
+.paket/paket.exe
+paket-files/
+
+# FAKE - F# Make
+.fake/
+
+# JetBrains Rider
+.idea/
+*.sln.iml
+
+# CodeRush personal settings
+.cr/personal
+
+# Python Tools for Visual Studio (PTVS)
+__pycache__/
+*.pyc
+
+# Cake - Uncomment if you are using it
+# tools/**
+# !tools/packages.config
+
+# Tabs Studio
+*.tss
+
+# Telerik's JustMock configuration file
+*.jmconfig
+
+# BizTalk build output
+*.btp.cs
+*.btm.cs
+*.odx.cs
+*.xsd.cs
+
+# OpenCover UI analysis results
+OpenCover/
+
+# Azure Stream Analytics local run output
+ASALocalRun/
+
+# MSBuild Binary and Structured Log
+*.binlog
+
+# NVidia Nsight GPU debugger configuration file
+*.nvuser
+
+# MFractors (Xamarin productivity tool) working folder
+.mfractor/
+
+# Local History for Visual Studio
+.localhistory/
+*.[Dd]evelopment.json
\ No newline at end of file
diff --git a/templates/ModularMonolith/.template.config/template.json b/templates/ModularMonolith/.template.config/template.json
new file mode 100644
index 0000000..7e5f11e
--- /dev/null
+++ b/templates/ModularMonolith/.template.config/template.json
@@ -0,0 +1,49 @@
+{
+ "$schema": "http://json.schemastore.org/template",
+ "author": "Vladislav Antonyuk",
+ "classifications": ["Web","MAUI"],
+ "description": "Creates Modular Monolith application with Microsoft Identity Platform authentication (Azure Active Directory B2C).",
+ "name": "Modular Monolith App with Microsoft Identity Platform authentication",
+ "identity": "VladislavAntonyuk.DotNetTemplates.ModularMonolith",
+ "tags": {
+ "language": "C#",
+ "type": "project"
+ },
+ "shortName": "modular-monolith",
+ "sourceName": "App1",
+ "preferNameDirectory":true,
+ "symbols": {
+ "module1": {
+ "description": "Module1 name",
+ "type": "parameter",
+ "replaces": "Module1",
+ "FileRename": "Module1"
+ },
+ "module1Lower": {
+ "type": "generated",
+ "generator": "casing",
+ "parameters": {
+ "source": "module1",
+ "toLower": true
+ },
+ "replaces": "module1",
+ "FileRename": "module1"
+ },
+ "module2": {
+ "description": "Module2 name",
+ "type": "parameter",
+ "replaces": "Module2",
+ "FileRename": "Module2"
+ },
+ "module2Lower": {
+ "type": "generated",
+ "generator": "casing",
+ "parameters": {
+ "source": "module2",
+ "toLower": true
+ },
+ "replaces": "module2",
+ "FileRename": "module2"
+ }
+ }
+}
\ No newline at end of file
diff --git a/templates/ModularMonolith/App1.slnx b/templates/ModularMonolith/App1.slnx
new file mode 100644
index 0000000..0d015c1
--- /dev/null
+++ b/templates/ModularMonolith/App1.slnx
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/templates/ModularMonolith/Directory.Build.props b/templates/ModularMonolith/Directory.Build.props
new file mode 100644
index 0000000..8537180
--- /dev/null
+++ b/templates/ModularMonolith/Directory.Build.props
@@ -0,0 +1,20 @@
+
+
+
+
+
+ net9.0
+ enable
+ enable
+ true
+ true
+ $(NoWarn);NU1902;NU1903;S101
+
+
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+
\ No newline at end of file
diff --git a/templates/ModularMonolith/README.md b/templates/ModularMonolith/README.md
new file mode 100644
index 0000000..af6a92a
--- /dev/null
+++ b/templates/ModularMonolith/README.md
@@ -0,0 +1 @@
+# App1
diff --git a/templates/ModularMonolith/src/Common/App1.Common.Application/App1.Common.Application.csproj b/templates/ModularMonolith/src/Common/App1.Common.Application/App1.Common.Application.csproj
new file mode 100644
index 0000000..88ca040
--- /dev/null
+++ b/templates/ModularMonolith/src/Common/App1.Common.Application/App1.Common.Application.csproj
@@ -0,0 +1,17 @@
+
+
+
+ $(NetVersion)
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/templates/ModularMonolith/src/Common/App1.Common.Application/ApplicationConfiguration.cs b/templates/ModularMonolith/src/Common/App1.Common.Application/ApplicationConfiguration.cs
new file mode 100644
index 0000000..eece06b
--- /dev/null
+++ b/templates/ModularMonolith/src/Common/App1.Common.Application/ApplicationConfiguration.cs
@@ -0,0 +1,25 @@
+namespace App1.Common.Application;
+
+using System.Reflection;
+using Behaviors;
+using FluentValidation;
+using Microsoft.Extensions.DependencyInjection;
+
+public static class ApplicationConfiguration
+{
+ public static IServiceCollection AddApplication(this IServiceCollection services, Assembly[] moduleAssemblies)
+ {
+ services.AddMediatR(config =>
+ {
+ config.RegisterServicesFromAssemblies(moduleAssemblies);
+
+ config.AddOpenBehavior(typeof(ExceptionHandlingPipelineBehavior<,>));
+ config.AddOpenBehavior(typeof(RequestLoggingPipelineBehavior<,>));
+ config.AddOpenBehavior(typeof(ValidationPipelineBehavior<,>));
+ });
+
+ services.AddValidatorsFromAssemblies(moduleAssemblies, includeInternalTypes: true);
+
+ return services;
+ }
+}
\ No newline at end of file
diff --git a/templates/ModularMonolith/src/Common/App1.Common.Application/Behaviors/ExceptionHandlingPipelineBehavior.cs b/templates/ModularMonolith/src/Common/App1.Common.Application/Behaviors/ExceptionHandlingPipelineBehavior.cs
new file mode 100644
index 0000000..2ddc6c1
--- /dev/null
+++ b/templates/ModularMonolith/src/Common/App1.Common.Application/Behaviors/ExceptionHandlingPipelineBehavior.cs
@@ -0,0 +1,26 @@
+namespace App1.Common.Application.Behaviors;
+
+using Exceptions;
+using MediatR;
+using Microsoft.Extensions.Logging;
+
+internal sealed class ExceptionHandlingPipelineBehavior(
+ ILogger> logger)
+ : IPipelineBehavior where TRequest : class
+{
+ public async Task Handle(TRequest request,
+ RequestHandlerDelegate next,
+ CancellationToken cancellationToken)
+ {
+ try
+ {
+ return await next();
+ }
+ catch (Exception exception)
+ {
+ logger.LogError(exception, "Unhandled exception for {RequestName}", typeof(TRequest).Name);
+
+ throw new App1Exception(typeof(TRequest).Name, innerException: exception);
+ }
+ }
+}
\ No newline at end of file
diff --git a/templates/ModularMonolith/src/Common/App1.Common.Application/Behaviors/RequestLoggingPipelineBehavior.cs b/templates/ModularMonolith/src/Common/App1.Common.Application/Behaviors/RequestLoggingPipelineBehavior.cs
new file mode 100644
index 0000000..e5b3135
--- /dev/null
+++ b/templates/ModularMonolith/src/Common/App1.Common.Application/Behaviors/RequestLoggingPipelineBehavior.cs
@@ -0,0 +1,48 @@
+namespace App1.Common.Application.Behaviors;
+
+using System.Diagnostics;
+using Domain;
+using MediatR;
+using Microsoft.Extensions.Logging;
+
+internal sealed class RequestLoggingPipelineBehavior(
+ ILogger> logger)
+ : IPipelineBehavior where TRequest : class where TResponse : Result
+{
+ public async Task Handle(TRequest request,
+ RequestHandlerDelegate next,
+ CancellationToken cancellationToken)
+ {
+ var moduleName = GetModuleName(typeof(TRequest).FullName!);
+ var requestName = typeof(TRequest).Name;
+
+ Activity.Current?.SetTag("request.module", moduleName);
+ Activity.Current?.SetTag("request.name", requestName);
+
+ using (logger.BeginScope("Module {ModuleName}", moduleName))
+ {
+ logger.LogInformation("Processing request {RequestName}", requestName);
+
+ var result = await next();
+
+ if (result.IsSuccess)
+ {
+ logger.LogInformation("Completed request {RequestName}", requestName);
+ }
+ else
+ {
+ using (logger.BeginScope("Error {Error}", result.Error))
+ {
+ logger.LogError("Completed request {RequestName} with error", requestName);
+ }
+ }
+
+ return result;
+ }
+ }
+
+ private static string GetModuleName(string requestName)
+ {
+ return requestName.Split('.')[2];
+ }
+}
\ No newline at end of file
diff --git a/templates/ModularMonolith/src/Common/App1.Common.Application/Behaviors/ValidationPipelineBehavior.cs b/templates/ModularMonolith/src/Common/App1.Common.Application/Behaviors/ValidationPipelineBehavior.cs
new file mode 100644
index 0000000..6afe29e
--- /dev/null
+++ b/templates/ModularMonolith/src/Common/App1.Common.Application/Behaviors/ValidationPipelineBehavior.cs
@@ -0,0 +1,68 @@
+namespace App1.Common.Application.Behaviors;
+
+using Domain;
+using FluentValidation;
+using FluentValidation.Results;
+using MediatR;
+using Messaging;
+
+internal sealed class ValidationPipelineBehavior(IEnumerable> validators)
+ : IPipelineBehavior where TRequest : IBaseCommand
+{
+ public async Task Handle(TRequest request,
+ RequestHandlerDelegate next,
+ CancellationToken cancellationToken)
+ {
+ var validationFailures = await ValidateAsync(request);
+
+ if (validationFailures.Length == 0)
+ {
+ return await next();
+ }
+
+ if (typeof(TResponse).IsGenericType && typeof(TResponse).GetGenericTypeDefinition() == typeof(Result<>))
+ {
+ var resultType = typeof(TResponse).GetGenericArguments()[0];
+
+ var failureMethod = typeof(Result<>).MakeGenericType(resultType)
+ .GetMethod(nameof(Result