https://github.com/aryprogrammer/rust-chatbot
Using Rust for Frontend and Backend. Leptos and Rustformer Demonstrations
https://github.com/aryprogrammer/rust-chatbot
Last synced: about 1 month ago
JSON representation
Using Rust for Frontend and Backend. Leptos and Rustformer Demonstrations
- Host: GitHub
- URL: https://github.com/aryprogrammer/rust-chatbot
- Owner: ARYPROGRAMMER
- License: unlicense
- Created: 2025-12-25T21:57:06.000Z (4 months ago)
- Default Branch: master
- Last Pushed: 2026-01-16T23:15:34.000Z (3 months ago)
- Last Synced: 2026-01-17T11:11:39.480Z (3 months ago)
- Language: PowerShell
- Size: 45.9 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Rust Chatbot
A full-stack web application built with [Leptos](https://leptos.dev/) and [Actix Web](https://actix.rs/), featuring server-side rendering (SSR) with client-side hydration.
## Features
- 🦀 **Rust Full-Stack** - Both server and client written in Rust
- âš¡ **Server-Side Rendering** - Fast initial page loads with SSR
- 💧 **Hydration** - Seamless client-side interactivity via WebAssembly
- 🎨 **SCSS Styling** - Modern styling with Sass
- 🔄 **Reactive UI** - Fine-grained reactivity with Leptos signals
## Prerequisites
- [Rust](https://rustup.rs/) (nightly)
- [cargo-leptos](https://github.com/leptos-rs/cargo-leptos): `cargo install cargo-leptos`
- [wasm-bindgen-cli](https://rustwasm.github.io/wasm-bindgen/): `cargo install wasm-bindgen-cli`
- WASM target: `rustup target add wasm32-unknown-unknown`
## Quick Start
### Automated Setup (Recommended)
**Windows (PowerShell):**
```powershell
.\scripts\setup.ps1
```
**Linux/macOS:**
```bash
chmod +x scripts/setup.sh && ./scripts/setup.sh
```
The setup script will:
- Install Rust nightly toolchain
- Add wasm32-unknown-unknown target
- Install matching wasm-bindgen-cli version
- Install cargo-leptos
- Set up e2e test dependencies (if npm available)
### Option 1: Using cargo-leptos (Recommended)
```bash
cd rust-chatbot
cargo leptos serve
```
This builds both WASM and server, then runs the dev server with hot reload at http://127.0.0.1:3000
For production build:
```bash
cargo leptos build --release
```
### Option 2: Manual Build
If cargo-leptos has issues, use the build scripts:
**Windows (PowerShell):**
```powershell
.\scripts\build.ps1
.\target\debug\rust-chatbot.exe
```
**Linux/macOS:**
```bash
./scripts/build.sh
./target/debug/rust-chatbot
```
Or run the commands manually:
```bash
# 1. Build WASM
cargo build --lib --target wasm32-unknown-unknown --features hydrate --no-default-features
# 2. Generate JS bindings
wasm-bindgen --target web --out-dir target/site/pkg --out-name rust-chatbot target/wasm32-unknown-unknown/debug/rust_chatbot.wasm
# 3. Copy CSS
cp style/main.scss target/site/pkg/rust-chatbot.css
# 4. Build server
cargo build --bin rust-chatbot --features ssr --no-default-features
# 5. Run
./target/debug/rust-chatbot
```
Then open http://127.0.0.1:3000
## Project Structure
```
rust-chatbot/
├── scripts/
│ ├── setup.ps1 # Windows setup script
│ ├── setup.sh # Unix setup script
│ ├── build.ps1 # Windows build script
│ └── build.sh # Unix build script
├── src/
│ ├── app.rs # Main application component
│ ├── lib.rs # WASM hydration entry point
│ └── main.rs # Server entry point
├── style/
│ └── main.scss # Styles
├── assets/ # Static assets
├── end2end/ # Playwright e2e tests
├── Cargo.toml # Dependencies and metadata
├── rust-toolchain.toml # Rust version specifier
└── README.md
```
## Running Tests
```bash
cd end2end
npm install
npx playwright test
```
## Troubleshooting
**wasm-bindgen version mismatch:**
Make sure the CLI version matches your `Cargo.toml` dependency:
```bash
wasm-bindgen --version
cargo tree -p wasm-bindgen
```
If they differ, install the matching CLI version:
```bash
cargo install wasm-bindgen-cli --version
```
## Author
**ARYPROGRAMMER**
## License
This project is released into the public domain under the [Unlicense](LICENSE).
See the [LICENSE](LICENSE) file for details.