Using Rust and React together.
After playing around with the Polars data frame library, I wanted to see if I could use it in a Rust web framework to pass DF information through to a React frontend.
With the help of Actix this is possible.
I expanded the application to include some Serde implementations of serializing / deserializing.
The repo has two parts - the backend Actix server (actix-backend) and the React application (frontend) taking advantage of some Material UI components.
- Rust installed
- Understanding of
cargo - npm (or nvm) installed
- yarn installed
# Cargo Watch watches over your project's source for changes, and runs Cargo commands when they occur.
$> cargo install cargo-watchThe Polars examples read from a CSV file called organizations-100.csv located in actix-backend/static.
# run the server
$> cd actix-backend
# may take a while to resolve all dependencies + build
$> cargo-watch -x run
# server will be running on http://localhost:3001# generate documentation if you want
$> cd actix-backend
$> cargo doc --no-deps$> cd actix-backend
$> docker build -f Dockerfile.backend -t actix-backend .
$> docker run -d -p 8080:8080 actix-backend
$> curl -X GET "http://localhost:8080/health" \
-H "Content-Type: application/json"$> cd frontend
# if using nvm
$> nvm use
# install dependencies + start server
$> npm i
$> npm run start
# Will be running on http://localhost:3000If you see this Polars error, try running rustup update
...physical_plan/executors/scan/csv.rs:21:18
|
21 | .map(Arc::unwrap_or_clone);
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #93610 <https://github.com/rust-lang/rust/issues/93610> for more information
- Integrate a database like Postgres, using Diesel or similar
- GCP BigQuery implementation
- WebSockets examples
- GraphQL