SST

repository·dev·Indexed 12 days ago

https://github.com/anomalyco/sst

A framework that allows developers to build full-stack applications on their own infrastructure, providing tools to deploy and manage cloud resources alongside application code. It includes a CLI, a Python SDK (sst-sdk) for accessing linked resources in Lambda functions, and support for v3.

Tokens
123.1K
Snippets
457
Records
602
Agent score
97%

What's inside SST

  1. Key changes in SST v2

    dev

    SST v2 introduces several architectural and developer experience improvements over v1. Key changes include:

    • Monopackage Migration: The package name has changed from @serverless-stack to simply sst.
    • New Configuration Format: SST now uses a .js configuration file instead of a .json file (similar to Vite).
    • Functions API Refactor: The props in the SST Functions construct have been refactored.
    • Improved Type Generation: The codegen process for types has been reworked for better developer experience.
    • Package Manager Support: Full compatibility with pnpm.
    • Enhanced CLI: Includes a new CLI UI for better visibility into CLI operations and a refactored, faster codebase.
    • Performance Improvements: Faster Live Lambda Dev via a new debug stack infrastructure.
    • Frontend Framework Support: New constructs for Astro and Solid.
    • OpenNext: A new open-source initiative to enable Next.js applications to run on AWS with Vercel-like behavior.
  2. What is an active resource in SST Console?

    dev

    An active resource is any resource created by SST in your cloud provider. This includes:

    • Resources from SST built-in components (e.g., Function, Nextjs, Bucket).
    • Resources created by any other Terraform or Pulumi provider.

    Note: Complex components like Nextjs or StaticSite may create multiple resources.

    Criteria for being 'Active'

    • A resource is active if the stage it belongs to has been updated during the billing cycle.
    • If the only update to a stage was to remove it, those resources are not counted as active.
    • PR/Ephemeral Stages: A stage must exist for at least 2 weeks before its resources are counted as active. If a PR stage is created and removed within 2 weeks, it does not count toward your billing.
  3. What is Autodeploy and how does it work?

    dev

    Autodeploy is a deployment workflow designed specifically for SST apps. Unlike generic CI/CD tools like GitHub Actions or CircleCI, Autodeploy offers several SST-native advantages:

    1. Native Workflow Support: It supports branch and Pull Request (PR) workflows out of the box.
    2. SST Configuration: You customize your deployment workflow directly within your sst.config.ts.
    3. AWS Account Integration: Builds run directly within your own AWS account, allowing them to utilize your VPC and other AWS resources.

    It integrates seamlessly with the rest of the SST Console for monitoring and management.

  4. What is SST and how does it work?

    dev

    SST is a framework for building full-stack applications where the entire application—including databases, buckets, queues, and frontends—is defined in code within a single sst.config.ts file.

    SST uses Components to represent application features. These components automate the creation of infrastructure in your cloud provider (like AWS or Cloudflare) without requiring manual configuration in a web console. SST is built on top of Pulumi and supports over 150 providers, including Vercel and Stripe.

  5. What is SST Ion?

    dev

    Ion is the code name for a new deployment engine for SST applications. Unlike previous versions of SST that were based on AWS CDK and CloudFormation (CFN), Ion uses Terraform providers to define constructs (components) and Pulumi for deployment.

    Key Differences for Developers:

    • No CDK Support: You cannot use existing CDK constructs in Ion; components must be migrated to the new engine.
    • Component Parity: While the underlying engine is different, the way components look and feel is intended to remain similar to the current SST experience.
    • Open Source: Ion will remain completely open source.
    • Future Versioning: Once Ion reaches stability, it will be released as SST v3.
  6. What is OpenAuth?

    dev
    OpenAuth is a universal, standards-based authentication provider built on top of OAuth 2.0. It is designed as a single-page app that can be deployed anywhere (Node.js, Bun, AWS Lambda, or Cloudflare Workers) and can function as either a standalone service or be embedded into existing applications. Because it follows the OAuth 2.0 specification, any standard OAuth client can interact with it.
  7. Understand SST state and management

    dev

    SST maintains a state of your app, which is a tree of all resources and their properties. This state is stored locally and backed up to a bucket in your cloud provider account.

    Important Safety Rules:

    • Do not delete the state bucket: If you lose your state, SST can no longer manage your resources and you will have to manually re-import them.
    • Do not manually modify low-level resources: Making manual changes in the AWS/Cloudflare console causes your infrastructure to go 'out of sync' with your SST state. You can attempt to fix this with sst refresh, but manual changes should be avoided.
  8. Create multiple provider instances for multi-region deployments

    dev

    By default, SST creates one instance of each provider using default settings. You can create additional instances of a provider using the new <provider>.Provider() constructor. This is essential for multi-region or multi-account deployments where specific resources must reside in a different location than your default stack.

    // Create a specific instance for us-east-1
    const useast1 = new aws.Provider("useast1", { region: "us-east-1" });
    
    // Deploy a resource to that specific provider instance
    new aws.acm.Certificate("cert", {
      domainName: "foo.com",
      validationMethod: "EMAIL",
    }, { provider: useast1 });