Isomorphic URL
import { url } from 'mochi-framework' returns the current URL on both server and client. On the server it reads from the request context; on the client it reads from window.location. Try adding ?name=mochi to the URL.
SSR snapshot (server)
href
https://mochi.fast/demos/url/origin
https://mochi.fastpathname
/demos/url/search
(empty)hash
(empty) never sent to the serverHydrated island (server)
href
https://mochi.fast/demos/url/origin
https://mochi.fastpathname
/demos/url/search
(empty)hash
(empty) never sent to the server<script>
import UrlInfo from './UrlInfo.svelte';
import { files } from './files.ts';
const sources = await loadSources(files);
</script>
<div class="sections">
<UrlInfo label="SSR snapshot" />
<hr />
<UrlInfo label="Hydrated island" mochi:hydrate />
</div>
Styles
<style>
.sections {
display: flex;
flex-direction: column;
gap: 1.2rem;
}
hr {
border: none;
border-top: 1px solid var(--border);
margin: 0;
}
</style>
More demos
Realtime Admin Panel Live admin dashboard with WebSocket updates and server-driven state. Hydratable How hydratable() works — compute a value once on the server and reuse it on the client instead of re-running async work during hydration. Varlock env schemas How schema-validated env works — load a typed .env.schema with Varlock and read coerced, expanded, redacted config through the ENV proxy on every SSR render.