| 1 | > Runtime acceptance is pending the Neon deployment and browser checks; this example is not yet verified on Neon. |
| 2 | |
| 3 | # Neon Website: SvelteKit |
| 4 | |
| 5 | Deploys a real SvelteKit application with `Neon.Website.SvelteKit`. |
| 6 | |
| 7 | A SvelteKit server loader reads `GREETING`. A hydrated counter calls `/api/hello`; `/about` is prerendered. |
| 8 | |
| 9 | ## Infrastructure |
| 10 | |
| 11 | `alchemy.run.ts` uses `Neon.providers()` and `Alchemy.localState()`. |
| 12 | The helper uses the application root by default. Live deployments without explicit |
| 13 | scope own a Neon Project in Ohio (`aws-us-east-2`), including its normal default |
| 14 | database, and a Node 24 Function. The app does not query that database. |
| 15 | No Docker daemon, container registry, or other cloud provider is used. |
| 16 | Pass an existing `project` or `branch` to reuse it without transferring ownership. |
| 17 | |
| 18 | The workspace supplies `alchemy` and `@alchemy.run/frontend-frameworks` through |
| 19 | `workspace:*` dependencies. `@vercel/nft` is installed for Neon artifact tracing. |
| 20 | Install dependencies from the repository root before |
| 21 | running commands in this directory. Authenticate Neon using the Alchemy profile |
| 22 | you intend to deploy with. |
| 23 | |
| 24 | ## Deploy |
| 25 | |
| 26 | ```sh |
| 27 | bun run deploy --profile testing |
| 28 | ``` |
| 29 | |
| 30 | The stack returns `url`. Framework configuration, application sources, and public |
| 31 | assets are included in this example; the Website helper owns the deployment adapter. |
| 32 | |
| 33 | ## Develop |
| 34 | |
| 35 | ```sh |
| 36 | bun run dev |
| 37 | ``` |
| 38 | |
| 39 | This runs the native framework dev server without creating an implicit Website-owned |
| 40 | Neon backend. Explicit backend resources remain live resources. Apply |
| 41 | `Alchemy.remote()` to the Website Effect to deploy a real Function during dev. |
| 42 | Cloud-only `function` and `domain` outputs are absent locally. |
| 43 | |
| 44 | ## Verify |
| 45 | |
| 46 | ```sh |
| 47 | ALCHEMY_PROFILE=testing bun test test/integ.test.ts |
| 48 | ``` |
| 49 | |
| 50 | The integration suite destroys previous stack state, deploys the actual app, |
| 51 | requests its page, dynamic endpoint, verifies the static JSON asset, and destroys the stack. |
| 52 | Set `NO_DESTROY=1` only when intentionally keeping the deployment for inspection. |
| 53 | |
| 54 | For browser validation, open the returned URL. Click **count: 0**; it becomes **count: 1**. Click **Load greeting** and check that the greeting appears below the button. |
| 55 | Every app also serves `/example.json` with a framework label and greeting. |
| 56 | |
| 57 | ## Destroy |
| 58 | |
| 59 | ```sh |
| 60 | bun run destroy --profile testing |
| 61 | ``` |
| 62 | |
| 63 | ## Packaging and security |
| 64 | |
| 65 | The Function receives a deterministic ZIP with a root Fetch `index.mjs`; it is not a |
| 66 | listening server or S3 website. Runtime dependencies are traced with `@vercel/nft`. |
| 67 | Only traced pnpm dependency files are materialized, with Node 24 resolution hooks |
| 68 | preserving canonical package identity. Native addons require Linux/Node 24 validation |
| 69 | and are currently rejected. `.env` files, credential files, and source maps are excluded. |
| 70 | |
| 71 | Framework public environment prefixes are intentionally browser-visible. Keep secrets |
| 72 | out of those variables; `Redacted` protects infrastructure output, not arbitrary |
| 73 | framework build-time substitution. Never put `NEON_API_KEY` in Website `env`. |
| 74 | |
| 75 | Optional `domain` registers a custom hostname and returns `domain.cnameTarget`. |
| 76 | Publish a DNS-only CNAME and verify HTTPS independently; registration is not proof |
| 77 | of certificate readiness. Functions have public URLs, so authenticate private |
| 78 | application routes in the handler. |