# littlemex/aws-samples architecture

> Architecture diagram of the GitHub repository littlemex/aws-samples, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/littlemex/aws-samples
- Repository: https://github.com/littlemex/aws-samples

## Overview

- AWS Amplify & Frontend Apps:
– Represent the “amplify/next-amplified” project as a Next.js frontend application that uses AWS Amplify. Show components such as the Next.js pages, API routes (found in pages/api), and the associated Amplify backend configurations.
- AWS CDK Samples:
– Several subdirectories under “cdk” contain multiple stacks using TypeScript and even Go (e.g. “cdk-lang-typescript-apigateway-lambda-nodejs-sample”, “cdk-lang-typescript-lambda-go-sample”, “cdk-split-files-sample”, and EC2 examples).
- Machine Learning Projects:
– Under “machinelearning” you have several patterns. For instance:
– The “ai-gateway” project demonstrates an AppSync pattern with Lambda functions and may include GraphQL schemas.
– “litellm-server”, Sagemaker examples, and DVC examples indicate sample pipelines that use different ML services and data versioning.
– Represent these as separate modules showing data inputs (S3 or data sources), model inference endpoints (Sagemaker or custom inference services), and data processing layers.
- Serverless Projects:
– The “serverless” directory features API handlers and configurations for a serverless deployment pattern using AWS Lambda and API Gateway.
– Show these as serverless functions triggered by API calls, with their configuration files (serverless_dev.yml, api YAML files) indicating deployment.
- Workshop Materials:
– Under “workshops” there are multiple workshop examples (e.g., “ai-coding-workshop”, “cdk-workshop”). Treat these as guided sample projects that illustrate full-stack, serverless, or ML-based architectures.

##### Relationships and Interactions
– For CDK samples, show deployment flows and resource interactions such as Lambdas invoking other services (API Gateway, CloudWatch, etc.).
– In serverless and workshop projects, indicate how requests route through API Gateways and trigger Lambda handlers.

##### Architectural Patterns and Design Principles
- Infrastructure-as-Code (CDK) approach in many directories by drawing “stacks” or modules that represent code-defined resources.
- For the Amplify application, show the separation of concerns between the frontend (Next.js, static assets) and backend (Amplify-managed services).
- For machine learning, illustrate the pipeline stages: data ingestion, preprocessing, model inference, and postprocessing.

##### Relevant AWS Services and Technologies
- Where applicable, annotate components with the AWS service they represent – such as AWS Amplify, AWS Lambda, API Gateway, EC2, S3, VPC, CloudWatch, and Sagemaker.
- Language or framework usage, e.g., “Next.js,” “TypeScript,” “Go,” “Python,” and Docker, to indicate how each sample implements its functionality.
- For workshop projects, if they include Docker Compose or Terraform (as seen in the “eks” directory with Terraform files), add those as part of the deployment or orchestration layer.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Global Nodes
    U("User"):::user
    E("AWS Samples Ecosystem"):::user

    U -->|"accesses"| E

    %% AWS Amplify & Frontend Apps Subgraph
    subgraph "AWS Amplify & Frontend Apps"
        A1("Next.js Frontend App"):::amplify
        A2("Next.js Pages"):::amplify
        A3("API Routes"):::amplify
        A4("Amplify Backend Service"):::amplify
        A1 -->|"renders"| A2
        A2 -->|"calls"| A3
        A3 -->|"invokes"| A4
    end

    E --> A1

    %% AWS CDK Samples Subgraph
    subgraph "AWS CDK Samples"
        C1("CDK: API Gateway & Lambda (TS)"):::cdk
        C2("CDK: Lambda Go (TS)"):::cdk
        C3("CDK: Split Files Sample"):::cdk
        C4("CDK: EC2 SSM"):::cdk
        C5("CDK: EC2"):::cdk
        C1 -->|"integrates"| C2
        C2 -->|"integrates"| C3
        C3 -->|"integrates"| C4
        C4 -->|"integrates"| C5
    end

    A4 -->|"triggers"| C1

    %% Machine Learning Projects Subgraph
    subgraph "Machine Learning Projects"
        M1("ML: AI Gateway (AppSync & Lambda)"):::ml
        M2("ML: LiteLLM Server"):::ml
        M3("ML: Bedrock Examples"):::ml
        M4("ML: DVC"):::ml
        M5("ML: Introduction Pipeline"):::ml
        M6("ML: Sagemaker Examples"):::ml
        M1 -->|"calls"| M2
        M2 -->|"triggers"| M3
        M3 -->|"processes"| M4
        M4 -->|"triggers"| M5
        M5 -->|"executes"| M6
    end

    C5 -->|"sends_data"| M1

    %% Serverless Projects Subgraph
    subgraph "Serverless Projects"
        S1("Serverless API Handler"):::serverless
        S2("Serverless Lambda Function"):::serverless
        S1 -->|"invokes"| S2
    end

    M6 -->|"sends_output"| S1

    %% Workshop Materials Subgraph
    subgraph "Workshop Materials"
        W1("Workshop Materials"):::workshops
    end

    S2 -->|"feeds"| W1

    %% Click Events for AWS Amplify & Frontend Apps
    click A1 "https://github.com/littlemex/aws-samples/tree/main/amplify/next-amplified"
    click A2 "https://github.com/littlemex/aws-samples/tree/main/amplify/next-amplified/pages"
    click A3 "https://github.com/littlemex/aws-samples/tree/main/amplify/next-amplified/pages/api"

    %% Click Events for AWS CDK Samples
    click C1 "https://github.com/littlemex/aws-samples/tree/main/cdk/cdk-lang-typescript-apigateway-lambda-nodejs-sample"
    click C2 "https://github.com/littlemex/aws-samples/tree/main/cdk/cdk-lang-typescript-lambda-go-sample"
    click C3 "https://github.com/littlemex/aws-samples/tree/main/cdk/cdk-split-files-sample"
    click C4 "https://github.com/littlemex/aws-samples/tree/main/cdk/ec2-ssm-cdk"
    click C5 "https://github.com/littlemex/aws-samples/tree/main/cdk/ec2"

    %% Click Events for Machine Learning Projects
    click M1 "https://github.com/littlemex/aws-samples/tree/main/machinelearning/ai-gateway"
    click M2 "https://github.com/littlemex/aws-samples/tree/main/machinelearning/ai-gateway/litellm-server"
    click M3 "https://github.com/littlemex/aws-samples/tree/main/machinelearning/bedrock-examples"
    click M4 "https://github.com/littlemex/aws-samples/tree/main/machinelearning/dvc"
    click M5 "https://github.com/littlemex/aws-samples/tree/main/machinelearning/introduction"
    click M6 "https://github.com/littlemex/aws-samples/tree/main/machinelearning/sagemaker-examples"

    %% Click Events for Serverless Projects
    click S1 "https://github.com/littlemex/aws-samples/tree/main/serverless/app/api"
    click S2 "https://github.com/littlemex/aws-samples/tree/main/serverless/handlers"

    %% Click Event for Workshop Materials
    click W1 "https://github.com/littlemex/aws-samples/tree/main/workshops"

    %% Styles
    classDef user fill:#e0e0e0,stroke:#333,stroke-width:2px;
    classDef amplify fill:#f9c74f,stroke:#333,stroke-width:2px;
    classDef cdk fill:#90be6d,stroke:#333,stroke-width:2px;
    classDef ml fill:#f9844a,stroke:#333,stroke-width:2px;
    classDef serverless fill:#577590,stroke:#333,stroke-width:2px,color:#fff;
    classDef workshops fill:#277da1,stroke:#333,stroke-width:2px,color:#fff;
```
