From 60fffd8e65a8ef656320abe6d2d6301a7b3db5fc Mon Sep 17 00:00:00 2001 From: David Eggenberger <72417712+DavidEggenberger@users.noreply.github.com> Date: Thu, 23 May 2024 08:08:37 +0200 Subject: [PATCH] Update README.md --- README.md | 44 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 41 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 78dc742a..093217ab 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ [![Build and Test](https://github.com/DavidEggenberger/ASPNETCore.Blazor.ModularMonolith.Template/actions/workflows/Build_Test.yml/badge.svg)](https://github.com/DavidEggenberger/ASPNETCore.Blazor.ModularMonolith.Template/actions/workflows/Build_Test.yml) -# Modular Monolith Template +# Modular Monolith SaaS Template Starter Template for building modular monolithic SaaS applications with ASP.NET Core, Blazor and EF Core (SQL Server). @@ -42,5 +42,43 @@ The infrastructure folder contains all the needed Infrastructure components. Typ **IntegrationEvents**:
Defines the IntegrationEvents and is intended to be referenced by other Modules so that the published IntegrationEvents can be handled which enables cross Module communication. - - +## Running the template +The template's only infrastructure dependency is the SQL Server. + +### Infrastructure +The most convient way to run a SQL Server instance is through Docker. To do so run this command from the root folder +(where the ModularMonolith.sln file is located): +``` +docker-compose -f docker-compose.infrastructure.yml up +``` + +The SQL Server must be setup before the template can be successfully run. Because the EF Core migrations were already created they only must be applied to the database. Open the Package Manager Console inside Visual Studio and execute the following two commands: +``` +update-database -context TenantIdentityDbContext +update-database -context SubscriptionsDbContext +``` +These commands will create two seperate shemes with their respective tables on the same database (the configuration string is read from Web/Server/appsettings.Development.json). + +### Web +Before running the WebServer (it serves also the Blazor WebAssembly client) configuration values must be set. They are then accessible through the IConfiguration interface for which ASP.NET Core automatically registers an implementation in the inversion-of-control (DI) container (assuming the configuration resides in appsettings.json or secrets.json). Especially the Infrastructure layer relies on the configuration values (e.g. database connection strings, Stripe API Key). It is highly recommended to keep the following secrets out of source control. For local development right click on the WebServer project and then click on manage user secrets. The opened secrets.json file should then updated to hold the following configuration (the values can be retrieved by following the respective links): + +```json +{ + "EFCoreConfiguration": { + "SQLServerConnectionString_Dev": "Server=127.0.0.1,1433;Database=ModularMonolith;User Id=SA;Password=YourSTRONG!Passw0rd;Encrypt=False;" + }, + "SubscriptionsConfiguration": { + "StripeProfessionalPlanId": "_" + }, + "TenantIdentityConfiguration": { + "GoogleClientId": "_", + "GoogleClientSecret": "_", + "MicrosoftClientId": "_", + "MicrosoftClientSecret": "_", + "LinkedinClientId": "_", + "LinkedinClientSecret": "_" + } +} +``` + +With the configuration set, the WebServer can either be started through Visual Studio.