Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 9 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,51 +5,33 @@
[![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<IMyService, MyService>()` 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<IMyService, MyService>()`
- **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

- **Minimal API Pattern** – Map handlers with `lambda.MapHandler(...)` just like `app.MapGet()` in ASP.NET Core – clean, declarative, and intuitive
- **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<T>()` | `builder.Services.AddScoped<T>()` |
| `app.UseMiddleware<T>()` | `lambda.UseMiddleware<T>()` |
| `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:
Expand Down
6 changes: 3 additions & 3 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 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 }
Expand Down
12 changes: 5 additions & 7 deletions src/MinimalLambda/README.md
Original file line number Diff line number Diff line change
@@ -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();
Expand All @@ -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

Expand Down
Loading