| 1 | # AWS Website: SvelteKit |
| 2 | |
| 3 | Deploys a SvelteKit app to AWS with `AWS.Website.SvelteKit` — no `svelte.config.js` adapter, no CDK. |
| 4 | |
| 5 | The resource builds the app with SvelteKit's own Vite pipeline and a wrangler-free in-memory AWS adapter, deploys the server output on a streaming Lambda Function URL, and serves client assets + prerendered pages from S3 behind CloudFront. Values passed via `env` are exposed to server routes through `process.env`. |
| 6 | |
| 7 | ```ts |
| 8 | const site = yield* AWS.Website.SvelteKit("SvelteKitSite", { |
| 9 | env: { |
| 10 | GREETING: "Hello from SvelteKit on AWS!", |
| 11 | }, |
| 12 | }); |
| 13 | ``` |
| 14 | |
| 15 | ## Commands |
| 16 | |
| 17 | ```sh |
| 18 | bun alchemy deploy # build + deploy |
| 19 | bun alchemy dev # SvelteKit's Vite dev server (Node SSR, HMR) |
| 20 | bun alchemy destroy # tear down |
| 21 | ``` |
| 22 | |
| 23 | ## Notes |
| 24 | |
| 25 | - `@alchemy.run/frontend-frameworks` must be installed in the project — the server's source provider is loaded from its `/sveltekit` export at deploy time. |
| 26 | - Unchanged projects skip the build and deploy entirely (the project tree is content-hashed, respecting `.gitignore`). |
| 27 | - In `alchemy dev`, the site is kit's own Vite dev server (plain Node SSR) — already the AWS Lambda programming model, `process.env` included. No cloud resources are created; wrap the site in `Alchemy.remote()` to deploy the real infrastructure even during dev. |