SvelteKit + Svelte Query Example
The SvelteKit example demonstrates the power of code generation, when it comes to integrating WunderGraph with frontend frameworks like Svelte.
The SvelteKit example uses the WunderGraph Svelte Query package
Configuration
Let's start by configuring WunderGraph.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Define an Operation
1
2
3
4
5
6
7
Use from Svelte
Your operations will be compiled into RPC endpoints. The template will generate TypeScript client, using which we can create Svelte Query client utilities
1
2
3
4
5
6
7
8
9
In Svelte component,
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
SSR
If you are working with SvelteKit, this package provides prefetchQuery
utility to help with SSR
1
2
3
4
5
6
7
8
9
10
This implementation is based on TanStack Svelte Query's prefetchQuery approach