BlogArray.SaaS is an open-source multi-tenant SaaS platform designed to empower .NET developers to build, deploy, and manage scalable SaaS applications effortlessly. Built with ASP.NET Core 9, this platform leverages OpenIddict for identity management and Finbuckle.MultiTenant for multi-tenant support. It provides developers with a foundational solution for handling tenant management, authentication, authorization, and tenant-specific functionality, saving time and reducing complexity.
The platform consists of three main applications:
- BlogArray.SaaS.Identity: An identity server built on top of OpenIddict.
- BlogArray.SaaS.TenantSuite: A management application for tenants, users, roles, and scopes.
- BlogArray.SaaS.App: A demonstration of multi-tenant functionality. This application only supports Multiple Database - Complete Data Isolation. Feel free to customize the app for your desired approach.
Note: The project is currently in Proof of Concept (PoC) mode, so there may be occasional mistakes. Contributions and feedback are welcome.
- Multi-Tenant Support: Seamlessly manage multiple tenants using Finbuckle.MultiTenant.
- Identity Management: Built-in identity server leveraging OpenIddict for authentication and authorization.
- Scalability: Designed to support scalable SaaS applications.
- Flexibility: Easily customizable for different business needs.
- Caching: Supports SQL Server or Redis for optimized performance.
- Tenant-Specific Media Storage: Save tenant-specific media files securely using Azure Blob Storage.
- ASP.NET Core 9
- OpenIddict
- Finbuckle.MultiTenant
- Entity Framework Core
- SQL Server / Redis (for caching)
- Azure Blob Storage (for tenant-specific media storage)
To get started with BlogArray.SaaS, follow these steps:
Ensure you have the following installed:
- .NET SDK 9
- SQL Server or Redis
- Azure Storage Account (for media storage)
- Node.js (if using frontend integrations)
- Git
- Visual Studio 2022 with the ASP.NET and web development workload installed
-
Clone the Repository
git clone https://github.com/BlogArray/SaaS.git
-
Navigate to the Project Directory
cd BlogArray/SaaS
-
Restore Dependencies
dotnet restore
-
Configure the Application Update the
appsettings.json
file in each application directory with the following configurations:{ "AllowedHosts": "*", "IPSafeList": "127.0.0.1;192.168.1.5;::1", "ConnectionStrings": { "IdentityContext": "Data Source=.;Initial Catalog=BlogArray.SaaS.Identity;User Id=sa; Password=welcome;TrustServerCertificate=True;MultipleActiveResultSets=True" }, "AzureBlobStorage": { "ConnectionString": "UseDevelopmentStorage=true", "ContainerName": "multi-tenant" }, "Cache": { "Type": "SqlServer", //SqlServer or Redis "ConnectionString": "Data Source=.;Initial Catalog=DistCache;User Id=sa; Password=welcome;TrustServerCertificate=True;MultipleActiveResultSets=True", "SlidingExpirationInMinutes": 30, "AbsoluteExpirationInHours": 6 }, "Links": { "Suite": "https://www.console.blogarray.dev/", "Identity": "https://www.id.blogarray.dev/", "Admin": "https://www.admin.blogarray.dev/", "Issuer": "https://www.id.blogarray.dev/", "Authority": "https://www.id.blogarray.dev/" }, "SMTP": { "FromEmail": "[email protected]", "FromName": "App Development", "Username": "localhost", "Password": "ttczmtxemkinbzxv", "Host": "localhost", "Port": 587, "EnableSsl": false }, "Defaults": { "DefaultLogoUrl": "https://www.id.blogarray.dev/_content/BlogArray.SaaS.Resources/resources/images/blogarray-full-logo.png", "DefaultFaviconUrl": "https://www.id.blogarray.dev/_content/BlogArray.SaaS.Resources/resources/images/blogarray-icon.png" } }
-
Apply Migrations Run the following command in each application directory that uses a database:
dotnet ef database update
-
Update Hosts File To enable a real-time experience, update the
hosts
file atC:\Windows\System32\drivers\etc\hosts
with the following entries:127.0.0.1 blogarray.dev 127.0.0.1 www.blogarray.dev 127.0.0.1 app.blogarray.dev 127.0.0.1 www.app.blogarray.dev 127.0.0.1 id.blogarray.dev 127.0.0.1 www.id.blogarray.dev 127.0.0.1 console.blogarray.dev 127.0.0.1 www.console.blogarray.dev 127.0.0.1 admin.blogarray.dev 127.0.0.1 www.admin.blogarray.dev 127.0.0.1 auth.blogarray.dev 127.0.0.1 www.auth.blogarray.dev
-
Run Multiple Applications in Visual Studio
- Open the
BlogArray.SaaS.sln
solution in Visual Studio. - Set multiple startup projects by:
- Right-click the solution in Solution Explorer and select Properties.
- In the Common Properties -> Startup Project tab, choose Multiple startup projects.
- Set the Action to
Start
forBlogArray.SaaS.Identity
,BlogArray.SaaS.TenantSuite
, andBlogArray.SaaS.App
. - Click OK.
- Press F5 to run all applications simultaneously. Each application will launch in its configured domain.
- Open the
-
Multi-Tenant Configuration: Define tenants in the
appsettings.json
of theTenantSuite
application. -
Identity Server: Configure client secrets and scopes in
BlogArray.SaaS.Identity
. -
Caching: Enable and configure either SQL Server or Redis for caching in the
appsettings.json
. -
Azure Blob Storage: Configure the Azure Blob Storage connection string and container name in
appsettings.json
for tenant-specific media storage. -
Multi-Tenant Strategy Configuration: BlogArray.SaaS uses Finbuckle.MultiTenant's
Route
strategy for tenant identification by default. You can customize the strategy as per your requirements by referring to the Finbuckle.MultiTenant Documentation. Example of switching to theHost
strategy:builder.Services.AddMultiTenant<AppTenantInfo>() .WithHostStrategy() .WithDistributedCacheStore(TimeSpan.FromMinutes(5)) .WithPerTenantAuthentication();
Refer to the documentation for more details and supported strategies.
- BlogArray.SaaS.Identity: Provides authentication and token issuance.
- BlogArray.SaaS.TenantSuite: Manage tenants, users, roles, and scopes.
- BlogArray.SaaS.App: Demonstrates tenant-specific functionality. This application only supports Multiple Database - Complete Data Isolation.
Run each application individually or all together using Visual Studio.
We welcome contributions to improve BlogArray.SaaS! To contribute:
- Fork the repository.
- Create a new branch:
git checkout -b feature/your-feature-name
. - Commit your changes:
git commit -m 'Add your feature'
. - Push the branch:
git push origin feature/your-feature-name
. - Open a pull request.
For detailed guidelines, see the CONTRIBUTING.md.
This project is licensed under the MIT License.
Special thanks to the creators and maintainers of:
We hope BlogArray.SaaS helps you kickstart your SaaS development journey. If you have any questions or encounter issues, feel free to open an issue in the repository!