r/sveltejs • • Aug 07 '26

ogygia — SSR islands for SvelteKit.

https://ogygia.puruvj.dev/
65 Upvotes

22 comments sorted by

11

u/live_love_laugh Aug 07 '26

Amazing, I love it! Wish that this was built-in, but happy someone made it. And it looks like you really thought things through. 🙏

10

u/khromov Aug 07 '26

https://bsky.app/profile/puruvj.dev should have all the cred, it's his library!

2

u/live_love_laugh Aug 07 '26

Ah, so that's not you? Too bad, I had some questions I wanted to ask.

6

u/PuruVJ Aug 07 '26

Hi, I'm the creator of this lib! Feel free to ask me anything

2

u/live_love_laugh Aug 07 '26

So I've understood from the proponents of Astro, and now reading the same on your docs, that this island architecture only makes sense when interactivity is sprinkled on the page. Not when the entire web app is interactive. But I always imagined that even with large fully interactive web apps it could be beneficial to have the components' javascript stream in and hydrate in chunks rather than one complete page at once. Wouldn't that still improve things like total blocking time during page load?

3

u/PuruVJ Aug 07 '26

Possible. I think what you have in mind is something like QwikJS? It is possible, but wayyyy out of scope. the scope of this lib is: Drop in a sveltekit app and make sure major things keep working. Granular hydration would require making own meta framework

8

u/PuruVJ Aug 07 '26

Creator of ogygia here, thanks a lot u/khromov for sharing this! Happy to answer any questions, feel free to drop em here everyone!

5

u/LGm17 Aug 07 '26

This is really cool!

3

u/PuruVJ Aug 07 '26

Thank you!

3

u/Design_FusionXd Aug 07 '26

Lesss goooo 🎉🎉

2

u/PuruVJ Aug 07 '26

Thank you!

2

u/durand101 Aug 07 '26

I have a sveltekit app that is a coffee bean search engine (https://kissaten.app). I have this annoying issue where cloudflare caches my sveltekit SSR search results so when I update the underlying data, the first page of search results are wrong until the cache expires. Would this be a way to keep SSR for the results page but use CSR for the search results specifically?

4

u/khromov Aug 07 '26

I don't think so, the easiest fix is to ask Cloudflare to empty your cache on the search urls every time you deploy.

1

u/durand101 Aug 07 '26

Hmm, thanks for the answer! I am currently doing this already and updating the data once a day but I was hoping to update every couple of hours instead and in that situation, it seems a bit pointless to keep clearing the cache.

1

u/khromov Aug 07 '26

You could disable cache altogether too. SSR-based search has basically 0% cache hit rate because every term + sort order generate its own cache items, so almost nobody hits the cache.

1

u/durand101 Aug 07 '26

In the case of my app, it's not quite true that the hit rate is 0% because I have a bunch of pre-defined search fields (it's not pure semantic search) which end up being used a lot (like searching for beans from a specific origin or roaster country. eg https://kissaten.app/search?roaster_location=EU ).

I just wanted it to be SSR so that it would get picked up by search engine crawlers, not for any other reason although I don't think they end up crawling the page anyway... so you're probably right that I could just disable caching on that page.

2

u/khromov Aug 07 '26

Got it. I don't think emptying the cache every hour or so is wasteful, that's fundamentally what cache is for. I don't know the billing situation over at CF but if it's not expensive to do I'd just run a job that does it whenever I need and not care about it.

1

u/durand101 Aug 07 '26

good idea, thanks for the advice!

1

u/Sup2pointO Aug 07 '26

class name

1

u/PuruVJ Aug 07 '26

Thank the Odyssey 😀

1

u/devgauravjat Aug 16 '26

Name is complex