pixelmund / svemix

The Full-Stack addition to SvelteKit. Write your server code inside svelte files, handle sessions, forms and SEO easily.
https://svemix.com
MIT License
337 stars 16 forks source link

Prerendering any content #36

Closed eric-burel closed 2 years ago

eric-burel commented 2 years ago

Hi,

I am currently discovering the Svelte ecosystem after a long and deep dive into Next.js, especially it's pre-rendering capabilities.

I am not yet totally convinced, because I feel like SvelteKit is closer to create-react-app, with no server for the pages, than Next.js, that is fully exploiting the fact that the app runs with a Node server, with features such as getServerSideProps (edit: there is an equivalent in SvelteKit though, but I mean things like Image component).

I mean specifically the server that process the request to UI page, not API routes or endpoints. In Next.js this server is usually hidden (you can setup your own but it's not recommended). In SvelteKit it seems to be done via the concept of adapter?

I've designed a pattern that let's you pre-render any kind of data, including private, paid and custom content. However, it requires to have a micro-server in front of the pages, which Next.js have recently introduced with middlewares. As far as I can tell there is no equivalent in SvelteKit, except maybe via a custom adapter (at this point I've only read the doc, not much played with the tool so it's theoretical). Here is the article describing this pattern : https://blog.vulcanjs.org/render-anything-statically-with-next-js-and-the-megaparam-4039e66ffde

Remix takes a slightly different road by relying a lot on HTTP caching. It's kinda equivalent in terms of number of renders, but I am not sure it can be configured to achieve an optimal number of rendering yet.

Is it something that would interest you in the context of Svemix?

pixelmund commented 2 years ago

Hey, i'm not sure.. I think we'll stick to the features SvelteKit provides us for now! Thank you anyway.