Skip to content

LIU9293/rust-2048

Repository files navigation

2048 Game in Disxus

It's a demo application for me to figure out if I can use rust/dioxus in production code, this codebase contains a frontend client that can compiled to Web(wasm) and Desktop, a simple rust server to handle some basic API logic and some shared components between client and server.

Live Demo -> https://rust-2048.vercel.app/

API -> https://rust-2048-api.onrender.com/leaderboard

Features in this application

  • Use tailwind and daisy css for styling
  • Handle Dark / light theme
  • Try to inplenment i18n use fermi state
  • Access cookies / localstorage
  • Build web and native app
  • A simple server to record user progress
  • Leaderboard

Test and run

1. Run server
cargo run -p server

2. Run client
// web
dioxus serve --platform web

// desktop, desktop router is not working, try to exclude router for desktop
dioxus serve --platform desktop

Target

  • Cross platform
  • Full stack in rust, with a simple backend server
  • Platform support
    • Web
    • Native MacOS
    • Mobile ??
    • Terminal ??

Progress

  • Basic UI
  • Basic move logic
  • Success or fail
  • How to deploy
    • Web -> scripts/build-web.sh
    • Desktop -> scripts/build-desktop.sh
  • Log the highest score and the total score
  • CI/CD
    • Web -> Vercel, done
    • Server -> Render.com
    • Desktop?

Server

  • Record game progress
  • Record progress for multiple users
  • Leaderboard

Github

https://github.com/LIU9293/rust-2048/

About

Learn rust by coding a 2048 game use dioxus

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published