Appearance
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.Commandin Pulumi):- Store these scripts in
/deploy-scripts. - Scripts should use the
*.shell.tsfile 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.
- Store these scripts in
3. Docker & Images
- Any Docker configuration (for deployment or development) should be placed in the
/imagesdirectory.- 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.
- You can read the config in your infrastructure code using:
5. Development & Deployment
- Development:
Run your infrastructure locally with:shbunx sst dev - Deploying a live personal stage:
Deploy your infrastructure to a live environment with:shbunx sst deploy --stage <personal-stage>-live
Summary Table
| Directory/File | Purpose |
|---|---|
/infra | All SST infrastructure code (flat, unless grouping is needed) |
/deploy-scripts | Custom scripts for infra logic (*.shell.ts) |
/images | Docker configs for deployment/development |
/.mmv3 | Centralized, 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.