$ show anomalyco/sst
SST is a full-stack deployment framework and CLI tool for building and deploying serverless applications on AWS and Cloudflare. It uses Pulumi for infrastructure as code, provides a rich set of high-level components (Functions, Buckets, Queues, Databases, Auth, etc.), and supports multiple runtimes (Node.js, Python, Go, Rust) and frontend frameworks (Next.js, Remix, Astro, SvelteKit, SolidStart, etc.). The CLI offers live development mode with hot-reload, a terminal multiplexer, and SSH tunneling for VPC resources. The codebase is a monorepo with a Go CLI, TypeScript platform components, and SDKs in JavaScript, Python, Rust, and Go. While it demonstrates solid engineering patterns like a typed event bus, component transform system, and resource linking, it suffers from some deprecated components, code duplication across framework-specific SSR site components, and a high maintenance surface due to the sheer number of providers and examples.
The LLM identified 3 files worth highlighting for reuse:
Implements a strongly typed, in-process event bus using Go generics. `Bus` type is parameterized with an event type, providing type-safe `Subscribe` and `Publish` methods. Handles channel capacity, context cancellation, and multiple subscribers. Used internally to decouple the CLI from other subsystems (file watcher, UI, deployment events). Could be extracted and reused in any Go application requiring an internal pub-sub pattern without external dependencies.
A lightweight NPM registry client that resolves package metadata and tarball URLs. Handles authentication via `.npmrc` files, supporting token-based auth (`//registry.npmjs.org/:_authToken`), basic auth, and environment variable substitution in registry URLs. Used during SST's install process to download providers. The logic for parsing `.npmrc` and constructing auth headers is non-trivial and reusable in any tool that needs to interact with an NPM-compatible registry.
Manages child process lifecycle with a `Process` struct that wraps an `exec.Cmd`. Tracks process start time, provides `Kill()` with escalating signals (SIGTERM, SIGKILL on timeout), `Wait()` with context support, and `OnDone`/`OnStdout`/`OnStderr` callbacks. Includes platform-specific implementations for detaching processes on Unix/Windows. The pattern of escalating signal escalation and callback-driven output reading is a clean abstraction for long-running subprocess management and could be reused in any CLI tool that spawns and manages child processes.