# anomalyco/sst architecture

> Architecture diagram of the GitHub repository anomalyco/sst, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/anomalyco/sst
- Repository: https://github.com/anomalyco/sst

## Overview

SST is a framework for building and deploying full-stack applications on managed infrastructure. Users initialize or configure an app, define infrastructure components, then use the CLI to deploy or run a live development session; the CLI coordinates project/runtime work and communicates with the deployment server. The graph also preserves documented AWS and Cloudflare component capabilities, resource linking, SDK/auth support, and development tunnels. Some subsystem paths come from the repository tree, but their internals were not sampled; those relationships are omitted unless documented or evidenced by the index.

Main entry points: [`platform/src/components/aws/function.ts`](https://github.com/anomalyco/sst/blob/dev/platform/src/components/aws/function.ts) (AWS components), [`pkg/project/run.go`](https://github.com/anomalyco/sst/blob/dev/pkg/project/run.go) (Project orchestration), [`platform/src/components/component.ts`](https://github.com/anomalyco/sst/blob/dev/platform/src/components/component.ts) (Component foundation), [`platform/src/components/aws/router.ts`](https://github.com/anomalyco/sst/blob/dev/platform/src/components/aws/router.ts) (Router component)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI and project lifecycle"]
  node_cli["SST CLI<br/>[main.go]"]
  node_project["Project orchestration<br/>[run.go]"]
  node_project_setup["Project setup<br/>[create.go]"]
end

subgraph group_deploy["Deployment and providers"]
  node_deploy_server["Deployment server<br/>[server.go]"]
  node_aws_resources["AWS resource handlers<br/>[run.go]"]
  node_cf_resources["Cloudflare resources"]
  node_state[("Stack state<br/>[state.go]")]
end

subgraph group_infra["Infrastructure components"]
  node_aws_components["AWS components<br/>[function.ts]"]
  node_aws_bucket["Bucket component<br/>[bucket.ts]"]
  node_aws_router["Router component<br/>[router.ts]"]
  node_aws_service["Container service<br/>[service.ts]"]
  node_aws_dns["AWS DNS<br/>[dns.ts]"]
  node_cf_worker["Cloudflare Worker<br/>[worker.ts]"]
  node_component_base["Component foundation<br/>[component.ts]"]
  node_resource_links["Resource linking<br/>[link.ts]"]
end

subgraph group_runtime["Runtime and application SDK"]
  node_runtime["Runtime selection<br/>[runtime.go]"]
  node_worker_runtime["Worker runtime<br/>[worker.go]"]
  node_app_sdk["JavaScript SDK<br/>[index.ts]"]
  node_auth_sdk["Auth SDK<br/>[handler.ts]"]
end

subgraph group_dev["Live development"]
  node_live_dev["Live development<br/>[dev.go]"]
  node_watcher["Config watcher<br/>[watcher.go]"]
  node_tunnel["Development tunnel<br/>[tunnel.go]"]
end

node_developer(("Application developer"))
node_developer_app["Application services"]
node_cloud_providers{{"Cloud providers"}}

node_developer -->|"runs commands"| node_cli
node_cli -->|"runs project"| node_project
node_cli -->|"initializes app"| node_project_setup
node_project -->|"selects runtime"| node_runtime
node_project -.->|"deploys through"| node_deploy_server
node_deploy_server -->|"dispatches resources"| node_aws_resources
node_deploy_server -.->|"dispatches resources"| node_cf_resources
node_project -.->|"uses stack state"| node_state
node_developer -->|"defines infrastructure"| node_aws_components
node_developer -->|"defines infrastructure"| node_cf_worker
node_aws_bucket -->|"uses functions"| node_aws_components
node_aws_bucket -.->|"creates links"| node_resource_links
node_aws_router -->|"routes to functions"| node_aws_components
node_aws_router -->|"routes to buckets"| node_aws_bucket
node_aws_router -.->|"extends foundation"| node_component_base
node_aws_service -->|"extends foundation"| node_component_base
node_aws_dns -->|"extends foundation"| node_component_base
node_cf_worker -.->|"extends foundation"| node_component_base
node_aws_components -.->|"extends foundation"| node_component_base
node_aws_components -->|"reads linked permissions"| node_resource_links
node_aws_components -->|"provisions AWS"| node_cloud_providers
node_cf_worker -->|"provisions Cloudflare"| node_cloud_providers
node_project -->|"runs worker"| node_worker_runtime
node_worker_runtime -->|"uses runtime"| node_runtime
node_developer_app -->|"uses SDK"| node_app_sdk
node_app_sdk -.->|"exposes auth"| node_auth_sdk
node_developer -->|"starts dev mode"| node_live_dev
node_live_dev -.->|"watches config"| node_watcher
node_developer -->|"opens tunnel"| node_tunnel

click node_cli "https://github.com/anomalyco/sst/blob/dev/cmd/sst/main.go"
click node_project "https://github.com/anomalyco/sst/blob/dev/pkg/project/run.go"
click node_project_setup "https://github.com/anomalyco/sst/blob/dev/pkg/project/create.go"
click node_deploy_server "https://github.com/anomalyco/sst/blob/dev/pkg/server/server.go"
click node_aws_resources "https://github.com/anomalyco/sst/blob/dev/pkg/server/resource/run.go"
click node_cf_resources "https://github.com/anomalyco/sst/blob/dev/pkg/server/resource/cloudflare-worker-script.go"
click node_state "https://github.com/anomalyco/sst/blob/dev/pkg/state/state.go"
click node_aws_components "https://github.com/anomalyco/sst/blob/dev/platform/src/components/aws/function.ts"
click node_aws_bucket "https://github.com/anomalyco/sst/blob/dev/platform/src/components/aws/bucket.ts"
click node_aws_router "https://github.com/anomalyco/sst/blob/dev/platform/src/components/aws/router.ts"
click node_aws_service "https://github.com/anomalyco/sst/blob/dev/platform/src/components/aws/service.ts"
click node_aws_dns "https://github.com/anomalyco/sst/blob/dev/platform/src/components/aws/dns.ts"
click node_cf_worker "https://github.com/anomalyco/sst/blob/dev/platform/src/components/cloudflare/worker.ts"
click node_component_base "https://github.com/anomalyco/sst/blob/dev/platform/src/components/component.ts"
click node_resource_links "https://github.com/anomalyco/sst/blob/dev/platform/src/components/link.ts"
click node_runtime "https://github.com/anomalyco/sst/blob/dev/pkg/runtime/runtime.go"
click node_worker_runtime "https://github.com/anomalyco/sst/blob/dev/pkg/runtime/worker/worker.go"
click node_app_sdk "https://github.com/anomalyco/sst/blob/dev/sdk/js/src/index.ts"
click node_auth_sdk "https://github.com/anomalyco/sst/blob/dev/sdk/js/src/auth/handler.ts"
click node_live_dev "https://github.com/anomalyco/sst/blob/dev/cmd/sst/mosaic/dev/dev.go"
click node_watcher "https://github.com/anomalyco/sst/blob/dev/cmd/sst/mosaic/watcher/watcher.go"
click node_tunnel "https://github.com/anomalyco/sst/blob/dev/pkg/tunnel/tunnel.go"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cli,node_project,node_project_setup toneBlue
class node_deploy_server,node_aws_resources,node_cf_resources,node_state toneAmber
class node_aws_components,node_aws_bucket,node_aws_router,node_aws_service,node_aws_dns,node_cf_worker,node_component_base,node_resource_links toneMint
class node_runtime,node_worker_runtime,node_app_sdk,node_auth_sdk toneRose
class node_live_dev,node_watcher,node_tunnel,node_developer,node_developer_app,node_cloud_providers toneIndigo
```

## Components

### CLI and project lifecycle

- [SST CLI](https://github.com/anomalyco/sst/blob/dev/cmd/sst/main.go): `cmd/sst/main.go`
- [Project orchestration](https://github.com/anomalyco/sst/blob/dev/pkg/project/run.go): `pkg/project/run.go`
- [Project setup](https://github.com/anomalyco/sst/blob/dev/pkg/project/create.go): `pkg/project/create.go`

### Deployment and providers

- [Deployment server](https://github.com/anomalyco/sst/blob/dev/pkg/server/server.go): `pkg/server/server.go`
- [AWS resource handlers](https://github.com/anomalyco/sst/blob/dev/pkg/server/resource/run.go): `pkg/server/resource/run.go`
- [Cloudflare resources](https://github.com/anomalyco/sst/blob/dev/pkg/server/resource/cloudflare-worker-script.go): `pkg/server/resource/cloudflare-worker-script.go`
- [Stack state](https://github.com/anomalyco/sst/blob/dev/pkg/state/state.go): `pkg/state/state.go`

### Infrastructure components

- [AWS components](https://github.com/anomalyco/sst/blob/dev/platform/src/components/aws/function.ts): `platform/src/components/aws/function.ts`
- [Bucket component](https://github.com/anomalyco/sst/blob/dev/platform/src/components/aws/bucket.ts): `platform/src/components/aws/bucket.ts`
- [Router component](https://github.com/anomalyco/sst/blob/dev/platform/src/components/aws/router.ts): `platform/src/components/aws/router.ts`
- [Container service](https://github.com/anomalyco/sst/blob/dev/platform/src/components/aws/service.ts): `platform/src/components/aws/service.ts`
- [AWS DNS](https://github.com/anomalyco/sst/blob/dev/platform/src/components/aws/dns.ts): `platform/src/components/aws/dns.ts`
- [Cloudflare Worker](https://github.com/anomalyco/sst/blob/dev/platform/src/components/cloudflare/worker.ts): `platform/src/components/cloudflare/worker.ts`
- [Component foundation](https://github.com/anomalyco/sst/blob/dev/platform/src/components/component.ts): `platform/src/components/component.ts`
- [Resource linking](https://github.com/anomalyco/sst/blob/dev/platform/src/components/link.ts): `platform/src/components/link.ts`

### Runtime and application SDK

- [Runtime selection](https://github.com/anomalyco/sst/blob/dev/pkg/runtime/runtime.go): `pkg/runtime/runtime.go`
- [Worker runtime](https://github.com/anomalyco/sst/blob/dev/pkg/runtime/worker/worker.go): `pkg/runtime/worker/worker.go`
- [JavaScript SDK](https://github.com/anomalyco/sst/blob/dev/sdk/js/src/index.ts): `sdk/js/src/index.ts`
- [Auth SDK](https://github.com/anomalyco/sst/blob/dev/sdk/js/src/auth/handler.ts): `sdk/js/src/auth/handler.ts`

### Live development

- [Live development](https://github.com/anomalyco/sst/blob/dev/cmd/sst/mosaic/dev/dev.go): `cmd/sst/mosaic/dev/dev.go`
- [Config watcher](https://github.com/anomalyco/sst/blob/dev/cmd/sst/mosaic/watcher/watcher.go): `cmd/sst/mosaic/watcher/watcher.go`
- [Development tunnel](https://github.com/anomalyco/sst/blob/dev/pkg/tunnel/tunnel.go): `pkg/tunnel/tunnel.go`

### Other components

- **Application developer**
- **Application services**
- **Cloud providers**

## Connections

- Application developer → SST CLI: runs commands (evidence: `cmd/sst/main.go`)
- SST CLI → Project orchestration: runs project (evidence: `cmd/sst/main.go`)
- SST CLI → Project setup: initializes app (evidence: `cmd/sst/main.go`)
- Project orchestration → Runtime selection: selects runtime (evidence: `pkg/project/run.go`)
- Project orchestration → Deployment server: deploys through
- Deployment server → AWS resource handlers: dispatches resources (evidence: `pkg/server/server.go`)
- Deployment server → Cloudflare resources: dispatches resources
- Project orchestration → Stack state: uses stack state
- Application developer → AWS components: defines infrastructure (evidence: `README.md`)
- Application developer → Cloudflare Worker: defines infrastructure (evidence: `README.md`)
- Bucket component → AWS components: uses functions (evidence: `platform/src/components/aws/bucket.ts`)
- Bucket component → Resource linking: creates links (evidence: `platform/src/components/aws/bucket.ts`)
- Router component → AWS components: routes to functions (evidence: `platform/src/components/aws/router.ts`)
- Router component → Bucket component: routes to buckets (evidence: `platform/src/components/aws/router.ts`)
- Router component → Component foundation: extends foundation (evidence: `platform/src/components/aws/router.ts`)
- Container service → Component foundation: extends foundation (evidence: `platform/src/components/aws/service.ts`)
- AWS DNS → Component foundation: extends foundation (evidence: `platform/src/components/aws/dns.ts`)
- Cloudflare Worker → Component foundation: extends foundation (evidence: `platform/src/components/cloudflare/worker.ts`)
- AWS components → Component foundation: extends foundation (evidence: `platform/src/components/aws/function.ts`)
- AWS components → Resource linking: reads linked permissions (evidence: `platform/src/components/aws/function.ts`)
- AWS components → Cloud providers: provisions AWS (evidence: `README.md`)
- Cloudflare Worker → Cloud providers: provisions Cloudflare (evidence: `README.md`)
- Project orchestration → Worker runtime: runs worker (evidence: `pkg/runtime/worker/worker.go`)
- Worker runtime → Runtime selection: uses runtime (evidence: `pkg/runtime/worker/worker.go`)
- Application services → JavaScript SDK: uses SDK (evidence: `README.md`)
- JavaScript SDK → Auth SDK: exposes auth
- Application developer → Live development: starts dev mode
- Live development → Config watcher: watches config
- Application developer → Development tunnel: opens tunnel
