Project Setup
This page covers everything you need to start developing DocuShark locally.
Prerequisites
- Bun — JavaScript runtime and package manager (bun.sh)
- Rust toolchain — via rustup (stable channel)
- Platform dependencies — see Tauri v2 prerequisites
- Task (optional) — task runner (taskfile.dev) for convenient commands
Linux (Debian/Ubuntu)
# System dependencies for Tauri
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev \
librsvg2-dev patchelfmacOS
# Xcode command line tools (provides system headers)
xcode-select --installWindows
Install the Desktop development with C++ workload from Visual Studio Build Tools.
Getting the Code
git clone https://github.com/JPE-Net-Technologies/docushark.git
cd docushark
bun installDevelopment Commands
| Command | Description |
|---|---|
bun run dev | Start Vite dev server (web only) |
bun run tauri:dev | Start Tauri desktop app with hot-reload |
bun run typecheck | Run TypeScript type checking |
bun run test | Run Vitest in watch mode |
bun run test --run | Run all tests once |
bun run build | Production web build |
bun run tauri:build | Build desktop installer |
task check | Run typecheck + all tests (requires Task) |
Rust: desktop backend & relay
There are two Rust crates. The src-tauri/ crate is the desktop shell; the standalone relay/ crate is the collaboration server — the component the REST API, MCP Tools, and Wire Protocol pages document.
# Desktop backend (src-tauri/)
cargo check --manifest-path src-tauri/Cargo.toml
cargo test --manifest-path src-tauri/Cargo.toml
# Standalone relay (its own crate)
cargo check --manifest-path relay/Cargo.toml
cargo test --manifest-path relay/Cargo.tomlProject Layout
docushark/
├── src/ # TypeScript source
│ ├── math/ # Vec2, Mat3, Box, geometry utilities
│ ├── engine/ # Camera, Renderer, InputHandler, SpatialIndex
│ ├── store/ # Zustand stores (Document, Session, History…)
│ ├── shapes/ # Shape handlers and libraries
│ ├── collaboration/ # Protocol, sync providers, offline queue
│ ├── storage/ # BlobStorage, RelayDocumentCache, TrashStorage
│ ├── ui/ # React components (Toolbar, PropertyPanel…)
│ ├── tauri/ # Tauri command bindings
│ └── plugins/ # Panel extension registry
├── src-tauri/ # Rust backend
│ ├── src/
│ │ ├── lib.rs # Tauri commands, docs server, window setup
│ │ └── server/ # WebSocket server, protocol, auth
│ ├── Cargo.toml
│ └── tauri.conf.json # Tauri build and window config
├── relay/ # Standalone Rust relay (Axum + Tokio): WebSocket
│ # sync, authoritative Y.Doc, REST, MCP, OIDC auth
├── docs-site/ # VitePress documentation site
├── vite.config.ts # Vite + Vitest config
├── tsconfig.json # TypeScript config (strict mode)
└── Taskfile.yml # Task runner definitionsTypeScript Configuration
The project uses strict TypeScript with additional flags beyond strict: true:
| Flag | Effect |
|---|---|
noUncheckedIndexedAccess | Index access returns T | undefined |
exactOptionalPropertyTypes | Optional properties require explicit undefined |
noPropertyAccessFromIndexSignature | Forces bracket notation for index signatures |
noUnusedLocals / noUnusedParameters | Unused variables are errors |
noImplicitReturns | All code paths must return |
The path alias @/* maps to ./src/* and is configured in both tsconfig.json and vite.config.ts.
Testing
Tests use Vitest with jsdom environment. Test globals (describe, it, expect) are available without imports. Test files live alongside source code with .test.ts suffix.
# Run a single test file
bun run test src/engine/Camera.test.ts
# Run tests with browser UI
bun run test:ui| Module | Coverage |
|---|---|
/src/math/ | Vec2, Mat3, Box, geometry |
/src/engine/ | Camera, InputHandler, Renderer, SpatialIndex, HitTester, ToolManager |
/src/store/ | DocumentStore, SessionStore, PageStore, HistoryStore, connectionStore |
/src/shapes/ | Shape handlers, bounds, transforms, library shapes |
/src/collaboration/ | Protocol, sync providers, offline queue, SyncStateManager |
/src/storage/ | RelayDocumentCache, TrashStorage |
/src/types/ | VersionConflict utilities |
The suite spans well over a thousand tests; run task check for the current count. (bun run test --run reports the exact totals locally.)
TIP
Run task check to typecheck and test in one command — this is what CI runs.
