svelte-websocket-demo

Svelte Websocket Demo

svelte-websocket-demo

prerequisites

  1. node 20.1.0
  2. pnpm 8.4.0

NB: I use volta to manage node and pnpm versions.

NB: Please also ditch using npm altogether, do use pnpm for god's sake.

Install node using volta:

volta install node@20.1.0

Install pnpm using volta:

volta install pnpm@8.4.0

Go to the root of the repository and run the following command:

pnpm --recursive install

Now you are ready to run the app.

how to run it in dev mode

  1. open two consoles ( one for the front-end and one for the back-end )
  2. in the front-end console navigate to the front-end directory
  3. in the back-end console navigate to the back-end/srv/WebsocketServer directory
  4. in the front-end console type pnpm run dev
  5. in the back-end console type pnpm run dev:server

parts

  1. front-end
  2. back-end
  3. common

dockerization

NB: please run the following commands from the root directory of this monorepo

build the ws-front-end image

./docker/.scripts/dockerize-front-end

build the ws-back-end image

./docker/.scripts/dockerize-back-end

run containers

./docker/bin/run-front-end
./docker/bin/run-back-end

now, open your web browser at http://localhost:3000/ to see how the front-end looks like.

Top categories

Loading Svelte Themes