# mhadev0703/pawto-album architecture

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

- Interactive diagram: https://gitdiagram.com/mhadev0703/pawto-album
- Repository: https://github.com/mhadev0703/pawto-album

## Overview

##### Project type and purpose
- This is a serverless full-stack application built with the SST (Serverless Stack) framework in a monorepo.
- The “web” package is a React/Vite frontend; “functions” contains AWS Lambda handlers; “core” is a shared TypeScript domain library.
- The stacks/MyStack.ts file defines the AWS resources and API Gateway endpoints.

##### File structure
Top-level
– pnpm-workspace.yaml, package.json, sst.config.ts, stacks/MyStack.ts
– packages/
packages/core
– Domain definitions and event models (event.ts, todo.ts)
– Reusable logic and types used by Lambdas and potentially other services.
packages/functions
– AWS Lambda entrypoints (lambda.ts)
– Domain-specific handlers (todo.ts, events/todo-created.ts)
– Bundled by SST into serverless functions behind API Gateway.
packages/web
– React single-page app (App.jsx, pages/, components/)
– Vite config, environment typings (sst-env.d.ts)
– Deployed as static assets to S3/CloudFront or served locally for dev.

##### README insights
- (No content provided—information inferred from file tree and SST conventions.)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Layers
    subgraph "Frontend Layer"
        direction TB
        Frontend["React SPA"]:::frontend
    end

    subgraph "API Layer"
        direction TB
        APIGateway["API Gateway"]:::api
    end

    subgraph "Compute Layer" 
        direction TB
        LambdaBase["Lambda Entrypoint\n(lambda.ts)"]:::compute
        TodoFunction["Todo Handler\n(todo.ts)"]:::compute
        TodoCreatedFunction["Todo Created Handler\nevents/todo-created.ts"]:::compute
    end

    subgraph "Domain Library"
        direction TB
        CoreTodo["todo.ts"]:::core
        CoreEvent["event.ts"]:::core
    end

    subgraph "Infrastructure as Code"
        direction TB
        SSTConfig["sst.config.ts"]:::infra
        MyStack["MyStack.ts"]:::infra
    end

    subgraph "Environment Typings"
        direction TB
        EnvCore["core/sst-env.d.ts"]:::env
        EnvFunctions["functions/sst-env.d.ts"]:::env
        EnvWeb["web/src/sst-env.d.ts"]:::env
    end

    Database["DynamoDB (or similar)"]:::db
    EventBus["Event Bus\n(EventBridge/SNS)"]:::infra

    %% Connections
    Frontend -->|"HTTP: GET/POST"| APIGateway
    APIGateway -->|"Invoke"| LambdaBase
    LambdaBase -->|imports| CoreTodo
    LambdaBase -->|imports| CoreEvent

    LambdaBase -->|routes to| TodoFunction
    TodoFunction -->|writes/reads| Database
    TodoFunction -->|emits event| EventBus

    EventBus -.->|"async"| TodoCreatedFunction
    TodoCreatedFunction -->|imports| CoreEvent

    SSTConfig --> MyStack
    MyStack --> APIGateway
    MyStack --> Database
    MyStack --> EventBus
    MyStack --> LambdaBase
    MyStack --> TodoFunction
    MyStack --> TodoCreatedFunction

    %% Click events
    click Frontend "https://github.com/mhadev0703/pawto-album/tree/main/packages/web/"
    click APIGateway "https://github.com/mhadev0703/pawto-album/blob/main/stacks/MyStack.ts"
    click LambdaBase "https://github.com/mhadev0703/pawto-album/blob/main/packages/functions/src/lambda.ts"
    click TodoFunction "https://github.com/mhadev0703/pawto-album/blob/main/packages/functions/src/todo.ts"
    click TodoCreatedFunction "https://github.com/mhadev0703/pawto-album/blob/main/packages/functions/src/events/todo-created.ts"
    click CoreTodo "https://github.com/mhadev0703/pawto-album/blob/main/packages/core/src/todo.ts"
    click CoreEvent "https://github.com/mhadev0703/pawto-album/blob/main/packages/core/src/event.ts"
    click SSTConfig "https://github.com/mhadev0703/pawto-album/blob/main/sst.config.ts"
    click MyStack "https://github.com/mhadev0703/pawto-album/blob/main/stacks/MyStack.ts"
    click EnvCore "https://github.com/mhadev0703/pawto-album/blob/main/packages/core/sst-env.d.ts"
    click EnvFunctions "https://github.com/mhadev0703/pawto-album/blob/main/packages/functions/sst-env.d.ts"
    click EnvWeb "https://github.com/mhadev0703/pawto-album/blob/main/packages/web/src/sst-env.d.ts"
    click Database "https://github.com/mhadev0703/pawto-album/blob/main/stacks/MyStack.ts"
    click EventBus "https://github.com/mhadev0703/pawto-album/blob/main/stacks/MyStack.ts"

    %% Styles
    classDef frontend fill:#AEDFF7,stroke:#0366d6,color:#0366d6;
    classDef api fill:#E3FCEF,stroke:#027A48,color:#027A48;
    classDef compute fill:#D5F5E3,stroke:#28A745,color:#28A745;
    classDef core fill:#F3E5AB,stroke:#E69A00,color:#E69A00;
    classDef infra fill:#F0E6F6,stroke:#6F42C1,color:#6F42C1,stroke-dasharray: 5 5;
    classDef env fill:#FFE8D6,stroke:#D6336C,color:#D6336C;
    classDef db fill:#FEDFCA,stroke:#C45600,color:#C45600;
```
