Zooper.Squid 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Zooper.Squid --version 1.0.0
                    
NuGet\Install-Package Zooper.Squid -Version 1.0.0
                    
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="Zooper.Squid" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Zooper.Squid" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Zooper.Squid" />
                    
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 Zooper.Squid --version 1.0.0
                    
#r "nuget: Zooper.Squid, 1.0.0"
                    
#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 Zooper.Squid@1.0.0
                    
#: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=Zooper.Squid&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Zooper.Squid&version=1.0.0
                    
Install as a Cake Tool

Zooper.Squid

<img src="icon.png" alt="Zooper.Squid Logo" width="120" align="right"/>

NuGet Version License: MIT

Zooper.Squid is a lightweight .NET library that simplifies the creation of modular ASP.NET Core applications. It provides a clean and intuitive way to organize your application into independent, reusable modules that can be easily configured and composed.

Key Features

  • Modular Architecture: Break down your application into independent, focused modules
  • Easy Configuration: Simple and intuitive module registration and configuration
  • Dependency Injection: Automatic registration of modules in your DI container
  • Flexible Composition: Mix and match modules to build your application
  • Minimal Dependencies: Only depends on ASP.NET Core
  • Type-safe: Leverages C#'s type system for robust module definitions
  • Testable: Designed with testability in mind from the ground up

Installation

dotnet add package Zooper.Squid

Quick Start

Here's a basic example of creating a modular ASP.NET Core application with Zooper.Squid:

// Define your module (in your modules layer)
public class UserModule : AppModule
{
    public override void ConfigureServices(WebApplicationBuilder builder)
    {
        builder.Services.AddScoped<IUserService, UserService>();
        builder.Services.AddScoped<IUserRepository, UserRepository>();
    }

    public override void ConfigureMiddleware(WebApplication app)
    {
        app.MapControllers();
    }
}

// Register modules in your Program.cs
var builder = WebApplication.CreateBuilder(args);

// Register your modules
builder.AddModules(typeof(UserModule));

var app = builder.Build();

// Configure your modules
app.UseModules();

app.Run();

Core Concepts

Modules

Modules are self-contained units of functionality that can be independently developed, tested, and deployed:

public class AuthenticationModule : AppModule
{
    public override void ConfigureServices(WebApplicationBuilder builder)
    {
        builder.Services.AddAuthentication();
        builder.Services.AddAuthorization();
    }

    public override void ConfigureMiddleware(WebApplication app)
    {
        app.UseAuthentication();
        app.UseAuthorization();
    }
}

Module Registration

Zooper.Squid provides a simple way to register your modules:

// Register a single module
builder.AddModules(typeof(AuthenticationModule));

// Register multiple modules
builder.AddModules(
    typeof(AuthenticationModule),
    typeof(UserModule),
    typeof(LoggingModule)
);

Best Practices

Module Design

  1. Single Responsibility: Each module should have a single, well-defined purpose
  2. Encapsulation: Modules should encapsulate their implementation details
  3. Clear Boundaries: Define clear boundaries between modules
  4. Minimal Dependencies: Keep inter-module dependencies to a minimum

Module Implementation

  1. Configuration: Use ConfigureServices for service registration
  2. Middleware: Use ConfigureMiddleware for pipeline configuration
  3. Dependencies: Use constructor injection for module dependencies
  4. Error Handling: Implement proper error handling within modules

Testing

  1. Module Isolation: Test modules in isolation
  2. Integration Testing: Test module interactions
  3. Mock Dependencies: Use mocks for external dependencies

Examples

Check out the Zooper.Squid.Examples project for comprehensive examples including:

  • Authentication module
  • User management module
  • Logging module
  • API module
  • Different module configurations

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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
2.0.0 642 6/17/2025
1.0.0 329 4/18/2025