Create an SST app
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.
$ npx create-serverless-stack@latest notes
$ cd notes
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.
-
stacks/
— App InfrastructureThe 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. -
src/
— App CodeThe Lambda function code that’s run when your API is invoked is placed in the
src/
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.
For help and discussion
Comments on this chapter