plentico / plenti

Static Site Generator with Go backend and Svelte frontend

Home Page:https://plenti.co

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can SSR be enabled with V8 engine?

maietta opened this issue · comments

Another project somewhat similar, called "Bud" (see https://github.com/livebud/bud), can let you serve a Svelte frontend with a Go backend.

It's my understanding that SSR is handled by Go via the V8 engine.

Could this project be adapted to do something similar? I don't know if that would make sense for this project but I'm throwing that out there.

I'm looking for ways to run my Svelte node apps purely from a compiled Go binary. I guess these tools replace the need for SvelteKit, which is the part I think I'm missing in my mental gymnastics n the subject.

If you want on-demand rendering (building the page when a request comes to your app), something like Bud is the way to go. Currently Plenti only handles build-time rending (building all the pages before the app is deployed) for "Jamstack" style websites. In other words, it usually runs in CI to produce static HTML and then gets entirely out of the way (the HTML gets deployed to your host, but the Plenti binary never does). So Plenti actually does SSR currently (we do it in V8 as well), it just does it during the build process.

Matt (the creator of Bud) and I talk about this problem space fairly often, we'd also like solve the problem you're posing here. Doing things in V8 works, but is challenging for several reason (e.g. requires CGO which makes cross compiling hard, doesn't support concurrency, has performance and debugging issues). Ultimately a UI compiler written in Go would allow you to write reactive frontends in a single binary without dependencies and performance issues - it's just a large undertaking to create something like this.

Is there a particular reason something like Bud isn't working for your project?

Thank you.