LazyMagic MDD: A code generation framework that transforms OpenAPI specifications and YAML configuration into complete AWS serverless applications with .NET Lambda functions, DynamoDB repositories, API Gateway configurations, and client SDKs automatically. Available as both a CLI tool (LazyMagicCLI
) and Visual Studio IDE extension for integrated development.
LazyMagic MDD is a powerful code generation framework that transforms OpenAPI specifications and YAML configuration into complete AWS serverless applications with .NET implementations. It follows a model-driven development approach where your API specifications drive the generation of schemas, controllers, Lambda functions, AWS infrastructure, and client SDKs.
LazyMagic MDD generates complete serverless applications from:
The framework produces ready-to-deploy AWS serverless applications with:
A .NET global tool that processes your configuration and generates projects.
Usage: In your solution folder:
# Generate projects from current directory
LazyMagicCLI
The core library containing:
Visual Studio extension providing integrated project generation within the IDE.
Directives are YAML configuration objects that specify what to generate. They follow a processing order:
Generated outputs including:
The main configuration file defining all directives:
LazyMagicDirectivesVersion: 2.0.0
Directives:
# Default configurations
SchemaDefault:
Type: Schema
IsDefault: true
Artifacts:
DotNetSchemaProject: # DTOs
DotNetRepoProject: # DynamoDB repositories
# Specific implementations
ConsumerSchema:
Type: Schema
Defaults: SchemaDefault
OpenApiSpecs:
- openapi.consumer-schema.yaml
ConsumerModule:
Type: Module
Defaults: ModuleDefault
OpenApiSpecs:
- openapi.consumer.yaml
ConsumerLambda:
Type: Container
Defaults: AwsApiLambdaContainerDefault
Modules:
- ConsumerModule
Generate data models and repositories:
UserSchema:
Type: Schema
Defaults: SchemaDefault
OpenApiSpecs:
- openapi.user-schema.yaml
Generate API controllers:
UserModule:
Type: Module
Defaults: ModuleDefault
OpenApiSpecs:
- openapi.user.yaml
Generate Lambda functions:
UserLambda:
Type: Container
Defaults: AwsApiLambdaContainerDefault
Modules:
- UserModule
Generate API Gateway configurations:
UserApi:
Type: Api
Defaults: ApiDefault
Authentication: JwtAuth
Containers:
- UserLambda
Generate Cognito user pools:
JwtAuth:
Type: Authentication
Artifacts:
AwsCognitoResource:
Template: AWSTemplates/Snippets/sam.service.cognito.jwt.managed.yaml
Generate service-level AWS templates:
Service:
Type: Service
Apis:
- UserApi
- AdminApi
Artifacts:
AwsServiceStackTemplate:
# Build entire solution
dotnet build LazyMagicMDD.sln
# Build specific projects
dotnet build LazyMagicGenerator --configuration Release
dotnet build LazyMagicCLI --configuration Release
# Run tests
dotnet test LazyMagicGenerator.Test
# Run specific test
dotnet test LazyMagicGenerator.Test --filter "FullyQualifiedName~GenerateOperationIdTests"
# Package CLI tool
dotnet pack LazyMagicCLI -c Release
# Install CLI tool locally
dotnet tool install --global --add-source ./Packages LazyMagicCLI
A typical e-commerce application might be structured as:
CustomerSchema:
Type: Schema
Defaults: SchemaDefault
OpenApiSpecs:
- openapi.customer-schema.yaml
ProductSchema:
Type: Schema
Defaults: SchemaDefault
OpenApiSpecs:
- openapi.product-schema.yaml
CustomerModule:
Type: Module
Defaults: ModuleDefault
OpenApiSpecs:
- openapi.customer.yaml
ProductModule:
Type: Module
Defaults: ModuleDefault
OpenApiSpecs:
- openapi.product.yaml
CustomerLambda:
Type: Container
Defaults: AwsApiLambdaContainerDefault
Modules:
- CustomerModule
ProductLambda:
Type: Container
Defaults: AwsApiLambdaContainerDefault
Modules:
- ProductModule
CustomerApi:
Type: Api
Defaults: ApiDefault
Authentication: CustomerAuth
Containers:
- CustomerLambda
ProductApi:
Type: Api
Defaults: ApiDefault
Containers:
- ProductLambda
ECommerceService:
Type: Service
Apis:
- CustomerApi
- ProductApi
Artifacts:
AwsServiceStackTemplate:
This configuration generates:
Directives can inherit from default configurations using the Defaults
property, enabling consistent patterns across your application while allowing customization where needed.
The framework automatically resolves dependencies between schemas and ensures proper generation order using topological sorting.
Built-in support for multi-tenant applications with tenant-specific deployments and configurations.
All generated code uses customizable templates, allowing you to adapt the output to your specific requirements.
Version is centrally managed in Version.props
. The GitHub Actions workflow automatically publishes NuGet packages and creates git tags when pushing to the main branch.
LazyMagic MDD transforms the traditional approach to serverless development by generating consistent, maintainable, and scalable applications from declarative specifications, significantly reducing boilerplate code and development time while ensuring architectural consistency.