Code Monkey home page Code Monkey logo

rustactix-basic's Introduction

RustActix-Basic

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.

Features

Backend

  • Actix-web server with basic routing
  • CORS configuration for frontend integration
  • File logging using log4rs
  • Simple API endpoints: hello, echo, and personalized greeting

Frontend

  • 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

Prerequisites

  • macOS or Linux
  • Internet connection
  • Git
  • Rust and Cargo
  • Node.js and npm

Quick Start Guide

1. Install Rust (if not already installed)

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source $HOME/.cargo/env

Verify installation:

rustc --version
cargo --version

2. Set Up Backend

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

3. Set Up Frontend

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)

Project Structure

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

Backend API Endpoints

  • GET /: Returns a "Hello, World!" message
  • POST /echo: Echoes back the request body
  • GET /hey/{name}: Returns a personalized greeting

Frontend Features

  • 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

Next Steps

  • 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

Contributing

Feel free to fork this repository and submit pull requests for improvements or additional features.

License

MIT License

rustactix-basic's People

Contributors

c0nsumption avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.