Cosmo: Full Lifecycle GraphQL API Management
Are you looking for an Open Source Graph Manager? Cosmo is the most complete solution including Schema Registry, Router, Studio, Metrics, Analytics, Distributed Tracing, Breaking Change detection and more.
We're thrilled to announce the official launch of our Svelte Query Client with Tanstack Svelte Query support for the Svelte ecosystem! 🚀🎉
This new client is built on top of TanStack Svelte Query , and seamlessly integrates the power of WunderGraph into the Svelte ecosystem. Enjoy fully typesafe querying, mutating, and subscribing to your WunderGraph API in Svelte!
🔥 Remember, this release is still in beta! 🔥 Your feedback is invaluable to us! If you have any suggestions or issues, please don't hesitate to open an issue on Github or join the conversation on Discord !
Let's build amazing things together with Svelte and WunderGraph! 🌟
Let's go through quickly how to set it up and how it works.
Install the Svelte Query client:
Svelte Query client provide a set of utilities to connect your APIs with svelte. Before we can use these functions, you need to modify your code generation to include the base typescript client.
wunderctl generate to generate the code.
In SvelteKit, you'll have to keep the generated files under the
Now you can configure the svelte query functions. Create a new file, for example
src/lib/wundergraph.ts and add the following code:
Now, in your svelte layout setup Svelte Query Provider such that it is always wrapping above the rest of the app.
Now you can use svelte-query to call your wundergraph operations!
createQuery (Live query)
You can use the
queryKey helper function to create a unique key for the query in a typesafe way. This is useful if you want to invalidate the query after mutating.
If you are working with SvelteKit, this package provides
prefetchQuery utility to help with SSR
This implementation is based on TanStack Svelte Query's prefetchQuery approach
You can use all available options from Svelte Query with the generated functions. Due to the fact that we use the operationName + variables as key, you can't use the
key option as usual. In order to use conditional-fetching you can use the
You can configure the utilities globally by using the Svelte Query's QueryClient config.
- Svelte Query Client Reference
- Vite + Svelte Example
- SvelteKit with SSR Example
- TanStack Svelte Query
Svelte Query is now officially supported by WunderGraph.
We would love to know more about your experience with Svelte. Do you use Vite, or SvelteKit? How often does your projects require SSR? What do you like about it?
Share it in the comments below or come join us on our Discord server .