A Rust-based web application using Yew framework.
- Rust (stable version 1.74.0 or higher)
- WebAssembly target:
rustup target add wasm32-unknown-unknown
- wasm-bindgen-cli (v0.2.99):
cargo install wasm-bindgen-cli --version 0.2.99
- basic-http-server:
cargo install basic-http-server
- make (for build automation)
- Clone the repository
- Install dependencies:
rustup target add wasm32-unknown-unknown cargo install wasm-bindgen-cli --version 0.2.99 cargo install basic-http-server
-
Build the project:
make build
-
Start the development server:
make serve
-
Open your web browser and navigate to:
http://127.0.0.1:8081
src/
: Source code directorymain.rs
: Main application entry point and root componentroutes/
: Application routing configurationpages/
: Page componentscomponents/
: Reusable UI components
build.rs
: Rust build script for WebAssembly compilationMakefile
: Build automationindex.html
: HTML template with WebAssembly loaderCargo.toml
: Rust dependencies and project configuration
yew
: Main web framework (v0.20)yew-router
: Routing (v0.17.0)wasm-bindgen
: WebAssembly bindings (v0.2.99)web-sys
: Web APIsjs-sys
: JavaScript interop
To make changes to the application:
- Edit the source files
- Run
make build
to rebuild - Run
make serve
to start the development server - Refresh your browser to see the changes
To clean the build:
make clean
If you encounter issues:
-
Version Mismatches:
- Ensure wasm-bindgen-cli version matches the one in Cargo.toml (currently 0.2.99)
- Run
make clean
before rebuilding if you update versions
-
Build Issues:
- Check that all prerequisites are installed
- Verify that the WebAssembly target is installed:
rustup target list | grep wasm32
- Make sure you have make installed
-
Runtime Issues:
- Clear browser cache
- Check browser console (F12) for errors
- Verify that the server is running on the correct port
- Try using a private/incognito window
-
Build System:
- Replaced shell scripts with Rust build script (build.rs)
- Added Makefile for build automation
- Improved build process reliability
-
WebAssembly Setup:
- Updated wasm-bindgen to version 0.2.99
- Added proper WebAssembly initialization
- Streamlined build process
-
Project Structure:
- Simplified main.rs for initial "Hello World" display
- Added proper module organization
- Updated Cargo.toml with correct dependencies
- Add more UI components
- Implement routing for multiple pages
- Add state management
- Integrate with backend services
- Add CSS styling and UI framework
- Set up testing infrastructure