SaaS-Factory.AppBlueprint.Infrastructure
1.0.0
dotnet add package SaaS-Factory.AppBlueprint.Infrastructure --version 1.0.0
NuGet\Install-Package SaaS-Factory.AppBlueprint.Infrastructure -Version 1.0.0
<PackageReference Include="SaaS-Factory.AppBlueprint.Infrastructure" Version="1.0.0" />
<PackageVersion Include="SaaS-Factory.AppBlueprint.Infrastructure" Version="1.0.0" />
<PackageReference Include="SaaS-Factory.AppBlueprint.Infrastructure" />
paket add SaaS-Factory.AppBlueprint.Infrastructure --version 1.0.0
#r "nuget: SaaS-Factory.AppBlueprint.Infrastructure, 1.0.0"
#:package SaaS-Factory.AppBlueprint.Infrastructure@1.0.0
#addin nuget:?package=SaaS-Factory.AppBlueprint.Infrastructure&version=1.0.0
#tool nuget:?package=SaaS-Factory.AppBlueprint.Infrastructure&version=1.0.0
AppBlueprint.Infrastructure
Overview
The AppBlueprint.Infrastructure package provides the infrastructure layer implementation for the AppBlueprint template. This package contains database repositories, external service integrations, and other infrastructure concerns following Clean Architecture and Domain-Driven Design principles.
Features
Database & Persistence
- Entity Framework Core integration with PostgreSQL
- Multiple Database Contexts:
- ApplicationDBContext
- BaselineDBContext
- B2BDBContext
- B2CDBContext
- Repository implementations for domain aggregates
- Data seeding for each database table
- Database migrations applied to ApplicationDBContext
- Optimistic concurrency control
- Domain event publishing
- Health checks for database connectivity
External Service Integrations
- Email services via Resend
- Payment processing via Stripe
- Cloud storage via AWS S3/Azure Blob/Cloudflare R2
- Authentication and authorization infrastructure
- Identity providers integration
- Messaging systems integration
Caching & Performance
- Redis caching implementation
- Distributed caching abstractions
- Performance monitoring
Infrastructure Services
- Reverse proxy configuration with YARP
- Data protection and security services
- Configuration management with user secrets support
- GraphQL client implementations via Kiota
- System clock abstractions
Health Monitoring
- PostgreSQL health checks
- Redis health checks
- URI endpoint health checks
Installation
dotnet add package SaaS-Factory.AppBlueprint.Infrastructure
Dependencies
This package includes the following key dependencies:
- Microsoft.EntityFrameworkCore - ORM for database operations
- Npgsql.EntityFrameworkCore.PostgreSQL - PostgreSQL provider
- Microsoft.AspNetCore.Authorization - Authorization framework
- Stripe.net - Stripe payment integration
- AWSSDK.S3 - AWS S3 storage integration
- Resend - Email service integration
- Yarp.ReverseProxy - Reverse proxy functionality
Usage
Database Context Registration
services.AddDbContext<ApplicationDbContext>(options =>
options.UseNpgsql(connectionString));
Repository Pattern
public interface IRepository<T> where T : class
{
Task<T> GetByIdAsync(int id);
Task<IEnumerable<T>> GetAllAsync();
Task AddAsync(T entity);
Task UpdateAsync(T entity);
Task DeleteAsync(int id);
}
Health Checks
services.AddHealthChecks()
.AddNpgSql(connectionString)
.AddRedis(redisConnectionString);
Configuration
The package supports various configuration options through appsettings.json:
{
"ConnectionStrings": {
"DefaultConnection": "Server=localhost;Database=AppBlueprint;..."
},
"Stripe": {
"PublishableKey": "pk_test_...",
"SecretKey": "sk_test_..."
},
"AWS": {
"Region": "us-west-2",
"S3BucketName": "your-bucket"
}
}
Architecture
This infrastructure layer implements:
- Repository Pattern for data access abstraction
- Unit of Work Pattern for transaction management
- Factory Pattern for service creation
- Dependency Injection for loose coupling
- Health Check Pattern for monitoring
- Domain Event Pattern for cross-cutting concerns
Components
Database Contexts (EF Core code-first)
- ApplicationDBContext
- BaselineDBContext
- B2BDBContext
- B2CDBContext
External Systems Integration
- Databases (PostgreSQL, SQL Server, NoSQL, Redis)
- Messaging systems
- Email providers
- Storage services (Azure Blob storage/Cloudflare R2)
- Identity providers
- System clock abstractions
Entity Framework Core Features
- DbContext configurations
- Entity configurations
- Repository implementations
- Optimistic concurrency control
- Domain event publishing
Contributing
This package is part of the SaaS Factory Labs AppBlueprint template. Contributions are welcome!
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Submit a pull request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support
- 📚 Documentation
- 🐛 Issues
- 💬 Discussions
Links
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- AspNetCore.HealthChecks.NpgSql (>= 9.0.0)
- AspNetCore.HealthChecks.Redis (>= 9.0.0)
- AspNetCore.HealthChecks.Uris (>= 9.0.0)
- AWSSDK.S3 (>= 3.7.402.12)
- Logto.AspNetCore.Authentication (>= 0.2.0)
- Microsoft.EntityFrameworkCore (>= 10.0.0-rc.1.25451.107)
- Microsoft.EntityFrameworkCore.Design (>= 10.0.0-rc.1.25451.107)
- Microsoft.EntityFrameworkCore.Relational (>= 10.0.0-rc.1.25451.107)
- Microsoft.Extensions.Compliance.Abstractions (>= 10.0.0)
- Microsoft.Extensions.Compliance.Redaction (>= 10.0.0)
- Microsoft.Kiota.Abstractions (>= 1.17.1)
- Newtonsoft.Json (>= 13.0.4)
- Npgsql.EntityFrameworkCore.PostgreSQL (>= 10.0.0-rc.1)
- Resend (>= 0.2.1)
- SaaS-Factory.AppBlueprint.Application (>= 1.0.0)
- SaaS-Factory.AppBlueprint.Domain (>= 1.0.0)
- Stripe.net (>= 48.0.0)
- Yarp.ReverseProxy (>= 2.2.0)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on SaaS-Factory.AppBlueprint.Infrastructure:
| Package | Downloads |
|---|---|
|
SaaS-Factory.AppBlueprint.UiKit
A reusable Razor Class Library for UI components |
|
|
SaaS-Factory.AppBlueprint.Presentation.ApiModule
Presentation layer with API definitions and integrations. |
GitHub repositories
This package is not used by any popular GitHub repositories.