# How the Svelte SDK works

> Follow a SvelteKit request from the catch-all route to the rendered composition, personalization, and visual editing.

Source: https://docs.uniform.app/docs/sdk/svelte/how-it-works

> **Developer preview:**
>
> This feature is in developer preview and may change unexpectedly. For more information, contact support@uniform.dev.

A page request passes through the catch-all route, the project map, the composition renderer, and your component map:

```mermaid
flowchart TD
    A["Visitor requests /about"] --> B["SvelteKit catch-all route"]
    B --> C["+page.server.ts calls createUniformLoad"]
    C --> D["RouteClient resolves path via Project Map"]
    D --> E["Composition data returned to +page.svelte"]
    E --> F["UniformComposition renders component tree"]
    F --> G["componentMap maps each type to a Svelte component"]
    G --> H["UniformSlot renders child components in slots"]
    H --> I["UniformText / UniformRichText enable inline editing"]
    
    style A fill:#e0e7ff,stroke:#4f46e5
    style F fill:#f0fdf4,stroke:#16a34a
    style I fill:#fef3c7,stroke:#d97706
```

1. **A visitor requests a page.** SvelteKit's catch-all route `[...path]/+page.server.ts` receives the request.
2. **The composition is fetched server-side.** `createUniformLoad` from `@uniformdev/canvas-sveltekit` uses `RouteClient` to resolve the URL against the Project Map and fetch the full composition data.
3. **Components render via the composition tree.** `UniformComposition` walks the tree and uses your `componentMap` (or a custom `resolveRenderer`) to map each Uniform component type to a Svelte component. Parameters are flattened and passed directly as props.
4. **Personalization and testing are evaluated.** The `UniformContext` provider evaluates personalization rules and A/B tests either client-side (`standard`) or outputs NESI placeholders for edge evaluation (`edge`).
5. **Visual editing works out of the box.** When previewing in the Uniform dashboard, the SDK automatically enables contextual editing, inline text editing, and live preview via the playground route.
