Git Product home page Git Product logo

react-esr-with-wasmedge's Introduction

React SSR with Wasmedge

This repository has an implementation of using wasmedge and quickjs runtime for rendering react app on server side.

Resources

WebAssembly vs JS: https://snipcart.com/blog/webassembly-vs-javascript

What is wasedge runtime: https://wasmedge.org/docs/category/what-is-wasmedge

Get started with Wasmedge for JS : https://wasmedge.org/docs/develop/javascript/intro https://www.secondstate.io/articles/wasmedge-joins-cncf/

Wasmedge with docker: https://wasmedge.org/docs/develop/deploy/using-wasmedge-in-docker#run-a-lightweight-nodejs-server

What is WASI: https://hacks.mozilla.org/2019/03/standardizing-wasi-a-webassembly-system-interface/

Fastly: https://blog.suborbital.dev/foundations-wasm-in-golang-is-fantastic https://www.fastly.com/blog/run-your-next-js-app-on-fastly

WasmFiddle: https://wasdk.github.io/WasmFiddle/

App Structure

The react application for both the wasmedge and node implemenation remains the same, just the server implemenation differs. Plain react app with src containing the react app implemenation, wasmedge-server/index.js containg server implemenation for wasmedge and express/index.js containing server implemenation for NodeJS.

There is a Dockerfile for creating images for both the implemenations which can be used to be uploaded on any edge function like AWS or Google Cloud etc.

Getting Started

Install wasmedge : https://wasmedge.org/docs/start/install#install

Install rust

Clone Wasmedge-quickjs: https://wasmedge.org/docs/develop/javascript/hello_world and copy the modules folder in the working repository

Start with ,

npm i

For AOT compilation for increased speed, wasmedge compile wasmedge_quickjs.wasm wasmedge_quickjs.wasm

To run the app on local using wasmedge, do start:we-server And your app will be up and running on your http://localhost:8004

To run the nodejs implemenation, do start:express-server And your app will be up and running on your http://localhost:3006

react-esr-with-wasmedge's People

Contributors

apoorva-srivastav avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.