Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to SST v3 #9475

Merged
merged 2 commits into from
Sep 24, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 15 additions & 19 deletions src/content/docs/en/guides/deploy/sst.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,50 +6,46 @@ i18nReady: true
---
import { Steps } from '@astrojs/starlight/components';

You can deploy an Astro site using [SST](https://sst.dev), an open-source framework for deploying fully serverless applications to AWS with SSG and SSR support.
You can deploy an Astro site to AWS using [SST](https://sst.dev), an open-source framework for deploying modern full-stack applications with SSG and SSR support.

You can also use any additional SST constructs like Cron Jobs, Buckets, Queues, etc while maintaining type-safety.
You can also use any additional SST components like Cron Jobs, Buckets, Queues, etc while maintaining type-safety.

## Quickstart

<Steps>
1. Create an astro project.

2. Run `npx create-sst`.
2. Run `npx sst@latest init`.

3. It should detect that you are using Astro and ask you to confirm.

4. Once you're ready for deployment you can run `npx sst deploy --stage=production`.
4. Once you're ready for deployment you can run `npx sst deploy --stage production`.
</Steps>

You can also watch [a video walkthrough of this process](https://www.youtube.com/watch?v=AFP3ZHxO7Gg) that will guide you through the steps.
You can also read [the full tutorial](https://sst.dev/docs/start/aws/astro) that will guide you through the steps.
sarah11918 marked this conversation as resolved.
Show resolved Hide resolved

### SST constructs
### SST components

To use any [additional SST constructs](https://docs.sst.dev/), add them to `sst.config.ts`.
To use any [additional SST components](https://sst.dev/docs/), add them to `sst.config.ts`.

```ts {2} {4} title="sst.config.ts"
app.stack(function Site(ctx) {
const bucket = new Bucket(ctx.stack, "public");
const site = new AstroSite(ctx.stack, "site", {
bind: [bucket],
});

ctx.stack.addOutputs({
url: site.url,
});
const bucket = new sst.aws.Bucket("MyBucket", {
access: "public",
});
new sst.aws.Astro("MyWeb", {
link: [bucket],
});
```

And then access them in your `.astro` file.

```astro
---
import { Bucket } from "sst/node/bucket"
console.log(Bucket.public.bucketName)
import { Resource } from "sst"
console.log(Resource.MyBucket.name)
---
```

Consult the [SST docs on Resource Binding](https://docs.sst.dev/resource-binding) to learn more.
Consult the [SST docs on linking resources](https://sst.dev/docs/linking) to learn more.

If you have any questions, you can [ask in the SST Discord](https://discord.gg/sst).
Loading