TL;DR
SST (Serverless Stack) makes it easy to build full-stack apps on AWS. It provides high-level constructs for Lambda, API Gateway, DynamoDB, S3, and more — with live Lambda debugging and type-safe infrastructure.
What Is SST?
SST simplifies AWS development:
- Full-stack framework — frontend + backend + infrastructure
- Live Lambda — debug Lambda functions locally in real-time
- Type-safe infra — TypeScript infrastructure as code
- Auto-scaling — scales to zero, scales to millions
- Next.js/Remix/Astro — deploy any frontend framework
- Free — MIT license, you only pay for AWS resources
Quick Start
# Create a new SST project
npx create-sst@latest my-app
cd my-app
# Start development (live Lambda debugging)
npx sst dev
# Deploy to production
npx sst deploy --stage production
Define Infrastructure (TypeScript)
// sst.config.ts
export default $config({
app(input) {
return {
name: "my-app",
removal: input.stage === "production" ? "retain" : "remove",
};
},
async run() {
// Create a database
const table = new sst.aws.Dynamo("Users", {
fields: { userId: "string", email: "string" },
primaryIndex: { hashKey: "userId" },
globalIndexes: { emailIndex: { hashKey: "email" } },
});
// Create an S3 bucket
const bucket = new sst.aws.Bucket("Uploads");
// Create an API
const api = new sst.aws.ApiGatewayV2("Api");
api.route("GET /users", {
handler: "packages/functions/src/users/list.handler",
link: [table],
});
api.route("POST /users", {
handler: "packages/functions/src/users/create.handler",
link: [table],
});
api.route("POST /upload", {
handler: "packages/functions/src/upload.handler",
link: [bucket],
});
// Deploy Next.js frontend
const site = new sst.aws.Nextjs("Web", {
link: [api],
});
return { api: api.url, site: site.url };
},
});
Lambda Functions
// packages/functions/src/users/list.ts
import { Resource } from "sst";
import { DynamoDBClient } from "@aws-sdk/client-dynamodb";
import { ScanCommand } from "@aws-sdk/lib-dynamodb";
const client = new DynamoDBClient({});
export async function handler() {
const result = await client.send(
new ScanCommand({ TableName: Resource.Users.name })
);
return {
statusCode: 200,
body: JSON.stringify(result.Items),
};
}
// packages/functions/src/users/create.ts
import { Resource } from "sst";
import { PutCommand } from "@aws-sdk/lib-dynamodb";
import { randomUUID } from "crypto";
export async function handler(event: any) {
const body = JSON.parse(event.body);
await client.send(
new PutCommand({
TableName: Resource.Users.name,
Item: {
userId: randomUUID(),
email: body.email,
name: body.name,
createdAt: new Date().toISOString(),
},
})
);
return { statusCode: 201, body: "Created" };
}
Cron Jobs
new sst.aws.Cron("DailyCleanup", {
schedule: "rate(1 day)",
job: {
handler: "packages/functions/src/cleanup.handler",
link: [table],
},
});
SST vs Alternatives
| Feature | SST | Serverless Framework | CDK | Vercel |
|---|---|---|---|---|
| Live debugging | Yes | Offline plugin | No | No |
| Type-safe infra | TypeScript | YAML | TypeScript | N/A |
| Frontend deploy | Next.js/Remix/Astro | Manual | Manual | Excellent |
| Learning curve | Low | Medium | High | Low |
| Cost | AWS only | AWS only | AWS only | Platform |
| Local dev | Excellent | Plugin | CDK Watch | Excellent |
Resources
- SST Documentation
- GitHub Repository — 22K+ stars
- Examples
- Guide
Building serverless data pipelines on AWS? My Apify tools extract web data — process it with SST Lambda functions for scalable, cost-effective pipelines. Questions? Email spinov001@gmail.com
Top comments (0)