Recommended Project structure for Pages + Durable Objects + ..
So im currently running into the issue that i cant really get sveltekit + durable objects up.
I used the cf starter cli for sveltekit that worked all fine. but as soon as i add the do binding and run dev again i get no response.
I have a DoClass exported somewhere in my project but i feel like its just wrong.
I found this repo. In his case he splits the Pages with the Worker based things (monorepo). Is this the recommended approach?
https://github.com/harshil1712/votes-app-demo
GitHub
GitHub - harshil1712/votes-app-demo: A live voting app built with C...
A live voting app built with Cloudflare Durable Objects and SvelteKit - harshil1712/votes-app-demo
5 Replies
Let me rephrase for simplicty.
If i have a SvelteKit dir working using Pages.
What steps do i need to bind a DO to some file inside the project and still have wrangler pages dev work/spin up both
The cli does say i should start the DO manually but if i try to run wrangler dev it says im in a pages project
You can't. Pages doesn't support exporting a Durable Object Class. Instead, I would go with a SvelteKit Worker
yea i see. Sveltekit worker sadly fails when i have +server.ts files.
i guess i gotta do some manual work to make it easy
after going through some github discussions and everything this seems like a way of doing it too
https://github.com/dario-piotrowicz/sveltekit-durable-object-local-usage-example/tree/main
GitHub
GitHub - dario-piotrowicz/sveltekit-durable-object-local-usage-example
Contribute to dario-piotrowicz/sveltekit-durable-object-local-usage-example development by creating an account on GitHub.
1 repo and you just deploy each app folder via cli or ci/cd i guess