IPG 1.0.5

dotnet add package IPG --version 1.0.5
                    
NuGet\Install-Package IPG -Version 1.0.5
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="IPG" Version="1.0.5" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="IPG" Version="1.0.5" />
                    
Directory.Packages.props
<PackageReference Include="IPG" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add IPG --version 1.0.5
                    
#r "nuget: IPG, 1.0.5"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package IPG@1.0.5
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=IPG&version=1.0.5
                    
Install as a Cake Addin
#tool nuget:?package=IPG&version=1.0.5
                    
Install as a Cake Tool

IPG - .NET 8 Common Library

A comprehensive .NET 8 library providing common services and utilities for building ASP.NET Core applications quickly.

Features

Dual Logging - Serilog + Application Insights support ✅ Multiple Database Support - MySQL, PostgreSQL, Supabase (use together!) ✅ Supabase Integration - Database, Auth, and Storage ✅ Entity Framework Core - MySQL & PostgreSQL with auto-retry ✅ Azure Communication Services - Enterprise Email & SMS ✅ Google Cloud Storage - File upload/download/delete ✅ Background Jobs - Hangfire with MySQL/PostgreSQL ✅ API Versioning - Built-in URL segment versioning ✅ Swagger/OpenAPI - Auto-generated documentation ✅ Database Migrations - DbUp integration ✅ Exception Handling - Global exception handler ✅ Auto Service Registration - Convention-based DI

Quick Start

1. Install Package

dotnet add package IPG

Or via Package Manager Console in Visual Studio:

Install-Package IPG
Option B: Add Project Reference

Add the IPG project reference to your .csproj:

<ItemGroup>
  <ProjectReference Include="..\IPG\IPG.csproj" />
</ItemGroup>

2. Update Program.cs

using System.Reflection;

var builder = WebApplication.CreateBuilder(args);

// Use IPG Standard - Auto-registers all services
// Note: General.Configuration is automatically initialized from appsettings.json
builder.UseIPGStandard(new[] { Assembly.GetExecutingAssembly() });

var app = builder.Build();

// Use IPG Standard middleware
app.UseIPGStandard();

app.MapControllers();
app.Run();

3. Configure appsettings.json

Minimal configuration:

{
  "ProjectName": "MyApp",
  "Env": "DEV",
  "Swagger": {
    "Enable": true
  }
}

For full configuration options, see appsettings.example.json

4. Create a Controller

[ApiController]
[Route("api/[controller]")]
public class UsersController : ControllerBase
{
    private readonly ISupabaseService _supabase;

    public UsersController(ISupabaseService supabase)
    {
        _supabase = supabase;
    }

    [HttpGet]
    public async Task<IActionResult> GetUsers()
    {
        var users = await _supabase.Table<User>().Get();
        return Ok(users.Models);
    }
}

5. Run Your App

dotnet run

Swagger UI: http://localhost:5000/api/docs

Available Services

All services are automatically registered and available via dependency injection:

Service Interface Description
Supabase ISupabaseService Database, Auth, Storage operations
Azure Communication IAzureCommunicationService Enterprise Email & SMS
Google Storage IGoogleStorageService Google Cloud Storage
General IGeneralService General utility methods

Note: All services are optional and only registered if configured in appsettings.json.

Documentation

📖 Integration Guide - Complete setup guide 📖 Database Usage - MySQL, PostgreSQL & Supabase guide 📖 Azure Communication Services - Email & SMS guide 📖 Supabase Usage - Supabase examples 📖 Example Program.cs - Full Program.cs example 📖 Example Controller - Controller examples 📖 Example Config - Configuration template 📖 Azure Communication Config Examples - 6 configuration scenarios

For React/NPM Developers

📦 React/NPM Library Guide - Create a similar library for React/TypeScript projects

Configuration Options

Required Settings

{
  "ProjectName": "YourAppName",
  "Env": "DEV"
}

Optional Services

Enable/disable services by adding their configuration:

Supabase:

{
  "Supabase": {
    "Url": "https://your-project.supabase.co",
    "Key": "your-anon-key"
  }
}

Application Insights:

{
  "ApplicationInsights": {
    "ConnectionString": "InstrumentationKey=xxx;..."
  }
}

Serilog (Seq):

{
  "Serilog": {
    "serverUrl": "http://localhost:5341",
    "apiKey": "your-key"
  }
}

Azure Communication Services (Email & SMS):

{
  "AzureCommunication": {
    "ConnectionString": "endpoint=https://your-resource.communication.azure.com/;accesskey=YOUR_KEY",
    "EnableEmail": true,
    "EnableSms": true,
    "SenderEmail": "DoNotReply@your-domain.com",
    "SenderDisplayName": "My Application",
    "SmsFromPhoneNumber": "+14255550123",
    "EnableSmsDeliveryReports": true,
    "DefaultSmsTag": "general"
  }
}

See appsettings.azure-communication.json for more configuration examples

Hangfire:

{
  "HangfireOptions": {
    "Enable": true,
    "DbType": "PostgreSQL",
    "ConnectionStrings": "Host=localhost;Database=hangfire;..."
  }
}

What Gets Registered?

When you call builder.UseIPGStandard(), the following happens automatically:

  1. Configuration - Loads appsettings.json + environment-specific configs
  2. Logging - Sets up Serilog with Console, Debug, Seq, and Application Insights
  3. Services - Registers Supabase, Mail, Google Storage, and General services
  4. Options - Binds configuration sections to strongly-typed options
  5. Hangfire - Configures background job processing (if enabled)
  6. Swagger - Sets up OpenAPI documentation (if enabled)
  7. API Versioning - Configures URL segment versioning
  8. AutoMapper - Registers all AutoMapper profiles
  9. Auto DI - Auto-registers classes ending with Service or Repository
  10. JSON - Configures JSON serialization with camelCase and enum support

When you call app.UseIPGStandard(), the middleware is configured:

  1. Serilog Request Logging - Logs all HTTP requests
  2. DbUp Migrations - Runs database migrations on startup
  3. Hangfire Dashboard - Available at /hangfire (if enabled)
  4. Exception Handler - Global exception handling
  5. Swagger UI - Available at /api/docs (if enabled)
  6. Authentication & Authorization - JWT support
  7. CORS - Cross-origin resource sharing

Examples

Supabase Database Query

// Get all records
var users = await _supabase.Table<User>().Get();

// Filter and order
var activeUsers = await _supabase.Table<User>()
    .Where(x => x.Email!.Contains("@example.com"))
    .Order(x => x.CreatedAt, Ordering.Descending)
    .Get();

// Insert
var newUser = new User { Email = "user@example.com" };
await _supabase.Table<User>().Insert(newUser);

Authentication

// Sign up
var session = await _supabase.SignUpAsync("user@example.com", "password123");

// Sign in
var session = await _supabase.SignInAsync("user@example.com", "password123");

// Get current user
var user = _supabase.GetUser();

File Storage

// Upload to Supabase
using var stream = file.OpenReadStream();
var url = await _supabase.UploadFileAsync("avatars", "user.jpg", stream);

// Upload to Google Cloud
var result = await _storage.UploadFilesAsync("bucket", "file.jpg", stream);

Send Email

_mail.SendMail(
    receiver: "user@example.com",
    subject: "Welcome!",
    message: "<h1>Hello!</h1>",
    isHtml: true
);

Use MySQL or PostgreSQL with Entity Framework

// Register MySQL DbContext in Program.cs
builder.Services.AddMySqlContext<MyDbContext>(
    builder.Configuration.GetConnectionString("MySqlConnection")
);

// Register PostgreSQL DbContext in Program.cs
builder.Services.AddPostgreSqlContext<MyDbContext>(
    builder.Configuration.GetConnectionString("PostgreSqlConnection")
);

// Use in controller
public class ProductsController : ControllerBase
{
    private readonly IDbContextFactory<MyDbContext> _dbFactory;

    [HttpGet]
    public async Task<IActionResult> GetProducts()
    {
        await using var context = await _dbFactory.CreateDbContextAsync();
        var products = await context.Products.ToListAsync();
        return Ok(products);
    }
}

See Database Usage Guide for complete examples using MySQL, PostgreSQL, and Supabase together!

Troubleshooting

Service not found

  • Ensure the service's configuration section exists in appsettings.json
  • Check that the service is enabled (for optional services like Hangfire)

Swagger not showing

  • Set Swagger.Enable = true in appsettings.json
  • Navigate to /api/docs (not /swagger)

Requirements

  • .NET 8.0 or higher
  • ASP.NET Core

License

MIT License

Support

For issues or questions, create an issue in the repository.


Built with ❤️ for rapid .NET development

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.5 199 10/29/2025
1.0.0 217 10/24/2025 1.0.0 is deprecated because it has critical bugs.

Version 1.0.0: Initial release with support for Serilog, Application Insights, MySQL, PostgreSQL, Supabase, Hangfire, Google Cloud Storage, email services, API versioning, and Swagger documentation.