Skip to content

A blazing fast r/place clone with Rust, Actix web, redis and Svelte

License

Notifications You must be signed in to change notification settings

TheRolfFR/rs-place

 
 

Repository files navigation

rs/place

Static Badge GitHub repo size GitHub last commit Changelog - Read here Place here
A blazing fast r/place clone with Rust, Actix web, redis and Svelte

Requirements

These are not the required versions but what I used, your versions could be more recent.

Customize your place server with config.json

To configure config.json, you have to configured as wished:

  • redisUrl to your redis server URL you just launched. Value can be found or your machine or WSL ip address.
  • host and port for the server IP and port exposed. Choose your LAN IP address for your house or keep localhost for your computer. Port must match your reverse proxy entry.
  • basePixelAmount and timeout in seconds define the number of pixels you can place per duration
  • colors defines the list of color codes displayed and colorsActive the index and order of active colors
  • canvasWidth, canvasHeight and canvasChunkSize define how big your place is

You can take as default config.json for dev and config_prod.json for production.

How to develop

To develop you will need to run frontend, backend, a redis server and configure config.json.

Frontend and backend

Install pnpm packages:

cd frontend
pnpm i

To run backend and frontend in parallel, you can install concurrently globally:

pnpm i -g concurrently

Now you can launch dev command:

cd frontend
pnpm dev

redis server

To run a redis server, just use docker or podman:

podman run -d -p 6379:6379 --name redis_server docker.io/library/redis:7-alpine

To watch the redis db, you can install and use redis-commander:

pnpm i -g redis-commander

Started URLs

Backend is started with reverse proxy for frontend at http://localhost:8080/ while redis-commander is started at http://127.0.0.1:8081/

How to build

Clone this repo duh. Build the docker image:

podman build -t rs-place:dev .

Modify the provided docker-compose.yml file to your liking. Don't forget to configure your config.json file with production values. debugMode must be false to start with static files from frontend build. Config properties redisUrl and host can be both overwritten by respectively the REDIS_URL and HOST environment variables.

You can then start the containers:

podman compose up -d

If you are using ports < 1024, you should stop your podman machine and grant it root permissions:

podman machine stop
podman machine set --rootful
podman machine start

Languages

  • Rust 44.4%
  • TypeScript 30.3%
  • Svelte 18.7%
  • SCSS 2.2%
  • Dockerfile 1.6%
  • HTML 1.6%
  • JavaScript 1.2%