{
  "name": "E-Commerce Platform",
  "description": "Complete serverless e-commerce application with authentication, API, and event processing",
  "application": "com.example.shop",
  "provider": "aws",
  "variables": {
    "stage": "production",
    "version": "2.0.0"
  },
  "regions": [
    {
      "region": "global",
      "items": [
        {
          "type": "authentication",
          "name": "user-auth",
          "providerSettings": {
            "loginProviders": ["email", "google"],
            "registration": "open",
            "mfa": "optional",
            "passwordPolicy": {
              "minLength": 10,
              "requireUppercase": true,
              "requireNumbers": true,
              "requireSymbols": true
            },
            "groups": [
              {
                "name": "admin",
                "description": "Platform administrators with full access"
              },
              {
                "name": "seller",
                "description": "Sellers who can manage their products"
              },
              {
                "name": "customer",
                "description": "Regular customers who can place orders"
              }
            ],
            "users": [
              {
                "email": "admin@shop.example.com",
                "groups": ["admin"]
              },
              {
                "email": "seller@shop.example.com",
                "groups": ["seller", "customer"]
              }
            ]
          },
          "links": [
            {
              "sourceComponent": "user-auth",
              "targetComponent": "transactional-email",
              "linkType": "AUTHENTICATION_TO_EMAIL"
            },
            {
              "sourceComponent": "user-auth",
              "targetComponent": "notification-sms",
              "linkType": "AUTHENTICATION_TO_SMS"
            }
          ]
        },
        {
          "type": "email",
          "name": "transactional-email",
          "providerSettings": {
            "fromAddress": "noreply@shop.example.com"
          },
          "links": []
        },
        {
          "type": "sms",
          "name": "notification-sms",
          "providerSettings": {},
          "links": []
        }
      ]
    },
    {
      "region": "us-east-1",
      "items": [
        {
          "type": "storage",
          "name": "deploy-artifacts",
          "providerSettings": {
            "uploads": [
              {
                "artifact": "com.example.shop:api-functions:${version}",
                "destination": "releases/api-functions/",
                "unpack": true
              },
              {
                "artifact": "com.example.shop:event-processors:${version}",
                "destination": "releases/event-processors/",
                "unpack": true
              },
              {
                "artifact": "com.example.shop:frontend:${version}",
                "classifier": "dist",
                "destination": "releases/frontend/",
                "unpack": true
              }
            ]
          },
          "links": []
        },
        {
          "type": "storage",
          "name": "product-images",
          "providerSettings": {},
          "links": []
        },
        {
          "type": "database",
          "name": "shop-db",
          "providerSettings": {
            "billingMode": "PAY_PER_REQUEST"
          },
          "links": []
        },
        {
          "type": "event-bus",
          "name": "order-events",
          "providerSettings": {
            "subscriptions": [
              {
                "eventPattern": "order.created",
                "function": "order-processor"
              },
              {
                "eventPattern": "order.completed",
                "function": "notification-processor"
              },
              {
                "eventPattern": "order.cancelled",
                "function": "refund-processor"
              }
            ]
          },
          "links": []
        },
        {
          "type": "functions",
          "name": "api-functions",
          "providerSettings": {
            "codeStorage": "deploy-artifacts",
            "codePath": "releases/api-functions/api-functions-${version}.jar",
            "functions": [
              {
                "name": "product-handler",
                "handler": "com.example.shop.ProductHandler::handleRequest",
                "runtime": "java21",
                "memory": 512,
                "timeout": 30,
                "environment": {
                  "STAGE": "${stage}",
                  "LOG_LEVEL": "INFO"
                }
              },
              {
                "name": "order-handler",
                "handler": "com.example.shop.OrderHandler::handleRequest",
                "runtime": "java21",
                "memory": 1024,
                "timeout": 60,
                "environment": {
                  "STAGE": "${stage}",
                  "LOG_LEVEL": "INFO"
                }
              },
              {
                "name": "payment-handler",
                "handler": "com.example.shop.PaymentHandler::handleRequest",
                "runtime": "java21",
                "memory": 512,
                "timeout": 30,
                "environment": {
                  "STAGE": "${stage}",
                  "LOG_LEVEL": "INFO"
                }
              },
              {
                "name": "request-validator",
                "handler": "com.example.shop.RequestValidator::handleRequest",
                "runtime": "java21",
                "memory": 256,
                "timeout": 10
              },
              {
                "name": "audit-logger",
                "handler": "com.example.shop.AuditLogger::handleRequest",
                "runtime": "java21",
                "memory": 256,
                "timeout": 10
              },
              {
                "name": "health-check",
                "handler": "com.example.shop.HealthCheck::handleRequest",
                "runtime": "java21",
                "memory": 128,
                "timeout": 5
              }
            ]
          },
          "links": [
            {
              "sourceComponent": "api-functions",
              "targetComponent": "shop-db",
              "linkType": "FUNCTION_TO_DATABASE"
            },
            {
              "sourceComponent": "api-functions",
              "targetComponent": "product-images",
              "linkType": "FUNCTION_TO_STORAGE"
            },
            {
              "sourceComponent": "api-functions",
              "targetComponent": "transactional-email",
              "linkType": "FUNCTION_TO_EMAIL"
            },
            {
              "sourceComponent": "api-functions",
              "targetComponent": "order-events",
              "linkType": "FUNCTION_TO_EVENT_BUS"
            }
          ]
        },
        {
          "type": "functions",
          "name": "event-processors",
          "providerSettings": {
            "codeStorage": "deploy-artifacts",
            "codePath": "releases/event-processors/event-processors-${version}.jar",
            "functions": [
              {
                "name": "order-processor",
                "handler": "com.example.shop.OrderProcessor::handleRequest",
                "runtime": "java21",
                "memory": 512,
                "timeout": 60
              },
              {
                "name": "notification-processor",
                "handler": "com.example.shop.NotificationProcessor::handleRequest",
                "runtime": "java21",
                "memory": 256,
                "timeout": 30
              },
              {
                "name": "refund-processor",
                "handler": "com.example.shop.RefundProcessor::handleRequest",
                "runtime": "java21",
                "memory": 512,
                "timeout": 60
              }
            ]
          },
          "links": [
            {
              "sourceComponent": "event-processors",
              "targetComponent": "shop-db",
              "linkType": "FUNCTION_TO_DATABASE"
            },
            {
              "sourceComponent": "event-processors",
              "targetComponent": "transactional-email",
              "linkType": "FUNCTION_TO_EMAIL"
            },
            {
              "sourceComponent": "event-processors",
              "targetComponent": "notification-sms",
              "linkType": "FUNCTION_TO_SMS"
            }
          ]
        },
        {
          "type": "api-gateway",
          "name": "shop-api",
          "providerSettings": {
            "domain": "api.shop.example.com",
            "preProcessFunction": "request-validator",
            "postProcessFunction": "audit-logger",
            "routes": [
              {
                "path": "/products",
                "method": "GET",
                "function": "product-handler"
              },
              {
                "path": "/products",
                "method": "POST",
                "function": "product-handler",
                "auth": "user-auth"
              },
              {
                "path": "/products/{id}",
                "method": "GET",
                "function": "product-handler"
              },
              {
                "path": "/products/{id}",
                "method": "PUT",
                "function": "product-handler",
                "auth": "user-auth"
              },
              {
                "path": "/products/{id}",
                "method": "DELETE",
                "function": "product-handler",
                "auth": "user-auth"
              },
              {
                "path": "/orders",
                "method": "GET",
                "function": "order-handler",
                "auth": "user-auth"
              },
              {
                "path": "/orders",
                "method": "POST",
                "function": "order-handler",
                "auth": "user-auth"
              },
              {
                "path": "/orders/{id}",
                "method": "GET",
                "function": "order-handler",
                "auth": "user-auth"
              },
              {
                "path": "/payments",
                "method": "POST",
                "function": "payment-handler",
                "auth": "user-auth"
              },
              {
                "path": "/health",
                "method": "GET",
                "function": "health-check",
                "preProcessFunction": "",
                "postProcessFunction": ""
              }
            ]
          },
          "links": []
        },
        {
          "type": "website",
          "name": "shop-frontend",
          "providerSettings": {
            "domain": "www.shop.example.com"
          },
          "links": [
            {
              "sourceComponent": "shop-frontend",
              "targetComponent": "shop-api",
              "linkType": "WEBSITE_TO_API_GATEWAY"
            },
            {
              "sourceComponent": "shop-frontend",
              "targetComponent": "product-images",
              "linkType": "WEBSITE_TO_STORAGE"
            }
          ]
        }
      ]
    }
  ]
}
