Skip to content

What is SST

Build full-stack apps on your own infrastructure.

SST is a framework that makes it easy to build modern full-stack applications on your own infrastructure.

What makes SST different is that your entire app is defined in code — in a single sst.config.ts file. This includes databases, buckets, queues, Stripe webhooks, or any one of 150+ providers.

With SST, everything is automated.


Frontend

You start by defining parts of your app, in code. For example, your frontend. Or if you don’t have a frontend, your API.

sst.config.ts
new sst.aws.Nextjs("MyWeb", {
domain: "my-app.com"
});

Your app might even have multiple frontends.


Backend

Just like the frontend, you can configure backend features in code. Features like cron jobs, buckets, queues, databases, and more.

sst.config.ts
new sst.aws.Cron("MyCronJob", {
job: "src/cron.handler",
schedule: "rate(1 minute)"
});

You can check out the full list of components in the sidebar.


Infrastructure

The above are called Components. They are a way of defining the features of your application in code. You can define any feature of your application with them.

In the above examples, they create the necessary infrastructure in your AWS account. All without using the AWS Console.

Learn more about Components.


Configure

SST’s components come with sensible defaults designed to get you started. But they can also be configured completely.

For example, the sst.aws.Function can be configured with all the common Lambda function options.

sst.config.ts
new sst.aws.Function("MyFunction", {
handler: "src/lambda.handler",
timeout: "3 minutes",
memory: "1024 MB"
});

But with SST you can take it a step further and transform how the Function component creates its low level resources. For example, the Function component also creates an IAM Role. You can transform the IAM Role using the transform prop.

sst.config.ts
new sst.aws.Function("MyFunction", {
handler: "src/lambda.handler",
transform: {
role: (args) => ({
name: `${args.name}-MyRole`
})
}
});

Learn more about transforms.


Providers

SST has built-in components for AWS and Cloudflare that make these services easier to use.

However it also supports components from any one of the 150+ Pulumi/Terraform providers. For example, you can use Vercel for your frontends.

sst.config.ts
new vercel.Project("MyFrontend", {
name: "my-nextjs-app"
});

Learn more about Providers and check out the full list in the Directory.


Once you’ve added a couple of features, SST can help you link them together. This is great because you won’t need to hardcode anything in your app.

Let’s say your app has a Next.js frontend and an S3 bucket for file uploads. You can link the bucket to your Next.js app.

sst.config.ts
const bucket = new sst.aws.Bucket("MyBucket");
new sst.aws.Nextjs("MyWeb", {
link: [bucket]
});

You can then use SST’s SDK to access the S3 bucket in your Next.js app.

app/page.tsx
import { Resource } from "sst";
console.log(Resource.MyBucket.name);

Learn more about resource linking.


Project structure

We’ve looked at a couple of different types of files. Let’s take a step back and see what an SST app looks like in practice.


Drop-in mode

The simplest way to run SST is to use it as a part of your frontend. This is called drop-in mode. For example, if you are using Next.js, you can add a sst.config.ts file to the root.

my-nextjs-app
├─ next.config.js
├─ sst.config.ts
├─ package.json
├─ app
├─ lib
└─ public

View an example Next.js app using SST in drop-in mode.


Monorepo

Alternatively, you can use SST in a monorepo. This is useful if you have multiple frontends or you are working on a large project. In this case the sst.config.ts is in the root of your monorepo.

my-sst-app
├─ sst.config.ts
├─ package.json
├─ packages
│  ├─ functions
│  ├─ frontend
│  ├─ scripts
│  └─ core
└─ infra

Learn more about our monorepo setup.


CLI

To make this all work, SST comes with a CLI. You can install it as a part of your Node project.

Terminal window
npm install sst

Or if you are not using Node, you can install it globally.

Terminal window
curl -fsSL https://sst.dev/install | bash

The CLI currently supports macOS, Linux, and WSL. Learn more about the CLI.


Dev

The CLI includes a dev command that starts a local development environment.

Terminal window
sst dev

This brings up a multiplexer that:

  1. Starts a watcher that deploys any infrastructure changes.
  2. Runs your functions Live; letting you make and test changes to your functions, without having to redeploy them.
  3. Starts up your frontend in dev mode and links it to your infrastructure

The sst dev CLI makes it so that you won’t have to start your frontend or your container applications separately. Learn more about sst dev.


Deploy

When you’re ready to deploy your app, you can use the deploy command.

Terminal window
sst deploy --stage production

Stages

The deploy command can deploy your app to a specific stage or environment.

Terminal window
# Deploy to dev
npx sst deploy --stage dev
# Deploy a PR environment
npx sst deploy --stage pr-123

This lets you create separate environments for your app. Learn more about stages.


Console

Once you are ready to go to production, you can use the SST Console to auto-deploy your app, create preview environments, and monitor for any issues.

SST Console

Learn more about the Console.


FAQ

Here are some questions that we frequently get.


Is SST open-source if it’s based on Pulumi and Terraform?

SST uses Pulumi behind the scenes for the providers and the deployment engine. And Terraform’s providers are bridged through Pulumi.

SST only relies on the open-source parts of Pulumi and Terraform. It does not require a Pulumi account and all the data about your app and its resources stay on your side.


How does SST compare to CDK for Terraform or Pulumi?

Both CDKTF and Pulumi allow you to define your infrastructure using a programming language like TypeScript. SST is also built on top of Pulumi. So you might wonder how SST compares to them and why you would use SST instead of them.

In a nutshell, SST is for developers, while CDKTF and Pulumi are primarily for DevOps engineers. There are 3 big things SST does for developers:

  1. Higher-level components

    SST’s built-in components like Nextjs or Email make it easy for developers to add features to their app. You can use these without having to figure out how to work with the underlying Terraform resources.

  2. Linking resources

    SST makes it easy to link your infrastructure to your application and access them at runtime in your code.

  3. Dev mode

    Finally, SST features a unified local developer environment that deploys your app through a watcher, runs your functions Live, and starts your frontend, all together.


How does SST make money?

While SST is open-source and free to use, we also have the Console that can auto-deploy your apps and monitor for any issues. It’s optional and includes a free tier but it’s a SaaS service. It’s used by a large number of teams in our community, including ours.


Next steps

  1. Create your first SST app
  2. Learn about the SST workflow