All Projects → musawirali → preact-rpc

musawirali / preact-rpc

Licence: MIT license
React Pre-Rendering via RPC

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to preact-rpc

stimulus reflex
Build reactive applications with the Rails tooling you already know and love.
Stars: ✭ 2,001 (+7046.43%)
Mutual labels:  server-side-rendering, ruby-on-rails
Cable ready
CableReady completes the ActionCable story and expands the utility of web sockets in your Rails app
Stars: ✭ 489 (+1646.43%)
Mutual labels:  server-side-rendering, ruby-on-rails
stimulus todomvc
[WIP] An implementation of TodoMVC using Ruby on Rails and StimulusJS
Stars: ✭ 14 (-50%)
Mutual labels:  server-side-rendering, ruby-on-rails
Stimulus reflex
Build reactive applications with the Rails tooling you already know and love.
Stars: ✭ 1,928 (+6785.71%)
Mutual labels:  server-side-rendering, ruby-on-rails
Matestack Ui Core
Matestack enables you to create sophisticated, reactive UIs in pure Ruby, without touching JavaScript and HTML. You end up writing 50% less code while increasing productivity, maintainability and developer happiness.
Stars: ✭ 469 (+1575%)
Mutual labels:  server-side-rendering, ruby-on-rails
stimulus reflex todomvc
An implementation of TodoMVC using Ruby on Rails, StimulusJS, and StimulusReflex
Stars: ✭ 50 (+78.57%)
Mutual labels:  server-side-rendering, ruby-on-rails
active-date-range
Powerful DateRanges for Ruby and ActiveSupport
Stars: ✭ 38 (+35.71%)
Mutual labels:  ruby-on-rails
zbus-server
Small fast MQ and RPC
Stars: ✭ 73 (+160.71%)
Mutual labels:  rpc
qtalk-go
versatile stream IO and RPC based IPC stack for Go
Stars: ✭ 29 (+3.57%)
Mutual labels:  rpc
coreipc
WCF-like service model API for communication over named pipes and TCP. .NET and node.js clients.
Stars: ✭ 22 (-21.43%)
Mutual labels:  rpc
alef-component
Alef Component for Modern Web Apps.
Stars: ✭ 46 (+64.29%)
Mutual labels:  server-side-rendering
has placeholder image
A Ruby gem for generating string based placeholder images in Rails.
Stars: ✭ 20 (-28.57%)
Mutual labels:  ruby-on-rails
gist-blog-ssr
Build a server rendered Vue.js blog with Nuxt and Vuex using API Gist as backend
Stars: ✭ 58 (+107.14%)
Mutual labels:  server-side-rendering
universal-react-webpack-boilerplate
unireact - quickly bootstrap your universal react-app
Stars: ✭ 27 (-3.57%)
Mutual labels:  server-side-rendering
http
Extension module of golang http service
Stars: ✭ 57 (+103.57%)
Mutual labels:  rpc
callosum
An RPC Transport Library for asyncio
Stars: ✭ 17 (-39.29%)
Mutual labels:  rpc
eth-contract-api
EthereumJ native API or how to call contracts easily and with type safety
Stars: ✭ 60 (+114.29%)
Mutual labels:  rpc
polyrpc
PolyRPC, A multi-tier functional programming language
Stars: ✭ 16 (-42.86%)
Mutual labels:  rpc
libcorpc
Libcorpc is a high performance coroutine base RPC framework
Stars: ✭ 20 (-28.57%)
Mutual labels:  rpc
create-react-scripts
Easily extend the react-scripts to your own version of react-scripts
Stars: ✭ 64 (+128.57%)
Mutual labels:  server-side-rendering

preact-rpc

React Pre-Rendering via RPC

A simple JSON based socket server that fulfills React component render requests.

https://nodei.co/npm/preact-rpc.png?downloads=true&downloadRank=true&stars=true

Introduction and tutorial: Server-side React Rendering From non-Node Environments

The motivation for this project is to use React server-side rendering (aka pre-rendering) from a non-Node app, such as one written in Ruby, or Go.

The preact-rpc server loads a Javascript bundle file containing the React components, and starts listening for render requests on a socket (a TCP socket or a UNIX socket file). A client, such as a Go app, can connect to the server and send a render request by providing a React component identifier and the props to use for rendering. The server returns with an HTML string, that can then be embedded in a view served on the client side.

Install preact-rpc globally:

npm install -g preact-rpc

In your component JS bundle, register your components so that preact-rpc can find them:

import { registerComponent } from 'preact-rpc';
...
registerComponent('comp1', MyComponent);
registerComponent('comp2', MyOtherComponent);
...

See lib/example/component.js for example.

Next, start the server. It requires the path to the bundle file and the port to listen on:

preact-rpc --bundle=./lib/example/component.js --port=tmp/server.sock

An example Go client is provided in the example-clients directory. Run the app and visit http://localhost:8080

go run example-clients/client.go

An example Ruby client is also provided in the example-clients directory. Install the gem:

gem install preact-rpc-client

And then run the example:

ruby example-clients/client.rb

More to come:

Add support for Redux stores

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].