csaintc

csaintc

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!

Showing Posts 1 to 6

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 GitHub - revelrylabs/elixir_react_render: React SSR Framework for Elixir · GitHub

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.

OvermindDL1

OvermindDL1

Oh that’s cool!

kokolegorille

kokolegorille

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

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

GitHub - revelrylabs/elixir-nodejs: An Elixir API for calling Node.js functions · GitHub

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

— All posts loaded —

Where Next? Top

Trending in Questions Top

stjefim
Hello! Suppose you are building workflow (order / task / payment) processing system with the following requirements: Each workflow con...
New
jonnycharles
I’m in search of an Elixir library that offers PDF generation capabilities similar to Ruby’s Prawn. While there have been discussions abo...
New
spammy
I’m looking to build a personal workflow to quickly deploy web applications written in elixir/phoenix, for local consumption (ie not on t...
New
Blokh
Hey guys, I’ve got a huge CSV ( around 10 GB ) that needs to be processed hourly Do you guys have any suggestions what is the best prac...
New
dli
Before I dive in myself, did anyone successfully sprinkle Hologram into their existing LiveView app? Looking for hints regarding: Addi...
New
roeland
Kia ora, We have been using elixir-google-api to connect to Google Drive. However, with the updates to Tesla due to CVEs this is now bro...
New
subsaharancoder
I’ve followed the Phoenix LiveView file upload code here Uploads — Phoenix LiveView v1.0.0-rc.7 and so far everything works just fine wit...
New

Other Trending Topics Top

JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New
wintermeyer
There are three potential reasons for members of this forum to have a look at https://vutuv.de You are tired or annoyed of LinkedIn. Yo...
New

Latest on Elixir Forum

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews