Now that we understand what infrastructure as code is, we are ready to create our first SST app.

Run the following in your working directory.

$ npm init sst javascript-starter notes
$ cd notes
$ npm install

By default, our app will be deployed to an environment (or stage) called dev in the us-east-1 AWS region. This can be changed in the sst.json in your project root.

{
  "name": "notes",
  "region": "us-east-1",
  "main": "stacks/index.js"
}

Project layout

An SST app is made up of two parts.

  1. stacks/ — App Infrastructure

    The code that describes the infrastructure of your serverless app is placed in the stacks/ directory of your project. SST uses AWS CDK, to create the infrastructure.

  2. services/ — App Code

    The Lambda function code that’s run when your API is invoked is placed in the services/ directory of your project.

Later on we’ll be adding a frontend/ directory for our frontend React app.

The starter project that’s created is defining a simple Hello World API. In the next chapter, we’ll be deploying it and running it locally.