Hey all! š Iām Ryo, a Sr. Design Technologist at PlayStation. I do web dev with React/TS/Node and game dev with Unity/C#/C++/OpenGL/DirectX. Feel free to ask me any questions! š¤
It's not required to run React server-side, or use a server at all.
You can compile React into a SPA, or single page application, using create-react-app that accomplishes this. Or use a static site generator (NextJS, GatsbyJS, etc) to create HTML/JS pages for each route. You can even just create static HTML/JS files yourself and import the external React library (if you're comfortable writing non-ES6 React, or run your own build process).
Then you can deliver your entire website through a CDN, rather than relying on an Express server.
The only limitation with this setup is the inability to hide any code from the client-side, like API secret keys, which is where you'd need a "middleman" API server. Even if you needed to leverage this down the line, there are lots of static sites nowadays that accomplish things like user auth using specialized hosts (like Netlify) or a separate API / microservice / 3rd party service.
And if you're into GraphQL, I'd also consider looking into implementations like Apollo or Relay, since they do a fantastic job of fetching the exact data components need.
But as long as all your client-side code is cool to be public, you don't need a server at all š Welcome to the JAMstack revolution š
It's not required to run React server-side, or use a server at all.
You can compile React into a SPA, or single page application, using create-react-app that accomplishes this. Or use a static site generator (NextJS, GatsbyJS, etc) to create HTML/JS pages for each route. You can even just create static HTML/JS files yourself and import the external React library (if you're comfortable writing non-ES6 React, or run your own build process).
Then you can deliver your entire website through a CDN, rather than relying on an Express server.
The only limitation with this setup is the inability to hide any code from the client-side, like API secret keys, which is where you'd need a "middleman" API server. Even if you needed to leverage this down the line, there are lots of static sites nowadays that accomplish things like user auth using specialized hosts (like Netlify) or a separate API / microservice / 3rd party service.
And if you're into GraphQL, I'd also consider looking into implementations like Apollo or Relay, since they do a fantastic job of fetching the exact data components need.
But as long as all your client-side code is cool to be public, you don't need a server at all š Welcome to the JAMstack revolution š
The code will be open source, so perfect