The goal of this project is to port a microservices-based application (a social network) to the browser using Emscripten. It aims to study the performance of the resulting client-side port compared to the traditional server-side version.
The application being ported is the Social Network application from the DeathStarBench benchmark suite.
This project is a POC, and many aspects could be improved. By using a single-page application, we could do away with legacy AJAX and unwanted refreshes. Integrating a proper dependency injection framework would facilitate development. Typing the project with TypeScript would make it more reliable. However, it serves as proof that this kind of project can be migrated. Testing the same approach with a larger-scale C++ project involving more business logic could be a next step.
To deploy the backend infrastructure, run the Ansible playbooks provided:
ansible-playbook install-dependencies.yaml -i inventories/main.yaml --ask-vault-pass
ansible-playbook deploy-app.yaml -i inventories/main.yaml --ask-vault-passFollow these steps to build and run the application locally.
First, enter the development environment and run the build script.
nix develop
./build-for-client.shNavigate to the convertedClient directory and configure the .env file. You need to set the VITE_WS_SERVER_ADDR variable to point to your WebSocket server's IP address.
Example .env configuration:
VITE_WS_SERVER_ADDR=ws://192.168.1.222:4444Start the WebSocket server located in the ws-server directory:
cd ws-server
PORT=4444 node server.jsFinally, start the Vite development server from the convertedClient directory:
npm run dev