Skip to content

TanStackStart

Source: src/AWS/Website/TanStackStart.ts

Deploy a TanStack Start application to AWS: the SSR server on a streaming Lambda Function URL, client assets in S3, and a CloudFront distribution whose edge router serves uploaded files from S3 and forwards everything else to the server.

The build runs through @alchemy.run/frontend-frameworks/tanstack-start with the @alchemy.run/frontend-frameworks/tanstack-start/aws deploy target — both must be installed in your project, alongside @tanstack/react-start (or @tanstack/solid-start) and vite.

Your vite.config.ts needs no adapter wiring: TanStack Start is pure Vite, so the integration drives the project’s own vite build, forces the SSR bundle to be self-contained, and wraps its fetch handler as a streaming Lambda handler.

Basic TanStack Start App

const site = yield* AWS.Website.TanStackStart("Web", {
rootDir: "./app",
});

Custom Domain

const site = yield* AWS.Website.TanStackStart("Web", {
rootDir: "./app",
domain: {
name: "app.example.com",
hostedZoneId: zone.hostedZoneId,
},
});

Tune The Server Function

const site = yield* AWS.Website.TanStackStart("Web", {
rootDir: "./app",
memorySize: 2048,
env: {
API_BASE: api.url,
},
});

Read An Environment Variable From A Server Function

src/routes/index.tsx
const getApiBase = createServerFn({ method: "GET" }).handler(() => ({
apiBase: process.env.API_BASE,
}));
const router = yield* AWS.Website.Router("FrontDoor", {});
const site = yield* AWS.Website.TanStackStart("Web", {
rootDir: "./app",
domain: { router },
});