unstubbable / mfng

A Minimal React Server Components Bundler & Library
https://mfng.unstubbable.workers.dev
MIT License
426 stars 14 forks source link

[Doubt] Can i deploy react app with static build and serverless react components? #81

Open useEffects opened 1 week ago

useEffects commented 1 week ago

We are exactly looking for this approach

using an AWS Lambda Function, with AWS CloudFront as CDN

I am skimming through the aws-app code and I couldnt find where you are building the react app as a static export, you are only deploying the entire application to a lambda, which we are not looking for. We are looking for deploying the react app as a bundle in CDN, power the react server components through lambda functions.

useEffects commented 1 week ago

I really think what we are looking for is possible through this repo :)

unstubbable commented 1 week ago

MFNG does not offer a static export of pages as it does not have a concept of file-based routes. The static client assets as well as the server-side rendered responses can be cached in a CDN though, which the AWS example app has configured in https://github.com/unstubbable/mfng/blob/main/apps/aws-app/cdk/stack.ts.

useEffects commented 1 week ago

We are looking for an SPA static export with RSC, the RSC not only be bundled at build time, but the RSC components should be hydrated through serverless functions.

useEffects commented 1 week ago

if you couldnt figure out what I am trying to look for, please let me know :)

unstubbable commented 1 week ago

Statically built RSC components don't need serverless functions to be hydrated. You only need a CDN and a browser to accomplish that. But again, MFNG does not offer a static build of RSC components. Instead, it needs a request handler (e.g. a serverless function) to render them at request time (in case of a CDN cache MISS). If you're looking to create fully or partially static RSC output at build time, I recommend using Next.js.

useEffects commented 1 week ago

we dont want static build of RSC components either, I will play with the repo for now and let you know if this can fulfill our requirements. Next.js is out of our scope because we only want static export of a single react component and deploy it in CDN which later can be used in html pages.