Skip to content

Demo: Replace React Frontend with Rust-based Alternatives (Leptos/Yew) #328

@naoNao89

Description

@naoNao89

🎯 Objective

Demonstrate the replacement of existing React-based frontends with modern Rust-based alternatives using Leptos and Yew frameworks.

📋 Current State

The project currently has React-based frontends:

  • ts-grpc-react-admin - TypeScript React admin panel
  • ts-grpc-react-front - TypeScript React frontend

🦀 Proposed Rust Alternatives

Admin Panel: Leptos

  • Framework: Leptos - Full-stack Rust web framework
  • Benefits:
    • Server-side rendering (SSR)
    • Fine-grained reactivity
    • Excellent performance
    • Type safety throughout
    • Smaller bundle sizes

Frontend: Yew

  • Framework: Yew - Modern Rust framework for WebAssembly
  • Benefits:
    • Component-based architecture
    • Virtual DOM
    • Strong typing
    • WebAssembly performance
    • Rust ecosystem integration

🛠️ Implementation Status

✅ Phase 1: Setup & Configuration (COMPLETED)

Branch: add-rust-frontend-support

  • Enhanced .gitignore for multi-frontend project
  • Added Leptos admin configuration (frontend/leptos-admin/)
  • Added Yew frontend configuration (frontend/yew-frontend/)
  • Tailwind CSS integration for both frameworks
  • WASM build configuration (.cargo/config.toml)
  • Import organization following Rust best practices

Key Files Added:

  • frontend/leptos-admin/.cargo/config.toml
  • frontend/leptos-admin/tailwind.config.js
  • frontend/leptos-admin/src/input.css
  • frontend/yew-frontend/tailwind.config.js
  • frontend/yew-frontend/src/input.css

🚧 Phase 2: Core Components Migration (NEXT)

  • Authentication components (login, logout, password reset)
  • Dashboard layout and navigation
  • User management interface
  • Content management components
  • Asset management interface

📈 Repository Improvements Made

  • Reduced tracked files: From 10,000+ changes to essential source files only
  • Better organization: Comprehensive .gitignore patterns
  • Code quality: Organized imports across 5 Rust files
  • Development setup: Ready for Rust frontend development

🔗 Branch Information

Current Branch: add-rust-frontend-support
Commits:

  • 4667783 - refactor: organize imports for better code structure
  • ced3d0c - enhance: comprehensive .gitignore and add frontend source files

To test the setup:

git checkout add-rust-frontend-support
cd frontend/leptos-admin
# Check Leptos setup
cd ../yew-frontend  
# Check Yew setup

📊 Expected Benefits

Performance

  • Faster load times - WebAssembly execution speed
  • Smaller bundles - Rust's efficient compilation
  • Better caching - Static analysis optimizations

Developer Experience

  • Type safety - Compile-time error catching
  • Unified language - Same language for backend and frontend
  • Better tooling - Rust analyzer, cargo integration

🚀 Next Steps

  1. Review the branch: git checkout add-rust-frontend-support
  2. Test current setup: Verify Leptos and Yew configurations
  3. Plan component migration: Identify priority React components
  4. Start development: Begin with authentication components

Related Branch: https://github.com/naoNao89/avored-rust-cms/tree/add-rust-frontend-support
Status: Foundation complete, ready for component development

Sub-issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions