Programming Languages Used in the Brush Repository: Rust, TypeScript, and Python

The brush repository is built primarily with Rust for the core rendering engine, TypeScript for the web frontend, and Python for benchmark utilities, organized as a Cargo workspace with supporting HTML and configuration files.

The brush repository is a multi-language codebase implementing 3D Gaussian Splatting tools, where the programming languages used in the brush repository are carefully selected to balance performance-critical rendering with cross-platform accessibility. The project structure reflects a modern polyglot architecture, with systems-level code handling computation and higher-level scripts managing testing workflows.

Rust: The Core Rendering Engine

The majority of the brush codebase is written in Rust and organized as a Cargo workspace under the crates/ directory. This language choice provides memory safety and performance necessary for real-time rendering operations.

Key Rust components include:

The Scene::load method in the dataset crate handles 3D scene ingestion:

use brush_dataset::scene::Scene;
use std::path::PathBuf;

fn load_scene(path: PathBuf) -> Result<Scene, brush_dataset::Error> {
    // The `Scene::load` implementation lives in the dataset crate
    Scene::load(&path)
}

The root Cargo.toml defines the workspace structure, linking crates for rendering, dataset handling, and bench testing into a unified build system.

TypeScript: Web Frontend Implementation

The web interface resides in apps/brush-js/ and is implemented in TypeScript, compiled to JavaScript via Vite for browser deployment. This layer provides the UI and WebGL visualization capabilities.

The apps/brush-js/web/src/point_renderer.ts file contains the WebGL point-rendering logic, while apps/brush-js/web/src/main.ts serves as the application bootstrap. Although the bundle includes generated JavaScript, the source is hand-written TypeScript. The apps/brush-js/web/index.html file acts as the host container that loads the compiled application.

Example initialization from the frontend:

import { PointRenderer } from "./point_renderer";

const canvas = document.getElementById("glCanvas") as HTMLCanvasElement;
const renderer = new PointRenderer(canvas);

function animate() {
  renderer.render();
  requestAnimationFrame(animate);
}
animate();

Python: Benchmark and Test Utilities

Python scripts support the testing infrastructure rather than the runtime application. Located primarily in crates/brush-bench-test/test_cases/, these utilities generate reference data and validation tensors for the benchmark suite.

The generate_reference.py script creates test datasets using standard ML libraries:

import safetensors
import numpy as np

def make_reference():
    data = np.random.rand(100, 3).astype("float32")
    safetensors.save_file({"points": data}, "reference.safetensors")

Supporting Technologies

The repository includes HTML markup for the web UI entry point and TOML configuration files for build management. The Cargo.toml workspace manifest defines dependencies across the Rust crates, while package configuration files support the TypeScript build pipeline.

Summary

  • Rust forms the computational core in crates/, handling rendering, datasets, and CLI functionality
  • TypeScript drives the interactive web interface in apps/brush-js/, compiled via Vite for browser execution
  • Python provides auxiliary benchmark utilities in crates/brush-bench-test/ for test data generation
  • HTML serves as the container for the web application entry point
  • TOML configurations manage the Cargo workspace and build dependencies

Frequently Asked Questions

Does the brush repository use Python for machine learning?

No, Python is used exclusively for benchmark utilities and test data generation, such as in crates/brush-bench-test/test_cases/generate_reference.py. The core machine learning operations and rendering algorithms are implemented in Rust for performance optimization.

What build system manages the Rust code in brush?

The repository uses Cargo as the workspace build system, defined by the root Cargo.toml. This manages dependencies across multiple crates including brush-render-bwd, brush-dataset, and brush-bench-test.

Is the brush web interface written in JavaScript or TypeScript?

The web interface is written in TypeScript and located in apps/brush-js/web/src/. The TypeScript source is compiled to JavaScript using Vite during the build process, with the entry point defined in main.ts and rendering logic in point_renderer.ts.

What is the primary purpose of the Rust code in this repository?

The Rust code implements the core rendering engine including the backward pass rasterizer in crates/brush-render-bwd/src/lib.rs, dataset loading utilities, and the command-line interface. It compiles to both native binaries and WASM targets for web deployment.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →