amplify-react-serverless-components icon indicating copy to clipboard operation
amplify-react-serverless-components copied to clipboard

a trial app to deploy React Server Components inside of a serverless AWS Lambda function, scaffolded using the AWS Amplify CLI

amplify-react-serverless-components

a trial app to deploy React Server Components inside of a serverless AWS Lambda function, scaffolded using the AWS Amplify CLI

image

Context - What are React Server Components?

The main React code and serverless code can be found in /amplify/backend/function/rsc/src.

You can watch the live stream here! https://www.youtube.com/watch?v=VA3TFymZlW4

Live demo: https://m5x7he153l.execute-api.us-east-1.amazonaws.com/dev/rsc/

The main steps are:

  • take https://github.com/pomber/server-components-demo React team demo minus Postgres
  • create a new serverless function from scratch
  • copy over the dependencies
  • copy over the minimal client code
  • copy over the minimal server code and adapt it to a serverless context
  • fix the build script
  • make sure to set nodejs flags and env variables exactly according to the original React team demo
  • Warning: client components dont work in production if you are compiling them on your machine because they use absolute paths (LINK TO DAN ABRAMOV TWEET)0