On this page
Introduction
SER introduces native-like effect code execution in Svelte for SvelteKit.svelte-effect-runtime is a Vite plugin for SvelteKit that enables native Effect.ts execution on both the client and the server.
+page.svelte
<script lang="ts" effect>
import * as StockCard from "./ticker-card.ts";
import { GetAllStocks, GetLivePrice } from "./tickers.remote.ts";
import { GetUser } from "user.ts";
</script>
<ScrollArea>
{const currency = $derived((yield* GetUser()).preferredCurrency)}
{#each yield* GetAllStocks() as stock}
{const liveQuery = yield* GetLivePrice(stock.ticker)}
{const price = $derived(liveQuery.current ?? stock.initialPrice)}
<StockCard.Root>
<StockCard.Header>{stock.name}</StockCard.Header>
<StockCard.Price>{price} {currency.displayName}</StockCard.Price>
</StockCard.Root>
{/each}
</ScrollArea>If this interests you, or you already use Effect.ts on the backend and want to bring it to the frontend, svelte-effect-runtime is a perfect fit.
Licensing
SER is released under the BSD 3-Clause License, an open-source license approved by the Open Source Initiative and recognized as free software by the Free Software Foundation.
Contributors
Thanks to all the contributors!
Loading contributors...