A template to create a monorepo SST v3 project. Learn more.
-
Use this template to create your own repo.
-
Clone the new repo.
git clone <REPO_URL> MY_APP cd MY_APP
-
Rename the files in the project to the name of your app.
npx replace-in-file '/structa/g' 'MY_APP' '**/*.*' --verbose
-
Deploy!
npm install npx sst deploy
-
Optionally, enable git push to deploy.
This project uses a PR-based workflow with automated quality checks.
-
Install dependencies:
npm install
This automatically sets up git hooks via the
preparescript. -
Verify setup:
# Check that hooks are installed ls -la .husky/pre-commit
-
Create feature branch from production:
git checkout production git pull origin production git checkout -b feature/my-awesome-feature
-
Develop and commit:
# Make your changes git add . git commit -m "feat: add awesome feature"
Pre-commit hook runs automatically:
- ⚡ Lint & format staged files (~5-15s)
- 🔍 TypeScript type check (~10-20s)
- 🧪 Related tests (~5-10s)
- Total: ~20-45 seconds
-
Push and open PR:
git push origin feature/my-awesome-feature
Then open a PR on GitHub:
- Target:
productionbranch - CI will run automatically
- Request review from teammate
- Target:
-
CI checks (automatic):
- Full typecheck
- Complete linting
- Full test suite
- Results commented on PR
-
Address feedback:
- Fix any CI failures
- Address review comments
- Push fixes (CI reruns automatically)
-
Merge:
- Get approval from reviewer
- Ensure CI is green
- Click "Merge pull request"
- SST Console deploys to production automatically
For critical production bugs:
- Same PR process - no shortcuts for quality
- Create branch:
hotfix/critical-bug-name - Make minimal fix, commit, push, PR
- Request urgent review
- Merge once approved + CI passes
git commit --no-verify -m "emergency: fix critical issue"View CI results:
- On PR page, see "Checks" tab
- Green checkmark = passed
- Red X = failed (click for details)
Pre-commit hook fails:
- Read the error message carefully
- Fix the issue (type errors, lint errors, failing tests)
- Commit again
CI fails but pre-commit passed:
- Usually environment differences
- Check CI logs in GitHub Actions tab
- Reproduce locally:
npm run typecheck && npm run check && npm test
Need help:
- Ask in team chat
- Tag reviewer on PR
- Check AGENTS.md for detailed guidelines
This template uses npm Workspaces. It has 3 packages to start with and you can add more it.
-
core/This is for any shared code. It's defined as modules. For example, there's the
Examplemodule.export module Example { export function hello() { return "Hello, world!"; } }
That you can use across other packages using.
import { Example } from "@aws-monorepo/core/example"; Example.hello();
We also have Vitest configured for testing this package with the
sst shellCLI.npm test -
functions/This is for your Lambda functions and it uses the
corepackage as a local dependency. -
scripts/This is for any scripts that you can run on your SST app using the
sst shellCLI andtsx. For example, you can run the example script using:npm run shell src/example.ts
The infra/ directory allows you to logically split the infrastructure of your app into separate files. This can be helpful as your app grows.
In the template, we have an api.ts, and storage.ts. These export the created resources. And are imported in the sst.config.ts.