ReactJS server

Mladen LotarDevelopment, NodeJS, ReactJS, Star commerceLeave a Comment

reactjs-server

Wait, what?

First of all, we’re aware that ReactJS is not a server but instead library for building interfaces. What do we mean by ReactJS server then? Well, we actually utilized NodeJS to create a fully functional server that will build and serve ReactJS applications.

Why would we do such a thing?

Since we decided to use ReactJS to build STAR Commerce front end application, we wanted to go a step further and allow server side rendering mainly because then neither one of search engines can say that our soon-to-be-created eCommerce platform will not be indexable.

Since we enabled server side rendering, and since we’re talking about distributed systems, we actually decided it would be a good thing to have a server that can accept router configuration as JSON and based of that it will build fully functional ReactJS application based of React components.

Oh, one more thing – it wouldn’t be a server if it would allow hosting of just one application – so we made sure it supports multiple independent ReactJS applications.

Did we complicate things?

It depends. If you want to just allow server side rendering of React templates, then yeah. If you’d like to just utilize React without server side rendering, you’re already guessing here, we have complicated things a bit.

There’s a bit of overhead in the application, but we’re going to make sure things are performant and with small filesize.

But there’s an upside to all of this, and in our opinion it outweighs the “complicated” part. Only complication here is that there are few rules to obey:

  • There’s a defined structure for minimal application
  • Router definition has to be defined in JSON format for now
  • Applications live in specific directory

Now if you think about it, all existing servers (think Apache, Nginx,…) have their rules – so it’s not that bad.

Can you check it out?

Of course you can – and we even encourage you to do so. Here’s a link to ReactJS server that you can use out of the box.

Leave a Reply

Your email address will not be published. Required fields are marked *