A template to create a monorepo SST ❍ Ion project.
-
Use this template to create your own repo.
-
Clone the new repo.
git clone 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
Example
module.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();
-
functions/
This is for your Lambda functions and it uses the
core
package as a local dependency. -
scripts/
This is for any scripts that you can run on your SST app using the
sst shell
CLI 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
.
Join the SST community over on Discord and follow us on Twitter.