csaintc

csaintc

Isomorphic ReactJS managed by Elixir

Hey friends!

My company runs a single page app, and it is a hard requirement that we do isomorphic rendering for our front end.

Our back-end is implemented in Elixir. I was thinking it might be nice to cut out the middle man and use Elixir to isomorphically render our reactjs application on our elixir back-end.

Are there any libraries, conference talks, etc. you can point me to that could be helpful?

Thanks a bunch!

Most Liked

bryanjos

bryanjos

Just chiming in to say that lib does pretty much what @OvermindDL1 said. Having elixir apps supervise node processes makes things so much more pleasant in development and production.

We also have another related lib that is for node interaction in general

https://github.com/revelrylabs/elixir-nodejs

Eventually we will have the react render lib implemented using that one hopefully

kokolegorille

kokolegorille

Just for information, there is a post abour react_render from the author here…

OvermindDL1

OvermindDL1

Unsure about libraries but it would be pretty easy to do, just setup a Port to a nodejs app that talks over it’s stdin/stdout to your main server, and anytime you need to render out a page then send a JSON of data over stdin and get the page data back (I’d recommend tagging with an ID so you could interlace commands for faster speed if you get nodejs running multicore). It’s the standard BEAM way to talk to external apps like that. :slight_smile:

Now if you want to toss out React and use something else that is better suited, there are tons of options, though it sounds like you might already be tied to react and if you want to ‘isomorphicaly’ use react then a Port is the way to do it, essentially just using react-in-node ‘as’ your template system (no where near as fast as elixir templates, but if you want it ‘isomorphic’ then that’s how to do it). :slight_smile:

tme_317

tme_317

There is a library that does basically what @OvermindDL1 suggests for server-side React rendering in a pool of nodejs workers orchestrated by Elixir! Check out https://github.com/revelrylabs/elixir_react_render

namelos

namelos

Another way to achieve this is to use Node.js server in front of Elixir back-end.

When browser request for index page just returns a fully rendered string, the fetching data just from Elixir back-end. Use isomorphic fetch to make sure the components are also executing well in the Node server. All the API will be called from the browser directly goes to Elixir back-end through Nginx or Ingress etc.

If you are using GraphQL there’s a term named schema stitching, which let you merge back-end schema to the current server.

Where Next?

Popular in Questions Top

aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
New
Werner
Hi, I’m using Ubuntu 18.04 and after updating to OTP-24.0 yesterday i have this warning when I run “mix local.hex”: 14:57:30.512 [warn] ...
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
stefanluptak
Hello everybody, usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
hpopp
To simplify some tasks at work, I wrote and published this package yesterday. It’s a simple macro that enables Access behaviour on struct...
New
Fl4m3Ph03n1x
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: ) Hello all, this is ...
New
sabri
Can someone explain the settings of pool_size of Ecto in config file? and what is the recommend size? Thanks
New

Other popular topics Top

nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
script
If I have a string “1000 cfu/ml” . I want to remove the characters and / and space . So the string is like this "1000" What is the ...
New
rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list....
New
qwerescape
Is there a way to get the call stack or stack trace at any point in the code? Not from exceptions, but an expression that returns how the...
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
stefanluptak
Hello everybody, usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers' Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
magnetic
Hey :wave:t3: Elixir community, I’ve been learning Elixir, and working on some side projects. My editor of choice is VSCode, and althoug...
New

We're in Beta

About us Mission Statement