Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
public
src
.gitignore
README.md
package.json
yarn.lock

README.md

Server side rendering with create-react-app

This is an example of a react application bootstrapped with create-react-app and hosted on Stormkit.io.

Demo

The working examples can be seen here: with SSR enabled and with only client-side.

Steps to reproduce

These are the steps to reproduce this app.

Local machine

Replace <your-app-name> and <your-repo-url> with your values.

create-react-app <your-app-name>
cd <your-app-name>
touch src/server.js # You can copy src/server.js in this repository
git add .
git commit -m "Enable ssr"
git remote add origin git@<your-repo-url>
git push -u origin master

Stormkit UI

  • Login to app.stormkit.io
  • Create a new app and connect the repository pushed above.
  • Select production environment and edit it with the following values:
Setting Value Description
Entry src/server.js The server side entry file. The path is relative to project root.
Dist folder build The public folder which contains build artifacts.
Build command yarn build The client side build command.
Environment variables NODE_ENV=production The environment variables that will be passed both to client side and server side.

If you don't need server side rendering, simply leave the Entry configuration empty. This way your files will be automatically served from CDN and no server invocation will be made.

Happy coding!

You can’t perform that action at this time.