SvelteKit
Source:
src/AWS/Website/SvelteKit.ts
Deploy a SvelteKit application to AWS: kit’s SSR server on a streaming Lambda Function URL, static assets (prerendered pages included) 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/sveltekit with the
@alchemy.run/frontend-frameworks/sveltekit/aws deploy target (an in-memory
kit adapter emitting a streaming Lambda handler) — both must be
installed in your project.
Creating SvelteKit Sites
Section titled “Creating SvelteKit Sites”Basic SvelteKit App
const site = yield* AWS.Website.SvelteKit("Web", { rootDir: "./app",});Custom Domain
const site = yield* AWS.Website.SvelteKit("Web", { rootDir: "./app", domain: { name: "app.example.com", hostedZoneId: zone.hostedZoneId, },});Server Configuration
Section titled “Server Configuration”const site = yield* AWS.Website.SvelteKit("Web", { rootDir: "./app", memorySize: 2048, env: { API_BASE: api.url, },});Kit Overrides
Section titled “Kit Overrides”Kit options live in the sveltekit(...) call in your vite.config.ts,
which loads natively. The kit prop is a deploy-time override bag
merged over your own options (the prop wins) — useful for per-stage
values the config file can’t compute. JSON-serializable values only.
const site = yield* AWS.Website.SvelteKit("Web", { rootDir: "./app", kit: { paths: { base: "/docs" }, },});