# jarodsim/event-driven-platform architecture

> Architecture diagram of the GitHub repository jarodsim/event-driven-platform, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jarodsim/event-driven-platform
- Repository: https://github.com/jarodsim/event-driven-platform

## Overview

##### Project type and purpose
- This is a serverless, event-driven, distributed order-processing platform on AWS, orchestrated and versioned with Terraform.
- Its purpose is to receive HTTP requests, publish them as events on an EventBridge bus, and fan-out those events to multiple independent Lambda consumers (validation, invoicing, notification), each with its own SQS dead-letter queue.

##### File structure
- Top-level “infra/” folder: all Terraform code.
- infra/modules: reusable modules for AWS API Gateway, Lambda, EventBridge, SQS, IAM roles/policies.
- infra/services: four service definitions (create_order, validate_order, invoice_order, notificate_order), each provisioning its own Lambda, EventBridge rule, and DLQ.
- infra/envs/dev: environment-specific tfvars.
- .github/workflows: CI/CD pipelines for Terraform.
- “lambdas/”: service code directory with one subfolder per Lambda.
- readme.md: describes event-driven architecture, flowchart, components, and AWS stack.

##### Key takeaways from the README
- Core flow: API Gateway → Entry Lambda → EventBridge bus → three processing Lambdas → SQS DLQs for failures
- Tech: AWS API Gateway, Lambda, EventBridge, SQS DLQs, CloudWatch, IAM, Terraform, Python

## Diagram (Mermaid)

```mermaid
graph TB
    %% Entry Path
    subgraph "Entry Path"
        APIG["AWS API Gateway"]:::api
        click APIG "https://github.com/jarodsim/event-driven-platform/blob/develop/infra/services/create_order/api_gateway_endpoint.tf"
        CreateLambda["CreateOrder Lambda\n(Python)"]:::lambda
        click CreateLambda "https://github.com/jarodsim/event-driven-platform/blob/develop/lambdas/CreateOrder/lambda_function.py"
        APIG -->|"Invoke"| CreateLambda
    end

    %% Event Bus and Rules
    CreateLambda -->|"PutEvents"| EventBus
    subgraph "EventBridge"
        EventBus["OrderEventBus\n(EventBridge)"]:::event
        click EventBus "https://github.com/jarodsim/event-driven-platform/blob/develop/infra/modules/aws_event_bridge/event_bus/main.tf"
        click EventBus "https://github.com/jarodsim/event-driven-platform/blob/develop/infra/modules/aws_event_bridge/event_bus/variables.tf"
        click EventBus "https://github.com/jarodsim/event-driven-platform/blob/develop/infra/modules/aws_event_bridge/event_bus/outputs.tf"
        subgraph "Event Rules"
            VR["ValidateOrder Rule"]:::event
            click VR "https://github.com/jarodsim/event-driven-platform/blob/develop/infra/services/validate_order/event_rule.tf"
            IR["InvoiceOrder Rule"]:::event
            click IR "https://github.com/jarodsim/event-driven-platform/blob/develop/infra/services/invoice_order/event_rule.tf"
            NR["NotificateOrder Rule"]:::event
            click NR "https://github.com/jarodsim/event-driven-platform/blob/develop/infra/services/notificate_order/event_rule.tf"
            EventBus --> VR
            EventBus --> IR
            EventBus --> NR
        end
    end

    %% Consumers and DLQs
    subgraph "Consumers"
        VR --> VLambda["ValidateOrder Lambda"]:::lambda
        click VLambda "https://github.com/jarodsim/event-driven-platform/blob/develop/lambdas/ValidateOrder/lambda_function.py"
        IR --> ILambda["InvoiceOrder Lambda"]:::lambda
        click ILambda "https://github.com/jarodsim/event-driven-platform/blob/develop/lambdas/InvoiceOrder/lambda_function.py"
        NR --> NLambda["NotificateOrder Lambda"]:::lambda
        click NLambda "https://github.com/jarodsim/event-driven-platform/blob/develop/lambdas/NotificateOrder/lambda_function.py"

        VLambda -->|"Failure"| VDQL["Validate DLQ"]:::sqs
        click VDQL "https://github.com/jarodsim/event-driven-platform/blob/develop/infra/services/validate_order/sqs_dlq.tf"
        click VDQL "https://github.com/jarodsim/event-driven-platform/blob/develop/infra/services/validate_order/sqs_dlq_policy.tf"

        ILambda -->|"Failure"| IDQL["Invoice DLQ"]:::sqs
        click IDQL "https://github.com/jarodsim/event-driven-platform/blob/develop/infra/services/invoice_order/sqs_dlq.tf"
        click IDQL "https://github.com/jarodsim/event-driven-platform/blob/develop/infra/services/invoice_order/sqs_dlq_policy.tf"

        NLambda -->|"Failure"| NDQL["Notificate DLQ"]:::sqs
        click NDQL "https://github.com/jarodsim/event-driven-platform/blob/develop/infra/services/notificate_order/sqs_dlq.tf"
        click NDQL "https://github.com/jarodsim/event-driven-platform/blob/develop/infra/services/notificate_order/sqs_dlq_policy.tf"
    end

    %% Observability
    subgraph "Observability"
        CW["CloudWatch\nLogs & Metrics"]:::cloudwatch
        CreateLambda --> CW
        VLambda --> CW
        ILambda --> CW
        NLambda --> CW
    end

    %% Infrastructure as Code
    subgraph "Infrastructure as Code (Terraform Modules)"
        IAMmod["IAM Role Module"]:::infra
        click IAMmod "https://github.com/jarodsim/event-driven-platform/blob/develop/infra/modules/aws_iam_role/main.tf"
        click IAMmod "https://github.com/jarodsim/event-driven-platform/blob/develop/infra/modules/aws_iam_role/variables.tf"
        click IAMmod "https://github.com/jarodsim/event-driven-platform/blob/develop/infra/modules/aws_iam_role/outputs.tf"

        APImod["API Gateway Module"]:::infra
        click APImod "https://github.com/jarodsim/event-driven-platform/tree/develop/infra/modules/shared/aws_api_gateway"
        click APImod "https://github.com/jarodsim/event-driven-platform/tree/develop/infra/modules/shared/aws_api_gateway_deployment"
        click APImod "https://github.com/jarodsim/event-driven-platform/tree/develop/infra/modules/shared/aws_api_gateway_lambda_integration"

        LambdaMod["Lambda Module"]:::infra
        click LambdaMod "https://github.com/jarodsim/event-driven-platform/tree/develop/infra/modules/shared/aws_basic_lambda_iam_role"

        EventBusMod["EventBridge EventBus Module"]:::infra
        click EventBusMod "https://github.com/jarodsim/event-driven-platform/blob/develop/infra/modules/aws_event_bridge/event_bus/main.tf"

        EventRuleMod["EventBridge Rule Module"]:::infra
        click EventRuleMod "https://github.com/jarodsim/event-driven-platform/blob/develop/infra/modules/aws_event_bridge/event_rule/main.tf"
        click EventRuleMod "https://github.com/jarodsim/event-driven-platform/blob/develop/infra/modules/aws_event_bridge/event_rule/variables.tf"
        click EventRuleMod "https://github.com/jarodsim/event-driven-platform/blob/develop/infra/modules/aws_event_bridge/event_rule/outputs.tf"

        SQSmod["SQS Module"]:::infra
    end

    %% CI/CD Pipelines
    subgraph "CI/CD Pipelines"
        Develop["develop.yml"]:::infra
        click Develop "https://github.com/jarodsim/event-driven-platform/blob/develop/.github/workflows/develop.yml"
        Mainwf["main.yml"]:::infra
        click Mainwf "https://github.com/jarodsim/event-driven-platform/blob/develop/.github/workflows/main.yml"
        TFwf["terraform.yml"]:::infra
        click TFwf "https://github.com/jarodsim/event-driven-platform/blob/develop/.github/workflows/terraform.yml"
    end

    %% Styles
    classDef api fill:#33a532,stroke:#000,color:#fff
    classDef lambda fill:#f89e1b,stroke:#000,color:#fff
    classDef event fill:#4a80ff,stroke:#000,color:#fff
    classDef sqs fill:#00bfa5,stroke:#000,color:#fff
    classDef cloudwatch fill:#61427e,stroke:#000,color:#fff
    classDef infra fill:#cccccc,stroke:#000,color:#000
```
