Let's create our first SST app!
- SST is built with Node, so make sure your local machine has it installed; Node.js 14 and npm 7.
- And we'll need a code editor. We use VS Code in this tutorial.
- Some basic TypeScript, AWS, or React knowledge would help, but it's not necessary.
Configure AWS credentials
You also need to have an AWS account and AWS credentials configured locally. If you haven't already, follow these steps.
Create a new app
Let's create our starter. We'll be using the
create sst CLI.
In this tutorial, we'll be using the keyboard icon for code snippets where we want you to make a change.
graphql here, as we'll be using the GraphQL starter in this tutorial.
? What kind of project do you want to create? (Use arrow keys)
? Select a database (you can change this later or use both) (Use arrow keys)
❯ RDS (Postgres or MySQL)
You can always change this later, or even use both. Let's pick RDS. We'll be using PostgreSQL in this tutorial.
Next, install the dependencies.
create sst CLI by default bootstraps a full-stack starter that we'll be using in this tutorial. It can also create a more minimal setup, if you pass in
--minimal. We recommend going that route if you want to piece your stack together.
Start Live Lambda Dev
Let's start our local development environment. Or what SST calls Live Lambda Dev.
npx sst dev
The first time the SST command is run, you'll be prompted to enter a default stage name to use. The stage name will be stored locally in a
.sst/ directory; it's automatically ignored from Git.
Look like you’re running sst for the first time in this directory. Please enter
a stage name you’d like to use locally. Or hit enter to use the one based on
your AWS credentials (Jay):
SST uses the stage names to namespace your resources. So if you and your teammate are working on the same app in the same AWS account, the infrastructure will be kept separate.
SST will automatically suggest a stage name based on the AWS credentials you are using. Hit Enter to use the suggested one.
Make sure to use a unique stage name when working on an SST app locally.
Or if you are picking your own, make sure to use a stage name that is specific to you.
sst dev command, as you might've guessed, deploys to your AWS account. It does a couple of interesting things:
- Bootstraps your AWS account for SST.
- Deploys the infrastructure to run the Live Lambda Dev environment.
- Deploys your app to AWS.
- Runs a local server to:
- Proxy Lambda requests to your local machine.
- Power the SST Console. More on this later.
sst dev command starts up the Live Lambda Dev environment.
The first time you run
sst dev it can take around 5 minutes to set everything up.
sst dev is starting up, let's open your project in your code editor. We are using VS Code in our case.
SST is designed to integrate really well with your code editor. It features automatic support for:
- Breakpoint debugging
- Type checking
- Inline docs
You can read more about this over on our doc on Editor Integration.
Next, let's take a look at the project structure of an SST app.