Skip to main content

Create a New Project

Let's create our first SST app!

Prerequisites

  • 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.

npx create-sst@latest
tip

In this tutorial, we'll be using the keyboard icon for code snippets where we want you to make a change.

Select 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)
❯ graphql
minimal
examples

This will prompt you to select a database; either RDS or DynamoDB.

? Select a database (you can change this later or use both) (Use arrow keys)
❯ RDS (Postgres or MySQL)
DynamoDB

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.

cd my-sst-app
npm install

The 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 start

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.

tip

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.


About sst start

The sst start command, as you might've guessed, deploys to your AWS account. It does a couple of interesting things:

  1. Bootstraps your AWS account for SST.
  2. Deploys the infrastructure to run the Live Lambda Dev environment.
  3. Deploys your app to AWS.
  4. Runs a local server to:
    1. Proxy Lambda requests to your local machine.
    2. Power the SST Console. More on this later.
info

The sst start command starts up the Live Lambda Dev environment.

The first time you run sst start it can take around 5 minutes to set everything up.


Editor integration

While sst start 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:

  1. Breakpoint debugging
  2. Type checking
  3. Autocomplete
  4. 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.