Serverless React SSR on AWS

This page summarizes the projects mentioned and recommended in the original post on dev.to

Our great sponsors
  • SurveyJS - Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • esbuild

    An extremely fast bundler for the web

  • return { plugins: [ ignorePlugin({ ignore: ['server'] }), cssPlugin({ excludeCSSInject: true, onCSSGenerated: args.onCSSGenerated, }), pnpPlugin(), ], bundle: true, external: [ 'aws-sdk', // included in Lambda runtime environment ], minify: true, platform: 'node', format: 'cjs', target: 'node16.0', treeShaking: true, define: { 'process.env.NODE_ENV': '"production"', }, // see https://github.com/evanw/esbuild/issues/2377 sourcemap: true, metafile: false, };

  • react-ssr

    React Server-Side Rendering (SSR) (by goldstack)

  • However, if you want to give this for a spin, head over to Goldstack and select the Server-Side Rendering template. Alternatively, you can also clone the react-srr repository which is automatically kept in sync with the template.

  • SurveyJS

    Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.

    SurveyJS logo
  • goldstack

    Templates and boilerplates for fullstack projects customised to your needs.

  • Thus, I started the process of developing a server-side rendering friendly template a few months ago. I released this template a while ago and have since also completed the implementation of the new version of my blog. This post contains my experiences and learnings from this process.

  • terraform

    Terraform enables you to safely and predictably create, change, and improve infrastructure. It is a source-available tool that codifies APIs into declarative configuration files that can be shared amongst team members, treated as code, edited, reviewed, and versioned.

  • Thus I opted for using Terraform to define the infrastructure. See all required Terraform configuration in infra/aws.

  • maxrohde-web

    My websites

  • See below all the routes I have defined for my blog:

  • Gatsby

    The best React-based framework with performance, scalability and security built in.

  • After Wordpress has been annoying me for years, I decided after long hesitation to migrate my blog Code of Joy away from Wordpress. After searching through many available options (including different blog hosting platforms and static rendering solutions such as Gatsby), I decided that the best option for me would be to implement my own custom blog.

  • webpack

    A bundler for javascript and friends. Packs many modules into a few bundled assets. Code Splitting allows for loading parts of the application on demand. Through "loaders", modules can be CommonJs, AMD, ES6 modules, CSS, Images, JSON, Coffeescript, LESS, ... and your custom stuff.

  • This can be achieved with most JavaScript bundlers such as Webpack, Rollup or esbuild.

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
  • css-modules

    Documentation about css-modules

  • This configuration uses both the esbuild-css-modules-client-plugin and the esbuild-ignore-with-comments-plugin. The former is used to support CSS modules and the latter is used to ensure no files are included in the bundle that are only required on the client.

  • Tailwind CSS

    A utility-first CSS framework for rapid UI development.

  • ✔ Easily extensible; used Tailwind CSS for styling of the blog which required to customise the build process.

  • Preact

    ⚛️ Fast 3kB React alternative with the same modern API. Components & Virtual DOM.

  • 🤔 React makes the Lambdas and client-side bundles heavier than I would like them to be. Possibly need to explore using Preact.

  • Next.js

    The React Framework

  • Server-side rendering (SSR) of React applications has become increasingly popular in the past few years. Frameworks such as Remix and Next.js have demonstrated that rendering pages on the server with React is an effective way to compose applications.

  • Express

    Fast, unopinionated, minimalist web framework for node.

  • Thus I wanted to ensure that my approach allows for easy local testing. For this, I opted to use a simple Express server that serves the routes and static files locally.

  • aws-lambda-java-libs

    Official mirror for interface definitions and helper classes for Java code running on the AWS Lambda platform.

  • I decided to define an architecture as follows: A CloudFront Distribution functions as the initial ingress to the application. Static files are served through AWS S3. For each defined route we define a Lambda function and an AWS HTTP API Gateway is used to route traffic to the correct lambda:

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts