Plum Engine is a two-part voxel visualization and analysis project:
- A Rust backend that stores a mutable voxel world, ingests 3D point data, tracks temporal occupancy over a rolling 32-tick window, and exposes JSON APIs.
- A React + Vite frontend that renders the voxel field in 3D, streams dataset uploads into the backend, lets users scrub temporal history, and generates an audit-style analytics report from live telemetry.
The backend turns incoming point clouds into voxel coordinates by flooring each point to an integer (x, y, z) position. Each voxel keeps:
- Whether it is currently occupied
- A rolling 32-tick occupancy history bitmask
- Shannon entropy derived from that history
- An anomaly flag when the current state deviates from the voxel's recent behavior
- The sequence ID of the last update
The frontend continuously polls the backend, visualizes the live world, and computes higher-level metrics such as:
- Structural health
- Mean entropy
- Anomaly density
- Volatility index
- Saturation velocity
- Dense-cluster vs sparse-noise anomaly grouping
- Real-time voxel rendering with
react-three-fiberandthree.js - Temporal hindsight mode with a 32-tick scrubber
- CSV, JSON, and PLY/LiDAR-style point ingestion from the browser
- Batch streaming of parsed points into the backend
- Full world snapshot API
- Delta API for sparse updates
- Snapshot history API with structural integrity score
- Development tick endpoint for synthetic world mutations
- Audit report UI with charts and anomaly manifest
- Optional Gemini-powered narrative report generation with local fallback text
- Rust 2021
- Axum
- Tokio
- DashMap
- parking_lot
- glam
- tower-http CORS
- React 19
- Vite 8
- TypeScript-enabled source files
- Zustand
@react-three/fiber@react-three/drei- Framer Motion
- Recharts
.
├── backend
│ ├── Cargo.toml
│ └── src
│ ├── main.rs
│ ├── models.rs
│ ├── routes.rs
│ ├── spatial_hash.rs
│ ├── state.rs
│ └── world.rs
├── frontend
│ ├── package.json
│ └── src
│ ├── App.tsx
│ ├── VoxelEngine.tsx
│ ├── components/AuditReport.tsx
│ ├── store.ts
│ ├── types.ts
│ └── utils/geminiAudit.ts
├── HOWTORUN.md
└── README.md
- Rust toolchain with
cargo - Node.js and npm
Optional for development convenience:
cargo-watchif you want auto-rebuilds for the Rust server
Install it with:
cargo install cargo-watchOpen two terminals from the repository root.
Basic run:
cd backend
cargo runAuto-reload during development:
cd backend
cargo watch -x runThe backend listens on port 3000.
By default it binds to:
0.0.0.0:3000
You can override the host with:
HOST=127.0.0.1 cargo runcd frontend
npm install
npm run devVite will print the local frontend URL, usually http://localhost:5173.
HOST: optional bind host for the Axum server. Default is0.0.0.0.
VITE_GEMINI_API_KEY: optional Google Gemini API key used by the audit report generator.
If VITE_GEMINI_API_KEY is not set, the frontend still works. The audit report falls back to a built-in static report instead of calling Gemini.
- The frontend parses a selected dataset file in the browser.
- Parsed points are split into batches of 2000 points.
- Each batch is posted to
POST /api/world/ingest. - The backend floors each point to integer voxel coordinates.
- The world model updates occupancy history, entropy, anomaly status, and sequence ID.
- The frontend polls the backend and recalculates derived telemetry from the latest voxel set.
- The 3D scene and audit report update from the latest state.
The upload panel accepts:
.csv.json.ply
Expected shape:
x,y,z
1.0,2.0,3.0
4.5,2.1,0.0
Notes:
- Lines beginning with
#are ignored. - Values may be comma-separated or whitespace-separated.
- At least the first three values on a line must be numeric.
Expected shape:
[
{ "x": 1.0, "y": 2.0, "z": 3.0 },
{ "x": 4.5, "y": 2.1, "z": 0.0 }
]- The frontend uses
PLYLoaderfromthree.jsto read vertex positions from.plyfiles. - Valid position attributes are converted into point batches and streamed to the backend.
Base URL:
http://localhost:3000/api
Health check.
Example response:
{
"ok": true,
"service": "plum-rockets-4d-engine",
"sequence_id": 0,
"voxel_count": 10
}Returns the complete current voxel state.
Example response shape:
{
"sequence_id": 4,
"voxels": [
{
"x": 1,
"y": 1,
"z": 0,
"occupied": true,
"entropy": 0.12,
"anomaly": false,
"occupancy_history": 15,
"last_updated_seq": 4
}
]
}Returns only voxels changed after the provided sequence.
Example response shape:
{
"sequence_id": 4,
"changed": [
{
"key": 140739206361089,
"x": 1,
"y": 1,
"z": 0,
"occupied": true,
"entropy": 0.12,
"anomaly": false,
"seq": 4
}
]
}Returns the latest snapshot plus structural integrity.
Example response shape:
{
"sequence_id": 4,
"structural_integrity": 0.88,
"voxels": []
}Ingests a point cloud as JSON.
Request body:
{
"points": [
{ "x": 1.2, "y": 0.4, "z": 2.8 },
{ "x": 1.8, "y": 0.9, "z": 2.1 }
]
}Response:
204 No Contenton success
Accepts multipart dataset uploads with:
dataset: file fieldformat: optional text field
This endpoint currently acknowledges receipt and reports metadata. It does not yet process the uploaded file into voxels.
Example response shape:
{
"ok": true,
"file_name": "scan.csv",
"format": "csv",
"bytes_received": 1024,
"message": "Dataset received by backend. Processing pipeline can be attached next."
}Applies a synthetic mutation for development/testing.
Response:
204 No Contenton success
The frontend currently polls:
GET /api/world/voxels
Polling interval:
- Every
100ms
Although the backend exposes a delta endpoint, the current frontend store refreshes from full voxel snapshots rather than applying sparse deltas incrementally.
LIVE: shows currently occupied voxelsTEMPORAL_HINDSIGHT: reveals historical occupancy using the 32-tick bitmask and scrubber offset
The report overlay includes:
- Structural integrity trend
- Entropy variance
- Anomaly density over time
- Volatility pulse
- Sector heatmap
- Forensic metric cards
- AI-generated or fallback narrative analysis
- An anomaly manifest table
- The world is seeded on startup with 10 initial voxels.
- Voxel state is stored in a thread-safe spatial hash built on
DashMap. - Active voxels are tracked separately to avoid aging the full map on every ingest cycle.
- Sequence IDs are stored as an atomic counter.
- Snapshot history is capped at 50 entries.
- Structural integrity is derived from average voxel entropy.
- The frontend hardcodes backend URLs to
http://localhost:3000; it is not yet environment-configurable. - The frontend upload flow streams parsed files directly to
POST /world/ingest; it does not use the backend multipart upload endpoint. - The frontend polls the full voxel state every
100ms, which is simple but not optimal for larger datasets. - The backend does not persist world state; all data resets on restart.
- The backend snapshot operation is currently
O(N)over all voxels. - The generated frontend production bundle is large and triggers Vite's chunk-size warning.
- There are no automated tests in the repository yet.
The current codebase was checked successfully with:
cd backend && cargo check
cd frontend && npm run build- Switch the frontend from full snapshot polling to delta-based synchronization
- Move API base URLs into environment variables
- Add persistence for snapshots or world state
- Add backend and frontend test coverage
- Wire the multipart upload endpoint into an actual server-side ingestion pipeline