Skip to content

sst/monorepo-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Monorepo Template

A template to create a monorepo SST ❍ Ion project.

Get started

  1. Use this template to create your own repo.

  2. Clone the new repo.

    git clone MY_APP
    cd MY_APP
  3. Rename the files in the project to the name of your app.

    npx replace-in-file /monorepo-template/g MY_APP **/*.* --verbose
  4. Deploy!

    npm install
    npx sst deploy
  5. Optionally, enable git push to deploy.

Usage

This template uses npm Workspaces. It has 3 packages to start with and you can add more it.

  1. 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();
  2. functions/

    This is for your Lambda functions and it uses the core package as a local dependency.

  3. scripts/

    This is for any scripts that you can run on your SST app using the sst shell CLI and tsx. For example, you can run the example script using:

    npm run shell src/example.ts

Infrastructure

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.