Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/domitriusclark/sst-monorepo-example
https://github.com/domitriusclark/sst-monorepo-example
Last synced: 7 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/domitriusclark/sst-monorepo-example
- Owner: domitriusclark
- License: mit
- Created: 2024-10-14T23:02:59.000Z (2 months ago)
- Default Branch: main
- Last Pushed: 2024-11-01T06:40:23.000Z (about 2 months ago)
- Last Synced: 2024-12-13T21:09:10.295Z (13 days ago)
- Language: TypeScript
- Size: 36.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Monorepo Template
A template to create a monorepo SST ❍ Ion project.
## Get started
1. Use this template to [create your own repo](https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-repository-from-a-template).
2. Clone the new repo.
```bash
git clone MY_APP
cd MY_APP
```3. Rename the files in the project to the name of your app.
```bash
npx replace-in-file '/monorepo-template/g' MY_APP **/*.* --verbose
```4. Deploy!
```bash
npm install
npx sst deploy
```6. Optionally, enable [_git push to deploy_](https://ion.sst.dev/docs/console/#autodeploy).
## Usage
This template uses [npm Workspaces](https://docs.npmjs.com/cli/v8/using-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.
```ts
export module Example {
export function hello() {
return "Hello, world!";
}
}
```That you can use across other packages using.
```ts
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`](https://www.npmjs.com/package/tsx). For example, you can run the example script using:
```bash
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](https://discord.gg/sst) and follow us on [Twitter](https://twitter.com/SST_dev).