-
-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use Sveltekit and worktop together? #147
Comments
I would build out two separate projects: You could use Worktop directly inside a SK app, but you would likely be using utilities Worktop offers instead of its router, which means you also miss out on all the TypeScript strictness it offers too. This is because SvelteKit is the router and is passing around requests and contexts... the same thing Worktop is doing, The Hope that helps~! |
Yes, that's very helpful input, @lukeed. Thank you! |
Is it possible to use Sveltekit and worktop together? Can anyone point to any example repos?
The only way I can conceptualize approaching this is to create them as separate apps. The worktop (Cloudflare/backend) layer would live on its own (e.g.
api.myapp.com
ormyapp.com/api
) and the Sveltekit layer would live on its own (e.g.myapp.com
). In Sveltekit, all Cloudflare-specific interaction with things like KV would happen via HTTP. Locating the worktop app in a subfolder rather than a subdirectory would reduce the number of HTTP calls needed due to CORs, though it's not clear to me how to actually build it into a subdirectory of the Sveltekit site (maybe a placeholder route-file in Sveltekit would be needed to be the glue between the two?).While that approach should work, would it not be preferable to avoid the extra HTTP calls and access KV directly from Sveltekit (via SSR)? Is this even possible with worktop?
For context, after reading https://blog.cloudflare.com/production-saas-intro/ I was left wondering what the intended/preferred/suggested architecture is when using worktop and Svelte (and I assume Sveltekit) together, though perhaps the idea for https://github.com/cloudflare/production-saas is to use Svelte directly and not via Sveltekit.
BTW: Just finished watching Building Svelte Society: The start of a CMS with Luke Edwards which was a super helpful introduction to worktop. Thanks for the promising work here!
The text was updated successfully, but these errors were encountered: