@platform/react.ssr
v1.1.171
Published
A lightweight SSR (server-side-rendering) system for react apps bundled with ParcelJS and hosted on S3.
Readme
A lightweight SSR (server-side-rendering) system for react apps bundled with ParcelJS and hosted on S3.
Live Demo:
https://ssr.platform.uiharness.com
Highlights:
- Store assets on S3 (or Digital Ocean Spaces).
- Serve entry HTML from server (immediate load from "server-side-render").
307redirect all other assets to S3/CDN (geo-edge cache).- Manage lifecycle with simple command-line tools:
- Bundle and push to S3 via command-line.
- Manage versioned releases (with simple roll-backs) across multiple sites/environments.
(eg.dev,staging,prod)

Setup
yarn add @platform/react.ssrWorkflow
Develop UI components on local dev-server within the UIHarness or anything that can produce a javascript bundle (eg ParcelJS):
Ensure the UI module has a
bundlescript within it'spackage.json.Create an
ssr.ymlconfiguration file for the server.
Sample
The /sample/now and /sample/server are expecting a .env file with your S3 account information:
#
# Digital Ocean "SPACES" or AWS "S3" connection secrets.
#
SPACES_KEY="..."
SPACES_SECRET="..."
These are referenced within the ssr.yml config file.
Example sequence:
🌼
cd sample/ui
yarn startBundle a version and push it to S3:
🌳
cd sample/server
yarn ssr bundleRelease bundled version by updating manifest:
🌳
cd sample/server
yarn ssr releaseStart local SSR server to test the bundle:
🌼
cd sample/server
yarn startOpen in http://localhost browser (address/port exposed in server startup log).
Routes
The following system routes are exposed for examining meta-data about the current state and configuration of the server.
https://domain.com/.manifest
https://domain.com/.manifest/summary
https://domain.com/.manifest/summary/<site>
