capri icon indicating copy to clipboard operation
capri copied to clipboard

SSR

Open andreyvolokitin opened this issue 3 years ago • 2 comments

Hello and thanks for this awesome project!

As mentioned in motivation section, Capri fits quite unique set of goals, while alternatives are hard to find. SSR is mentioned as experimental with the focus on SSG. But one popular use-case — ecommerce —actually can benefit hugely from Capri, but it often requires SSR due to a more dynamic nature. Also SSR capability makes Capri even more unique.

Could SSR be made a first-class citizen for Capri?

andreyvolokitin avatar Aug 29 '22 12:08 andreyvolokitin

Yes, it surely could!

You can take a look at these SSR demos to see what's already possible:

  • https://github.com/capri-js/capri/tree/main/examples/cloudflare - The default React example on CF Pages
  • https://github.com/capri-js/capri/tree/main/examples/vercel - The default React example on Vercel
  • https://github.com/fgnass/capri-on-the-edge - Preact SSR demo with Vercel Edge Functions

They all use one of these build targets:

  • https://github.com/capri-js/capri/tree/main/packages/vercel - SSR on Vercel
  • https://github.com/capri-js/capri/tree/main/packages/cloudflare - SSR on Cloudflare Pages

Can you go into detail what exactly Capri would need to in your opinion in order to cover your use case?

fgnass avatar Aug 29 '22 13:08 fgnass

No specific details as of now, but I plan to use Capri for e-commerce site with SSR at unknown deploy target. I looked into vercel/cloudflare examples, and it looks like in order to do SSR at i.e. self-hosted express, one could add a new BuildTarget for this

What I meant by this issue is if SSR functionality is "production ready", because the "experimental" note here: https://capri.build/docs/project-structure/client-entry/

andreyvolokitin avatar Sep 02 '22 21:09 andreyvolokitin

The "experimental" note is now removed and there is a new SSR section in the docs: https://capri.build/docs/ssr/

fgnass avatar Jan 10 '23 07:01 fgnass