Create FasterCreate Faster

SST

SST Ion deploys your applications to AWS with zero-config infrastructure using Pulumi under the hood.

Dependencies

→ SST Documentation

What create-faster adds

A ready-to-deploy SST Ion configuration with stack-aware resource mapping and TypeScript environment augmentation.

Files created:

sst.config.ts               # SST Ion configuration with per-app resources
sst-env.d.ts                # TypeScript augmentation for SST env variables

sst.config.ts

The configuration maps each app to the appropriate SST component based on its stack:

  • Next.js apps use sst.aws.Nextjs with optimized OpenNext deployment
  • Hono apps use sst.aws.Function with url: true, pointing to src/index.handler, and environment: { NODE_ENV: $dev ? 'development' : 'production' }: the Lambda never runs the start script, which sets NODE_ENV otherwise
  • TanStack Start apps use sst.aws.TanStackStart (Lambda server function, S3 assets bucket and CloudFront)

In a turborepo, each app's path or handler is prefixed with apps/{appName}/.

A Hono app's src/index.ts exports that handler (handle(app) from hono/aws-lambda) whenever the deployment is SST, so the AWS Lambda module is not needed. The entry keeps app as its default export, so dev and start still serve the app with Bun.

sst.aws.TanStackStart requires the Nitro aws-lambda preset. The generated config sets it through environment: { NITRO_PRESET: 'aws-lambda' }: SST passes that environment to its build command, so the app's own build script, vite.config.ts and start keep the default node-server output. SST also adds the environment to the deployed Lambda's runtime environment and to the sst dev command; both are harmless (Nitro falls back to its dev preset in dev).

Runtime secrets

An app deployed by SST gets no .env file, so every runtime secret it reads is declared as an sst.Secret and passed to the app as the environment variable of the same name:

const secrets = {
  DatabaseUrl: new sst.Secret('DatabaseUrl'),
  BetterAuthSecret: new sst.Secret('BetterAuthSecret'),
};

const web = new sst.aws.Nextjs('web', {
  environment: {
    DATABASE_URL: secrets.DatabaseUrl.value,
    BETTER_AUTH_SECRET: secrets.BetterAuthSecret.value,
  },
});

The code keeps reading process.env.DATABASE_URL, locally from .env and on AWS from the environment SST sets. Linking the secret (link: [secret]) would expose it only through Resource.DatabaseUrl.value of the sst package, never as an environment variable, so the generated config does not link it.

The secrets declared are the variables the apps receive that cannot live in the repo: the database connection string (postgres and mysql), BETTER_AUTH_SECRET and BETTER_AUTH_URL with Better Auth, PRIVY_APP_SECRET with the dApp (Privy) blueprint. Each app receives only the ones it reads. A project without any declares no sst.Secret.

SST fails sst deploy and sst dev until every secret has a value for the stage:

npx sst secret set DatabaseUrl "postgresql://user:password@host:5432/db?sslmode=verify-full" --stage production
npx sst secret set BetterAuthSecret "$(openssl rand -base64 32)" --stage production

The secret name is the variable name in PascalCase (DATABASE_URL becomes DatabaseUrl). In CI, export SST_SECRET_DatabaseUrl before sst deploy instead. --fallback sets a value that every stage without its own uses, which suits PR stages.

BETTER_AUTH_URL is the URL the app is served at: set it once the first deploy has printed the CloudFront URL (or to your custom domain), then deploy again.

The values are encrypted in the state file and stored encrypted in an S3 bucket of your AWS account. They reach the function as environment variables, and, for Next.js and TanStack Start, the environment of the build command. A NEXT_PUBLIC_* or VITE_* value is never a secret: the browser bundle embeds it at build.

The config includes:

  • Stage-aware removal policy: retain in production, remove in other stages
  • AWS as the default provider
  • URL outputs for each deployed app

sst-env.d.ts

Type augmentation file that enables typed access to SST-linked environment variables via import "sst".

.gitignore

The .sst/ directory is added to .gitignore.

tsconfig.json

In a single repo the Next.js and Expo tsconfig.json exclude .sst and sst.config.ts, so tsc and next build neither need sst install nor compile the SST platform sources it writes into .sst/ (about 600 type errors of their own). SST bundles sst.config.ts itself and does not type-check it; your editor gets its types from .sst/platform/config.d.ts once sst install (run by sst dev and sst deploy) has generated it. In a turborepo the app sits in apps/<app> and its tsconfig.json is unchanged.

CLI usage

bunx create-faster myproject \
  --app myproject:nextjs \
  --deployment sst \
  --pm bun

Multi-app example:

bunx create-faster my-saas \
  --app web:nextjs:shadcn \
  --app api:hono \
  --deployment sst \
  --database postgres \
  --orm drizzle \
  --pm bun

Deploy with:

export AWS_PROFILE=my-profile AWS_REGION=eu-west-3
npx sst install
npx sst deploy --stage production

First deploy

The generated README.md has a "Deploying to AWS (SST)" section, in order: the AWS credentials and region, sst install, an optional sst dev, the secrets, sst deploy --stage, and where the URLs are printed (.sst/outputs.json). With the Lambda (SST) blueprint it ends with the GitHub Actions setup.

  • SST reads the profile from AWS_PROFILE (which overrides a profile in sst.config.ts) and the region from AWS_REGION. With no region, it deploys to us-east-1. See IAM credentials.
  • sst.config.ts uses the $config global that sst install declares in .sst/platform/config.d.ts, so a tsc run at the root of a turborepo fails with Cannot find name '$config' until sst install has run. sst dev and sst deploy run it themselves.
  • The first sst dev or sst deploy in an AWS account and region bootstraps SST there, once.

On this page