{"id":22579716,"url":"https://github.com/phantie/snake","last_synced_at":"2026-04-29T21:33:14.225Z","repository":{"id":227018310,"uuid":"767130388","full_name":"phantie/snake","owner":"phantie","description":"Singleplayer/Multiplayer browser game on modern Rust stack (Yew, Axum) and WebSocket","archived":false,"fork":false,"pushed_at":"2025-06-06T00:37:41.000Z","size":180,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-07T06:58:38.703Z","etag":null,"topics":["async","axum","data-compresssion","k8s","multiplayer","nix","snake","websocket","yew"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/phantie.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2024-03-04T18:56:11.000Z","updated_at":"2025-06-06T00:37:43.000Z","dependencies_parsed_at":"2024-03-11T07:27:40.555Z","dependency_job_id":"dbfdbb5b-09a1-4ce3-b023-8a801807d6ea","html_url":"https://github.com/phantie/snake","commit_stats":null,"previous_names":["phantie/snake"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/phantie/snake","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phantie%2Fsnake","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phantie%2Fsnake/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phantie%2Fsnake/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phantie%2Fsnake/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phantie","download_url":"https://codeload.github.com/phantie/snake/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phantie%2Fsnake/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32445193,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T20:22:27.477Z","status":"ssl_error","status_checked_at":"2026-04-29T20:22:26.507Z","response_time":110,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["async","axum","data-compresssion","k8s","multiplayer","nix","snake","websocket","yew"],"created_at":"2024-12-08T05:10:55.088Z","updated_at":"2026-04-29T21:33:14.203Z","avatar_url":"https://github.com/phantie.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Snake game\n\nhttps://github.com/phantie/snake/assets/43893037/2cdbeae7-6fd6-4bb2-97e4-82d1cfe65562\n\n### Modes\nFrontend self-contains singleplayer mode.\\\nWebsocket connection to backend enables multiplayer mode.\n\n### Stack\nk8s, yew, nix, axum\n\nDeployed on kubernetes. Dev environment and docker images built by Nix. Compiled frontend artifacts, served by dedicated cache-optimized http server.\n\n### Backend\nPerformant concurrent event handling on asynchronous multi-threaded tokio runtime, similar to Erlang's light-weight processes.\n\n### Frontend\nBased on SPA application framework similar to React. Custom theme support (click right top corner).\n\n### Messages\nFrontend and backend reuse message schemas, compile-time checked. Request/response model over Websockets implemented for frontend and backend. Reliable communication provided by request/response model (acknowledgements), idempotency and (potentially) request retries.\n\n### Development guide\nRefer to dev.md\n\n### Optimizations\n#### Space efficient ser/de for snake form\nReduces required space for snake form ser/de by encoding directions intead of positions after initial position. \\\nOld payload: {pos1 pos2 pos3} \\\nNew payload: {pos1 dir1 dir2} \\\nPosition as json is {\"x\":x,\"y\":y} taking 11 + 2 * (1 to 5 (1 for possible minus sign)) bytes = 13 to 21 bytes. Encoded position as a direction takes 2 bits. Resulting in space efficiency per position increased by up to (max(13, 21) * 8) / 2 = 84 times.\n\n### Room for improvement\n- State reconciliation using partial update, instead of pushing full state to client on server update. Goal: smaller payloads.\n- Compress messages, for example, leaving field names out of payloads. Goal: smaller payloads.\n- Push updates only for possibly visible to client objects. Goal: smaller payloads.\n- Root frontend component refactoring. Goal: reduce technical debt.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphantie%2Fsnake","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphantie%2Fsnake","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphantie%2Fsnake/lists"}