This project demonstrates a full-stack application with a Rust backend using Actix-web and a React TypeScript frontend with Three.js integration. It showcases routing, request handling, CORS configuration, file logging on the backend, and an interactive 3D scene on the frontend.
- Actix-web server with basic routing
- CORS configuration for frontend integration
- File logging using log4rs
- Simple API endpoints: hello, echo, and personalized greeting
- React with TypeScript
- Three.js integration using @react-three/fiber and @react-three/drei
- Interactive 3D scene with customizable elements
- Dynamic HDRI environment
- Leva for easy GUI controls
- macOS or Linux
- Internet connection
- Git
- Rust and Cargo
- Node.js and npm
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source $HOME/.cargo/env
Verify installation:
rustc --version
cargo --version
Clone the repository:
git clone https://github.com/C0nsumption/RustActix-Basic.git
cd RustActix-Basic
Run the backend:
cargo run
The server will start on http://localhost:8080
In a new terminal, navigate to the frontend directory:
cd react-ts/
npm install
npm run dev
The frontend will be available at the URL provided by Vite (usually http://localhost:5173
)
RustActix-Basic/
├── src/
│ └── main.rs # Backend server code
├── react-ts/
│ ├── src/
│ │ ├── App.tsx # Main React component with 3D scene
│ │ └── ...
│ ├── package.json
│ └── ...
├── Cargo.toml
└── README.md
- GET
/
: Returns a "Hello, World!" message - POST
/echo
: Echoes back the request body - GET
/hey/{name}
: Returns a personalized greeting
- Interactive 3D sphere with customizable material properties
- Dynamic HDRI environment with multiple presets
- Fog and sky simulation
- Orbit controls for camera manipulation
- GUI controls for easy customization of scene elements
- Integration with backend API for personalized greetings
- Implement more complex backend logic and database integration
- Enhance error handling and input validation
- Implement user authentication
- Add more interactive elements to the 3D scene
- Optimize 3D rendering performance
- Add unit and integration tests for both backend and frontend
Feel free to fork this repository and submit pull requests for improvements or additional features.