Skip to content

SST Infrastructure Overview

1. Project Structure & File Organization

  • All infrastructure code lives in /infra.
    • Files in this directory define your AWS/CDK resources using SST constructs.
    • Flat structure: Avoid nested directories unless grouping similar infrastructure code is necessary.
  • No external libraries (outside of SST, Pulumi, and Node.js) are allowed in infrastructure code. This keeps deployments predictable and compatible with SST's requirements.

2. Custom Scripts & Commands

  • For custom logic (e.g., shell commands, scripts) as part of your infrastructure (such as with local.Command in Pulumi):
    • Store these scripts in /deploy-scripts.
    • Scripts should use the *.shell.ts file extension by convention.
    • This ensures SST does not try to parse or import these scripts as part of the main infrastructure code, avoiding issues with unsupported code in the deployment process.

3. Docker & Images

  • Any Docker configuration (for deployment or development) should be placed in the /images directory.
    • This keeps container-related resources separate from your main infrastructure code.

4. Configuration Management

  • Configuration is managed in /.mmv3.
    • You can read the config in your infrastructure code using:
      ts
      import { readConfig } from "@mmv3/sst";
      const config = await readConfig();
    • The config is:
      • Typesafe
      • Well-documented with JSDoc
      • Has sensible defaults
    • Config is only required for development; non-dev stages do not need to set up a config.

5. Development & Deployment

  • Development:
    Run your infrastructure locally with:
    sh
    bunx sst dev
  • Deploying a live personal stage:
    Deploy your infrastructure to a live environment with:
    sh
    bunx sst deploy --stage <personal-stage>-live

Summary Table

Directory/FilePurpose
/infraAll SST infrastructure code (flat, unless grouping is needed)
/deploy-scriptsCustom scripts for infra logic (*.shell.ts)
/imagesDocker configs for deployment/development
/.mmv3Centralized, typesafe config (read with readConfig)

Note: No external libraries in infra code (except SST, Pulumi, Node.js)


Let this document serve as a reference for maintaining and extending the SST infrastructure in this project.