1. Home
  2. /
  3. Serverless-stack
  4. /
  5. Simple SST App

Simple SST App - Serverless-stack Typing CST Test

Loading…

Simple SST App — Serverless-stack Code

A simple SST app creating an API and Lambda function.

# sst/demo/app.ts
import * as sst from '@serverless-stack/resources';

export default class MyStack extends sst.Stack {
	constructor(scope, id, props) {
		super(scope, id, props);

		const api = new sst.Api(this, 'Api', {
		routes: {
		'GET /hello': new sst.Function(this, 'Lambda', {
		handler: 'functions/hello.main'
		})
		}
		});
		this.addOutputs({
		ApiEndpoint: api.url
		});
	}
}

Serverless-stack Language Guide

Serverless Stack (SST) is an open-source framework for building full-stack serverless applications on AWS. It provides a development environment with Live Lambda Reloading, infrastructure-as-code using SST constructs (powered by AWS CDK), and seamless integrations for APIs, databases, authentication, and frontends.

Primary Use Cases

  • ▸Building serverless APIs
  • ▸Full-stack apps using AWS Lambda + DynamoDB
  • ▸Event-driven architectures using SQS, SNS, EventBridge
  • ▸Real-time apps using WebSocket or API Gateway
  • ▸Deploying React/Next.js frontends with backend integration

Notable Features

  • ▸Live Lambda Reloading
  • ▸SST Constructs built on AWS CDK
  • ▸Cross-stack references simplified
  • ▸Built-in frontend hosting
  • ▸Strong TypeScript support

Origin & Creator

Created by SST Inc. (initially by the team behind Seed.run) as an evolution of CDK-based serverless tooling.

Industrial Note

SST is used in high-scale serverless architectures where rapid iteration, cost efficiency, and fully managed AWS components are essential.

Quick Explain

  • ▸SST simplifies serverless development by pairing CDK infrastructure with a high-productivity local dev environment.
  • ▸Live Lambda Reloading lets developers instantly test Lambda changes without redeploying.
  • ▸Provides opinionated yet extensible constructs for API, storage, queues, auth, and more.
  • ▸Works seamlessly with React, Next.js, SvelteKit, Astro, and static frontends.
  • ▸Ideal for modern cloud-native, scalable, pay-per-use applications.

Core Features

  • ▸Infrastructure as code (CDK)
  • ▸Lambda-based backend services
  • ▸DynamoDB/Postgres guides and helpers
  • ▸Auth constructs (Cognito, Auth0, custom)
  • ▸Static site + Next.js deployments

Learning Path

  • ▸Learn basics of AWS Lambda and API Gateway
  • ▸Understand CDK constructs
  • ▸Build simple SST APIs
  • ▸Add DB + auth
  • ▸Deploy full-stack app across environments

Practical Examples

  • ▸CRUD API with DynamoDB
  • ▸Next.js app with serverless backend
  • ▸Real-time chat using WebSockets
  • ▸ETL workflows with EventBridge + Lambda
  • ▸Image upload pipeline using S3 + Lambda

Comparisons

  • ▸SST vs AWS SAM - SST offers richer full-stack features
  • ▸SST vs Serverless Framework - SST has Live Lambda + CDK power
  • ▸SST vs Pulumi - SST is optimized for AWS serverless
  • ▸SST vs CDK alone - SST provides higher-level constructs
  • ▸SST vs Amplify - SST is more flexible and backend-centric

Strengths

  • ▸Fast feedback loop with Live Lambda
  • ▸Full-stack support (backend + frontend)
  • ▸Strong TypeScript ecosystem
  • ▸Simplifies complex AWS CDK patterns
  • ▸Great documentation and community

Limitations

  • ▸AWS-only (no multi-cloud)
  • ▸CDK learning curve for beginners
  • ▸Live Lambda mode not ideal for every workflow
  • ▸Deployment speed still depends on CloudFormation
  • ▸Not suited for extremely latency-sensitive workloads

When NOT to Use

  • ▸If deploying to Google Cloud or Azure
  • ▸If app needs <1ms latency
  • ▸If fully offline/edge-only environment
  • ▸If you want Kubernetes-based systems
  • ▸If infrastructure must avoid CloudFormation

Cheat Sheet

  • ▸sst dev - local development
  • ▸sst deploy - production/stage deploy
  • ▸Function -> SST Lambda wrapper
  • ▸Api -> Create API Gateway endpoints
  • ▸Table -> DynamoDB construct

FAQ

  • ▸Can SST be used with Next.js? -> Yes, officially supported.
  • ▸Do I need CDK knowledge? -> Basic understanding helps.
  • ▸Is SST free? -> Yes, fully open-source.
  • ▸Can I use SST without frontend? -> Yes, backend-only is common.
  • ▸Does SST support monorepos? -> Yes, very well.

30-Day Skill Plan

  • ▸Week 1: SST fundamentals + Lambdas
  • ▸Week 2: Storage (S3, DynamoDB, RDS)
  • ▸Week 3: Event-driven apps
  • ▸Week 4: Frontend integration + auth
  • ▸Week 5: Multi-stage deployments + IaC mastery

Final Summary

  • ▸SST is a powerful framework for AWS serverless development.
  • ▸Combines CDK infrastructure with fast development via Live Lambda.
  • ▸Supports APIs, databases, authentication, and full-stack apps.
  • ▸Ideal for cost-effective, scalable, cloud-native workloads.
  • ▸Strong community and ecosystem support.

Project Structure

  • ▸sst.config.ts (entry point)
  • ▸packages/functions (Lambda code)
  • ▸packages/core (shared utilities)
  • ▸stacks/ (infrastructure)
  • ▸frontend/ for UI frameworks

Monetization

  • ▸Build SaaS on serverless
  • ▸Use pay-per-use economics
  • ▸Offer API-based products
  • ▸Sell serverless consulting
  • ▸Create automation tools

Productivity Tips

  • ▸Use `sst dev` extensively
  • ▸Split stacks logically
  • ▸Use SST Console during debugging
  • ▸Leverage CDK patterns
  • ▸Bundle shared libraries with esbuild

Basic Concepts

  • ▸Stacks and constructs
  • ▸Live Lambda Reloading environment
  • ▸Function, API, Table, Bucket constructs
  • ▸Cross-stack linking
  • ▸Deployment stages

Official Docs

  • ▸https://docs.sst.dev/
  • ▸AWS CDK documentation
  • ▸Lambda & API Gateway best practices

Practice Other Languages

CReactPythonC++RustTypeScriptKotlinPHPJavaC#RubyMqlCqlN1qlCypher