From 13181989ea102214a70137cb834df91d79e12998 Mon Sep 17 00:00:00 2001 From: Jonas Ha Date: Thu, 11 Dec 2025 14:25:26 -0500 Subject: [PATCH 1/2] feat(docs): refine documentation for MinimalLambda's AWS Lambda focus - Updated index and README files to highlight Lambda-first design and minimal API-inspired patterns. - Enhanced description of key features, including envelopes, lifecycle hooks, and source generation. - Improved AOT readiness and dependency injection explanations for clarity. - Refined messaging to emphasize Lambda-optimized runtime and familiar .NET ergonomics. --- README.md | 36 +++++++++--------------------------- docs/index.md | 6 +++--- src/MinimalLambda/README.md | 12 +++++------- 3 files changed, 17 insertions(+), 37 deletions(-) diff --git a/README.md b/README.md index 3f9ab583..d9d8c5a4 100644 --- a/README.md +++ b/README.md @@ -5,23 +5,21 @@ [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=j-d-ha_minimal-lambda&metric=alert_status&token=9fb519975d91379dcfbc6c13a4bd4207131af6e3)](https://sonarcloud.io/summary/new_code?id=j-d-ha_minimal-lambda) [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE) -**ASP.NET Core-style patterns for AWS Lambda** – Build Lambda functions (for any trigger) using the same clean, declarative patterns as ASP.NET Core Minimal APIs. +**Lambda-first hosting with Minimal API-inspired patterns** – Familiar .NET ergonomics with handlers, DI, and middleware, purpose-built for AWS Lambda triggers. > πŸ“š **[View Full Documentation](https://j-d-ha.github.io/minimal-lambda/)** ## Overview -**If you know ASP.NET Core Minimal APIs, you already know MinimalLambda.** +MinimalLambda brings the clean, declarative style of ASP.NET Core Minimal APIs to AWS Lambda while staying grounded in Lambda’s execution model. Use the same mental model (builder, DI, middleware, handler mapping) while leaning on Lambda-specific features like strongly-typed envelopes, lifecycle hooks, scoped invocations, and source generation. -MinimalLambda brings the clean, declarative coding style of ASP.NET Core Minimal APIs to AWS Lambda – for **any trigger type** (SQS, SNS, API Gateway, Kinesis, S3, EventBridge, and more): +- **Familiar builder flow**: `LambdaApplication.CreateBuilder()` β†’ `Build()` β†’ `RunAsync()` +- **.NET DI you already use**: `builder.Services.AddScoped()` with Lambda-safe lifetimes +- **Handler mapping, Lambda edition**: `lambda.MapHandler(...)` instead of crafting raw handlers +- **Middleware for cross-cutting concerns**: `lambda.UseMiddleware(...)` to wrap your pipeline +- **Lambda-first runtime**: Lifecycle hooks, cancellation token management, and strongly typed envelope models for event triggers -- **Same builder pattern**: `LambdaApplication.CreateBuilder()` β†’ `Build()` β†’ `RunAsync()` -- **Same dependency injection**: `builder.Services.AddScoped()` -- **Same handler mapping**: `lambda.MapHandler(...)` just like `app.MapGet(...)` -- **Same middleware pipeline**: `lambda.Use(...)` for cross-cutting concerns -- **Same foundation**: Built on `Microsoft.Extensions.Hosting` like ASP.NET Core - -Instead of writing boilerplate Lambda handlers, you get familiar .NET patterns with automatic dependency injection, proper scoped lifetimes, middleware support, and compile-time code generation for zero reflection overhead. +Instead of writing boilerplate Lambda handlers, you keep familiar .NET patterns while the framework handles event envelopes, dependency injection, scoped lifetimes, middleware, and compile-time code generation for zero reflection overhead. ## Key Features @@ -29,27 +27,11 @@ Instead of writing boilerplate Lambda handlers, you get familiar .NET patterns w - **Dependency Injection** – Constructor and parameter injection using `Microsoft.Extensions.DependencyInjection` with proper scoped lifetimes per invocation - **Middleware Pipeline** – Familiar `Use()` pattern for cross-cutting concerns like logging, validation, and error handling - **Source Generated** – Compile-time code generation for zero reflection overhead and optimal performance -- **AOT Ready** – Native AOT compilation support for sub-100ms cold starts +- **AOT Ready** – Native AOT compilation support for fast cold starts - **Built-in Observability** – OpenTelemetry integration for distributed tracing and metrics - **Type-Safe Envelopes** – Strongly-typed event wrappers for SQS, SNS, API Gateway, Kinesis, and more - **Minimal Runtime Overhead** – Lightweight abstraction layer built on the same foundation as ASP.NET Core -## From ASP.NET Core to Lambda - -If you're familiar with ASP.NET Core Minimal APIs, the transition to MinimalLambda is seamless: - -| ASP.NET Core Minimal API | MinimalLambda | -|---|---| -| `WebApplication.CreateBuilder()` | `LambdaApplication.CreateBuilder()` | -| `app.MapGet("/hello", ...)` | `lambda.MapHandler(...)` | -| `builder.Services.AddScoped()` | `builder.Services.AddScoped()` | -| `app.UseMiddleware()` | `lambda.UseMiddleware()` | -| `app.RunAsync()` | `lambda.RunAsync()` | -| `HttpContext` dependency injection | `ILambdaContext` dependency injection | -| Route parameters | `[Event]` attribute for event binding | - -The patterns are intentionally identical – if you know one, you know the other. - ## Packages The framework is divided into multiple NuGet packages: diff --git a/docs/index.md b/docs/index.md index 7ba2df56..1b00b035 100644 --- a/docs/index.md +++ b/docs/index.md @@ -2,16 +2,16 @@ title: "" --- -# MinimalLambda: ASP.NET Core Patterns for Lambda +# MinimalLambda: ASP.NET Core Patterns for AWS Lambda [![Main Build](https://github.com/j-d-ha/minimal-lambda/actions/workflows/main-build.yaml/badge.svg)](https://github.com/j-d-ha/minimal-lambda/actions/workflows/main-build.yaml) [![codecov](https://codecov.io/gh/j-d-ha/minimal-lambda/graph/badge.svg?token=BWORPTQ0UK)](https://codecov.io/gh/j-d-ha/minimal-lambda) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=j-d-ha_minimal-lambda&metric=alert_status&token=9fb519975d91379dcfbc6c13a4bd4207131af6e3)](https://sonarcloud.io/summary/new_code?id=j-d-ha_minimal-lambda) [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/j-d-ha/minimal-lambda/blob/main/LICENSE) -**If you know ASP.NET Core Minimal APIs, you already know MinimalLambda.** +**Minimal API-inspired, Lambda-first hosting.** -MinimalLambda brings the clean, declarative coding style of ASP.NET Core Minimal APIs to AWS Lambda – for **any event source** (SQS, SNS, API Gateway, Kinesis, S3, EventBridge, etc.). Use the same builder pattern, dependency injection, middleware pipeline, and handler mapping that you're familiar with from ASP.NET Core – but optimized for Lambda's execution model with source generation, proper scoped lifetimes, and automatic cancellation token handling. +MinimalLambda keeps the builder, DI, middleware, and handler mapping patterns you know and love from ASP.NET Core, but is designed for **any Lambda event source** (SQS, SNS, API Gateway, Kinesis, S3, EventBridge, etc.). The framework adds envelopes, lifecycle hooks, source generation, scoped invocations, and cancellation-token handling so you get familiar ergonomics without treating Lambda like a web server. [Get Started](getting-started/index.md){ .md-button .md-button--primary } [Guides](guides/index.md){ .md-button } diff --git a/src/MinimalLambda/README.md b/src/MinimalLambda/README.md index 2e36bec7..bd4a557e 100644 --- a/src/MinimalLambda/README.md +++ b/src/MinimalLambda/README.md @@ -1,14 +1,12 @@ # MinimalLambda -**ASP.NET Core Minimal API-style patterns for AWS Lambda** – Build Lambda functions for any trigger using familiar .NET patterns. +**Minimal API-style ergonomics, Lambda-first runtime** – Build Lambda functions for any trigger using familiar .NET patterns without sacrificing Lambda-specific capabilities. > πŸ“š **[View Full Documentation](https://j-d-ha.github.io/minimal-lambda/)** ## Overview -**If you know ASP.NET Core Minimal APIs, you already know MinimalLambda.** - -Write Lambda functions with the familiar minimal API pattern from ASP.NET Core: +Write Lambda functions with the familiar minimal API pattern from ASP.NET Core, adapted for Lambda's execution model: ```csharp var builder = LambdaApplication.CreateBuilder(); @@ -23,12 +21,12 @@ await lambda.RunAsync(); The framework provides: -- **Minimal API Pattern**: `lambda.MapHandler(...)` just like `app.MapGet()` – clean and declarative -- **Dependency Injection**: Same DI container as ASP.NET Core with proper scoped lifetimes per invocation +- **Minimal API Pattern**: `lambda.MapHandler(...)` in the same declarative style as `app.MapGet()` +- **Dependency Injection**: The ASP.NET Core container with scoped lifetimes tailored to Lambda invocations - **Middleware Pipeline**: Familiar `Use()` pattern for cross-cutting concerns - **Source Generated**: Compile-time code generation for zero reflection overhead - **Native AOT Ready**: Full AOT support for sub-100ms cold starts -- **Lambda-Optimized**: Automatic cancellation tokens, timeout handling, and efficient resource use +- **Lambda-Optimized**: Envelopes, lifecycle hooks, automatic cancellation tokens, and timeout handling ## Installation From 4b65db8e8143288e4a91e59f1d0f388617d237cb Mon Sep 17 00:00:00 2001 From: Jonas Ha Date: Thu, 11 Dec 2025 14:29:09 -0500 Subject: [PATCH 2/2] feat(docs): improve description of Lambda-first design in MinimalLambda - Refined wording to clearly emphasize the framework's type-safe and scoped invocation capabilities. - Enhanced messaging around predictable timeouts and smoother developer experience. - Added details on Lambda's execution model alignment for better clarity. --- docs/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/index.md b/docs/index.md index 1b00b035..69aedfed 100644 --- a/docs/index.md +++ b/docs/index.md @@ -11,7 +11,7 @@ title: "" **Minimal API-inspired, Lambda-first hosting.** -MinimalLambda keeps the builder, DI, middleware, and handler mapping patterns you know and love from ASP.NET Core, but is designed for **any Lambda event source** (SQS, SNS, API Gateway, Kinesis, S3, EventBridge, etc.). The framework adds envelopes, lifecycle hooks, source generation, scoped invocations, and cancellation-token handling so you get familiar ergonomics without treating Lambda like a web server. +MinimalLambda keeps the builder, DI, middleware, and handler mapping patterns you know from ASP.NET Core, but is built from the ground up for **any Lambda event source** (SQS, SNS, API Gateway, Kinesis, S3, EventBridge, etc.). Strongly-typed envelopes, lifecycle hooks, scoped invocations, source generation, and cancellation-token handling shape those familiar patterns to Lambda’s execution modelβ€”so you get type-safe events, per-invocation scopes, predictable timeouts, and a smoother developer experience when iterating locally or in CI. [Get Started](getting-started/index.md){ .md-button .md-button--primary } [Guides](guides/index.md){ .md-button }