AlexaVoxCraft.MediatR
3.0.0.63
dotnet add package AlexaVoxCraft.MediatR --version 3.0.0.63
NuGet\Install-Package AlexaVoxCraft.MediatR -Version 3.0.0.63
<PackageReference Include="AlexaVoxCraft.MediatR" Version="3.0.0.63" />
<PackageVersion Include="AlexaVoxCraft.MediatR" Version="3.0.0.63" />
<PackageReference Include="AlexaVoxCraft.MediatR" />
paket add AlexaVoxCraft.MediatR --version 3.0.0.63
#r "nuget: AlexaVoxCraft.MediatR, 3.0.0.63"
#:package AlexaVoxCraft.MediatR@3.0.0.63
#addin nuget:?package=AlexaVoxCraft.MediatR&version=3.0.0.63
#tool nuget:?package=AlexaVoxCraft.MediatR&version=3.0.0.63
๐ฃ AlexaVoxCraft
AlexaVoxCraft is a modular C# .NET library for building Amazon Alexa skills using modern .NET practices. It provides comprehensive support for Alexa skill development with CQRS patterns, visual interfaces, and AWS Lambda hosting.
Key Features
- ๐ฏ MediatR Integration: CQRS-style request handling with pipeline behaviors and auto-discovery
- ๐จ APL Support: Complete Alexa Presentation Language implementation for rich visual interfaces
- โก Lambda Hosting: Optimized AWS Lambda runtime with custom serialization and ReadyToRun publishing
- ๐ Session Management: Robust session attribute handling and game state persistence
- ๐ง Pipeline Behaviors: Request/response interceptors for cross-cutting concerns like logging and validation
- ๐งช Testing Support: Comprehensive testing utilities with AutoFixture integration and property-based testing
๐ฆ Packages
Package | NuGet | Downloads |
---|---|---|
AlexaVoxCraft.Model | ||
AlexaVoxCraft.Model.Apl | ||
AlexaVoxCraft.MediatR.Lambda | ||
AlexaVoxCraft.MediatR |
๐ Quick Start
Install Core Packages
# Core MediatR integration and Lambda hosting
dotnet add package AlexaVoxCraft.MediatR.Lambda
# APL visual interface support (optional)
dotnet add package AlexaVoxCraft.Model.Apl
# CloudWatch-compatible JSON logging (optional)
dotnet add package LayeredCraft.Logging.CompactJsonFormatter
Create a Basic Skill
// Program.cs
using AlexaVoxCraft.MediatR.Lambda;
using AlexaVoxCraft.Model.Response;
return await LambdaHostExtensions.RunAlexaSkill<MySkillFunction, SkillRequest, SkillResponse>();
// Function.cs
public class MySkillFunction : AlexaSkillFunction<SkillRequest, SkillResponse>
{
protected override void Init(IHostBuilder builder)
{
builder
.UseHandler<LambdaHandler, SkillRequest, SkillResponse>()
.ConfigureServices((context, services) =>
{
services.AddSkillMediator(context.Configuration, cfg =>
cfg.RegisterServicesFromAssemblyContaining<MySkillFunction>());
});
}
}
// Handler.cs
public class LaunchRequestHandler : IRequestHandler<LaunchRequest>
{
public bool CanHandle(IHandlerInput handlerInput) =>
handlerInput.RequestEnvelope.Request is LaunchRequest;
public async Task<SkillResponse> Handle(IHandlerInput input, CancellationToken cancellationToken)
{
return await input.ResponseBuilder
.Speak("Welcome to my skill!")
.Reprompt("What would you like to do?")
.GetResponse(cancellationToken);
}
}
๐ Documentation
๐ Complete Documentation - Comprehensive guides and examples
Core Components
- Request Handling - MediatR integration and handler patterns
- APL Integration - Rich visual interface development
- Lambda Hosting - AWS Lambda deployment and optimization
- Session Management - State persistence and user data
- Pipeline Behaviors - Cross-cutting concerns and interceptors
Examples
- Complete Examples - Production-ready trivia skill implementation
๐ Project Structure
AlexaVoxCraft/
โโโ ๐ src/ # Core library packages
โ โโโ ๐ฆ AlexaVoxCraft.Model/ # Base Alexa skill models & serialization
โ โโโ ๐ฆ AlexaVoxCraft.Model.Apl/ # APL (Alexa Presentation Language) support
โ โโโ ๐ฆ AlexaVoxCraft.MediatR/ # MediatR integration & request handling
โ โโโ ๐ฆ AlexaVoxCraft.MediatR.Lambda/ # AWS Lambda hosting & runtime
โ
โโโ ๐ samples/ # Working example projects
โ โโโ ๐ฑ Sample.Skill.Function/ # Basic Alexa skill demonstration
โ โโโ ๐ฑ Sample.Apl.Function/ # APL skill with visual interfaces
โ
โโโ ๐ test/ # Comprehensive test coverage
โ โโโ ๐งช AlexaVoxCraft.Model.Tests/ # Core model & serialization tests
โ โโโ ๐งช AlexaVoxCraft.Model.Apl.Tests/ # APL functionality tests
โ โโโ ๐งช AlexaVoxCraft.MediatR.Tests/ # MediatR integration tests
โ โโโ ๐งช AlexaVoxCraft.MediatR.Lambda.Tests/ # Lambda hosting tests
โ
โโโ ๐ AlexaVoxCraft.TestKit/ # Testing utilities & AutoFixture support
โโโ ๐ docs/ # Documentation source
โโโ ๐ samples/ # Example implementations
๐ Core Concepts
Request Handling Pattern
Skills use the MediatR pattern where:
- Requests implement
IRequestHandler<T>
- Handlers optionally implement
ICanHandle
for routing logic - Pipeline behaviors handle cross-cutting concerns (logging, exceptions)
- Lambda functions derive from
AlexaSkillFunction<TRequest, TResponse>
Package Breakdown
Package | Purpose | Key Features |
---|---|---|
AlexaVoxCraft.Model | Core Alexa models | Request/response types, SSML, cards, directives, System.Text.Json serialization |
AlexaVoxCraft.Model.Apl | APL support | 40+ components, commands, audio, vector graphics, extensions (DataStore, SmartMotion) |
AlexaVoxCraft.MediatR | Request handling | Handler routing, pipeline behaviors, attributes management, DI integration |
AlexaVoxCraft.MediatR.Lambda | Lambda hosting | AWS Lambda functions, context management, custom serialization, hosting extensions |
๐งช Testing
AlexaVoxCraft includes comprehensive testing support:
- xUnit v3 with Microsoft.Testing.Platform
- AutoFixture integration for property-based testing
- AwesomeAssertions for fluent assertions
- TestKit with specimen builders and test utilities
โ ๏ธ Error Handling
Implement the IExceptionHandler
interface for centralized error handling:
public class GlobalExceptionHandler : IExceptionHandler
{
public Task<bool> CanHandle(IHandlerInput handlerInput, Exception ex, CancellationToken cancellationToken)
{
return Task.FromResult(true); // Handle all exceptions
}
public Task<SkillResponse> Handle(IHandlerInput handlerInput, Exception ex, CancellationToken cancellationToken)
{
return handlerInput.ResponseBuilder
.Speak("Sorry, something went wrong. Please try again.")
.GetResponse(cancellationToken);
}
}
๐ค Contributing
PRs are welcome! Please submit issues and ideas to help make this toolkit even better.
๐ Credits & Attribution
๐ฆ Credits:
- Core Alexa skill models (
AlexaVoxCraft.Model
) based on timheuer/alexa-skills-dotnet- APL support (
AlexaVoxCraft.Model.Apl
) based on stoiveyp/Alexa.NET.APL
๐ License
This project is licensed under the MIT License.
Stargazers over time
Product | Versions 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 is compatible. 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. |
-
net8.0
- AlexaVoxCraft.Model (>= 3.0.0.63)
- LayeredCraft.StructuredLogging (>= 1.1.0.7)
- Microsoft.Extensions.Configuration.Binder (>= 9.0.7)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.7)
- Microsoft.Extensions.Options (>= 9.0.7)
-
net9.0
- AlexaVoxCraft.Model (>= 3.0.0.63)
- LayeredCraft.StructuredLogging (>= 1.1.0.7)
- Microsoft.Extensions.Configuration.Binder (>= 9.0.7)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.7)
- Microsoft.Extensions.Options (>= 9.0.7)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on AlexaVoxCraft.MediatR:
Package | Downloads |
---|---|
AlexaVoxCraft.MediatR.Lambda
Lambda hosting and middleware integration for Alexa skills using MediatR and AlexaVoxCraft. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated |
---|---|---|
3.0.0.63 | 141 | 7/15/2025 |
2.0.1.62 | 153 | 7/11/2025 |
2.0.0.61 | 156 | 7/2/2025 |
2.0.0.59 | 152 | 7/1/2025 |
2.0.0.58 | 145 | 7/1/2025 |
2.0.0-beta.57 | 121 | 6/30/2025 |
2.0.0-beta.56 | 117 | 6/23/2025 |
2.0.0-beta.55 | 115 | 6/23/2025 |
1.0.1.54 | 253 | 5/21/2025 |
1.0.1.53 | 163 | 5/19/2025 |
1.0.1.50 | 261 | 5/13/2025 |
1.0.1.49 | 238 | 5/13/2025 |
1.0.1-beta.52 | 127 | 5/19/2025 |
1.0.1-beta.48 | 207 | 5/13/2025 |
1.0.1-beta.47 | 213 | 5/13/2025 |
1.0.1-beta.46 | 215 | 5/13/2025 |
1.0.1-beta.45 | 208 | 5/13/2025 |
1.0.1-beta.44 | 207 | 5/13/2025 |
1.0.0.43 | 159 | 5/8/2025 |
1.0.0.42 | 155 | 5/7/2025 |
1.0.0.41 | 272 | 4/21/2025 |
1.0.0-beta.40 | 139 | 4/21/2025 |
0.3.0-beta-38 | 224 | 4/17/2025 |
0.3.0-beta-37 | 199 | 4/17/2025 |
0.3.0-beta-36 | 202 | 4/17/2025 |
0.3.0-beta-35 | 213 | 4/15/2025 |
0.3.0-beta-34 | 223 | 4/9/2025 |
0.3.0-beta-31 | 183 | 4/9/2025 |
0.3.0-beta-30 | 172 | 4/9/2025 |
0.3.0-beta-29 | 181 | 4/9/2025 |
0.2.0-alpha-28 | 184 | 4/9/2025 |
0.2.0-alpha-27 | 192 | 4/7/2025 |
0.2.0-alpha-26 | 182 | 4/3/2025 |
0.1.0-alpha-24 | 176 | 3/30/2025 |
0.1.0-alpha-23 | 164 | 1/28/2025 |
0.1.0-alpha-22 | 125 | 1/28/2025 |
0.1.0-alpha-21 | 107 | 12/19/2024 |