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 '/monorepo-template/g' 'MY_APP' '**/*.*' --verbose
-
Deploy!
npm install npx sst deploy
-
Optionally, enable git push to deploy.
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.