Quickstart with a native engine
The native engine runs on your server, on Windows (x64) or Linux (x64, arm64). It comes with the Business plan. Your app reaches it through one of two servers:
| Server | Start it with | Client in your app | Address |
|---|---|---|---|
| The engine's own WebSocket server | classcad-cli worker | WSClient | ws://localhost:9094 |
| The ClassCAD server (Node.js 20+) | classcad-socketio | SocketIOClient | ws://localhost:9091 |
Both run the same engine and the same API: only the init line in your app differs.
1. Download the engine
Under Downloads on your account, choose the platform and the version, download the archive and unpack it. The page shows an install script for each platform.
2. Give the engine its key
The engine gets its key with a secret access token (ccsk_…) from Access tokens on your account. Put it in .classcad.token in the engine's folder, or in the environment variable CLASSCAD_TOKEN:
echo ccsk_… > .classcad.token
The secret token stays on your server: it never goes into a page. For machines without internet and for older engines, see Native engine on classcad.ch.
3. Start a server
WebSocket: classcad-cli worker
./classcad-cli worker
On Windows, classcad-cli.exe worker. The worker serves WebSocket on the port set by wport in the [network] section of the engine's .classcad.ini; this guide uses 9094. Each WebSocket connection is a session of its own: when the connection closes, the session ends.
Socket.IO: classcad-socketio
./classcad-socketio.sh
On Windows, classcad-socketio.cmd. The ClassCAD server listens on port 9091 and starts an engine for each session. It needs Node.js 20 or newer.
4. Connect your app
Build the app from the WebAssembly quickstart, then change the init line in src/main.jsx. For the WebSocket server:
import { init, WSClient } from '@buerli.io/classcad'
init((drawingId) => new WSClient('ws://localhost:9094', drawingId))
For the ClassCAD server:
import { init, SocketIOClient } from '@buerli.io/classcad'
init((drawingId) => new SocketIOClient('ws://localhost:9091', drawingId))
Nothing else changes: the components, the API calls and the geometry are the same.
Without React
import { init, WSClient, BuerliCadFacade } from '@buerli.io/classcad'
init((drawingId) => new WSClient('ws://localhost:9094', drawingId))
const facade = new BuerliCadFacade()
await facade.connect()
const part = await facade.api.v1.part.create({ name: 'Flange' })
await facade.api.v1.part.cylinder({ id: part, diameter: 100, height: 20 })
// Closes the connection and removes the drawing
await facade.destroy()
Share a session
A WSClient session can be joined by other clients: one mints an invite, the others connect with it. See WSClient.
Next
- @buerli.io/classcad: the clients and the facade.
- Native engine on classcad.ch: keys, offline keys, the Python and .NET packages.