Development Setup¶
Guide to setting up a development environment for IFClite.
Prerequisites¶
Required Tools¶
| Tool | Version | Purpose |
|---|---|---|
| Node.js | 22.x | JavaScript runtime (engines in package.json) |
| pnpm | 10.x (8.0+ minimum) | Package manager (pinned via packageManager: pnpm@10.8.1) |
| Rust | pinned nightly | WASM compilation; rust-toolchain.toml pins the nightly channel and the wasm32-unknown-unknown target, and rustup installs both automatically on first use in the repo |
| wasm-pack | 0.12+ | WASM toolchain (only needed to rebuild WASM; see pnpm build:wasm:fetch below) |
Installing Prerequisites¶
# Install Node.js via Homebrew
brew install node@22
# Install pnpm
npm install -g pnpm
# Install Rust (rustup reads rust-toolchain.toml and installs the
# pinned nightly plus the wasm32-unknown-unknown target automatically)
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# Install wasm-pack
cargo install wasm-pack
# Install Node.js (Ubuntu/Debian)
curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
sudo apt-get install -y nodejs
# Install pnpm
npm install -g pnpm
# Install Rust (rustup reads rust-toolchain.toml and installs the
# pinned nightly plus the wasm32-unknown-unknown target automatically)
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source ~/.cargo/env
# Install wasm-pack
cargo install wasm-pack
# Install Node.js via winget
winget install OpenJS.NodeJS.LTS
# Install pnpm
npm install -g pnpm
# Install Rust via rustup-init.exe (download from https://rustup.rs).
# rustup reads rust-toolchain.toml and installs the pinned nightly
# plus the wasm32-unknown-unknown target automatically.
# Install wasm-pack
cargo install wasm-pack
If you do not want a Rust toolchain at all, pnpm build:wasm:fetch downloads
the prebuilt @ifc-lite/wasm bundle from npm instead of compiling it.
Clone and Build¶
1. Clone Repository¶
The repository does not use Git LFS. Test model files (IFC/IFCX fixtures) are not stored in git at all; they are fetched from a GitHub Release in the next steps.
2. Install Dependencies¶
3. Fetch Test Fixtures¶
This downloads the IFC/IFCX test models catalogued in
tests/models/manifest.json from a GitHub Release. The fetch is selective and
idempotent: files already on disk with a matching SHA-256 are skipped, and
every download is hash-verified. Tests skip cleanly when fixtures are absent,
so this step is optional for a first build. See tests/models/README.md for
details.
4. Build All Packages¶
5. Verify Build¶
Project Structure¶
ifc-lite/
├── Cargo.toml # Rust workspace root (members under rust/ and apps/server)
├── rust/ # Rust crates
│ ├── core/ # ifc-lite-core (STEP parser)
│ ├── geometry/ # ifc-lite-geometry (geometry kernel, CSG)
│ ├── processing/ # ifc-lite-processing
│ ├── clash/ # ifc-lite-clash
│ ├── export/ # ifc-lite-export
│ ├── ffi/ # ifc-lite-ffi (native bindings)
│ └── wasm-bindings/ # ifc-lite-wasm (WASM crate)
├── packages/ # TypeScript packages (@ifc-lite/*)
│ ├── parser/ # @ifc-lite/parser
│ ├── geometry/ # @ifc-lite/geometry
│ ├── renderer/ # @ifc-lite/renderer
│ ├── query/ # @ifc-lite/query
│ ├── data/ # @ifc-lite/data
│ ├── export/ # @ifc-lite/export
│ ├── wasm/ # @ifc-lite/wasm (built bundle in pkg/)
│ └── ... # cli, sdk, mcp, ids, bcf, collab, and more
├── apps/
│ ├── viewer/ # Viewer app
│ ├── viewer-embed/ # Embeddable viewer
│ ├── server/ # HTTP server (Rust)
│ └── landing/ # Landing page
└── docs/ # Documentation (MkDocs)
Development Workflow¶
Watch Mode¶
Run a specific package in watch mode:
Running the Viewer¶
From the repo root (builds workspace packages first):
Or, if packages are already built:
Open http://localhost:3000 in your browser.
Building WASM¶
The output goes to packages/wasm/pkg/. This needs the pinned nightly
toolchain and wasm-pack. Without a Rust toolchain, use
pnpm build:wasm:fetch to download the prebuilt bundle from npm.
Running Rust Tests¶
The Cargo workspace root is the repo root:
Generating Documentation¶
Rust Documentation (rustdoc):
# Generate and open in browser (from the repo root)
cargo doc --no-deps --open
# Generate for a specific crate
cargo doc -p ifc-lite-core --open
# Generate without opening
cargo doc --no-deps
# Output: target/doc/index.html
MkDocs (Project Documentation):
# One-off: install MkDocs and plugins
pip install -r requirements-docs.txt
# Serve the docs site
pnpm docs:serve
# Opens at http://127.0.0.1:8000
IDE Setup¶
VS Code¶
Install recommended extensions:
{
"recommendations": [
"rust-lang.rust-analyzer",
"tamasfe.even-better-toml",
"bradlc.vscode-tailwindcss",
"esbenp.prettier-vscode",
"dbaeumer.vscode-eslint"
]
}
Settings¶
{
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[rust]": {
"editor.defaultFormatter": "rust-lang.rust-analyzer"
},
"rust-analyzer.cargo.features": "all"
}
Common Tasks¶
Adding a Dependency¶
TypeScript packages:
Rust crates:
Creating a New Package¶
mkdir packages/new-package
cd packages/new-package
# Initialize
pnpm init
# Add to workspace (update root package.json if needed)
Updating Dependencies¶
Troubleshooting¶
WASM Build Fails¶
Node Modules Issues¶
TypeScript Errors¶
Contributing Changes¶
1. Create a Branch¶
2. Make Changes¶
Make your changes and test them:
3. Create Pull Request¶
Push your branch and open a PR on GitHub:
PR Requirements: - All tests pass - Code builds successfully - Clear description of changes - Reference related issues if applicable
Next Steps¶
- Testing - Testing guide