Getting Started & Setup
Relevant source files
The following files were used as context for generating this wiki page:
Graphite is a complex graphics engine built with Rust and web technologies. The setup process is designed to be accessible for developers with solid computer science foundations, providing a local development environment that synchronizes frontend Svelte/TypeScript code with a Rust-based WebAssembly (Wasm) backend.
The development workflow centers on a dev server that watches for changes across the codebase, automatically recompiling and reloading the editor in the browser. This environment supports the project's goal of creating a nondestructive, procedural 2D graphics suite.
Sources: website/content/volunteer/guide/_index.md:15-20, website/content/volunteer/guide/project-setup/_index.md:12-14
Prerequisites and Dependencies
To build and run Graphite locally, several core system dependencies must be installed. The project relies on the latest stable versions of these tools to ensure compatibility with modern Rust features and web standards.
| Dependency | Required Version | Purpose |
|---|---|---|
| Rust | Latest Stable | Compiles the editor backend and Graphene node engine to Wasm. |
| Node.js | Latest LTS | Manages the frontend build toolchain and npm packages. |
| Git | Recent version | Version control and repository management. |
Sources: website/content/volunteer/guide/project-setup/_index.md:16-21
Initial Repository Setup
The project is hosted on GitHub. Developers should clone the repository and use the provided build scripts to initialize the environment.
# Clone the repository
git clone https://github.com/GraphiteEditor/Graphite.git
# Navigate to the project root and run the initialization/dev server
cargo run
The cargo run command acts as a high-level build system manager. It checks for required dependency versions, assists with missing installations, and starts a local development server at http://localhost:8080.
Sources: website/content/volunteer/guide/project-setup/_index.md:23-38
Build Architecture and Data Flow
Graphite's build process involves a sophisticated interaction between Rust's cargo and the frontend's npm/vite ecosystem. The following diagram illustrates how components are compiled and served.
The diagram shows the compilation of Rust crates into WebAssembly via wasm-pack, which is then bundled with Svelte/TS assets by Vite.
Sources: frontend/README.md:5-20, website/content/volunteer/guide/project-setup/_index.md:12-14
Development Tooling and Quality Control
The project provides specific configurations for VS Code to maintain code quality standards. This includes suggested extensions for Rust and web tooling, as well as linting rules enforced by the CI pipeline.
Core Build Commands
| Command | Location | Description |
|---|---|---|
cargo run | Root | Starts the dev server with hot-reloading. |
cargo run release | Root | Runs the dev server with release optimizations (for slow networks). |
cargo run help | Root | Lists additional build system commands. |
npm run check | /frontend | Runs Svelte-check and ESLint to view quality issues. |
npm run fix | /frontend | Automatically fixes linting and formatting issues in web code. |
Sources: website/content/volunteer/guide/project-setup/_index.md:33-55, frontend/package.json:11-23
Linting and Formatting Standards
- Rust: Developers must pass
cargo check,cargo clippy, andcargo fmt. - Frontend: The project uses ESLint and Prettier. The
eslint.config.jsfile enforces style rules on JS, TS, Svelte, HTML, and SCSS. - Continuous Integration (CI): All PRs must pass the "Editor: Dev & CI / build" check. PRs from forks require maintainer approval for CI runs.
Sources: website/content/volunteer/guide/project-setup/_index.md:52-60, website/content/volunteer/guide/starting-a-task/submitting-a-contribution.md:158-170, frontend/README.md:22-35
Contribution Workflow
Before submitting code, contributors must follow specific Git procedures to ensure a linear and clean history.
This sequence details the standard flow from local branch creation to PR review.
Sources: website/content/volunteer/guide/starting-a-task/submitting-a-contribution.md:15-70, website/content/volunteer/guide/starting-a-task/submitting-a-contribution.md:185-200
Git Best Practices
- Branch Naming: Use kebab-case (e.g.,
fix-path-tool-selection). Do not use prefixes likefeature/and never open a PR frommaster. - Commit Messages: PR titles become the squash commit message. Use imperative mood (e.g., "Add Y feature").
- Syncing: Use
Update with rebaseon GitHub to maintain a linear history when themasterbranch moves forward.
Sources: website/content/volunteer/guide/starting-a-task/submitting-a-contribution.md:24-42, website/content/volunteer/guide/starting-a-task/submitting-a-contribution.md:184-192
Summary
Setting up Graphite requires a dual-environment configuration of Rust and Node.js. By utilizing the cargo run entry point, developers can initiate a reactive development server that handles the complex Wasm-to-JS bridge. Adherence to the project's strict linting and Git branching guidelines is mandatory for contributions to be accepted into the main repository.
Sources: website/content/volunteer/guide/project-setup/_index.md:12-14, website/content/volunteer/guide/starting-a-task/submitting-a-contribution.md:158-165