- HTML 81.6%
- Go 6.6%
- PowerShell 3.4%
- Svelte 3%
- TypeScript 2.1%
- Other 3.3%
| build | ||
| build-helpers | ||
| cmd/scale-code-cli | ||
| frontend | ||
| internal | ||
| .gitignore | ||
| AGENTS.md | ||
| app.go | ||
| go.mod | ||
| go.sum | ||
| hid_support.go | ||
| LICENSE | ||
| main.go | ||
| README.md | ||
| stampscom.html | ||
| wails.json | ||
scale-code
scale-code is now a Wails-based desktop GUI for the Stamps.com / Endicia USB postal scale.
Supported hardware today:
USB\VID_1446&PID_6A73&REV_1000USB\VID_1446&PID_6A73USB\VID_1446&PID_6A78(reserved for future-compatible devices)
The app keeps the original Go HID logic, but moves it into a reusable backend service so the desktop UI can auto-connect, stream readings, reconnect after unplug/replug, and expose diagnostics.
Features
- Desktop GUI with Wails v2 and Svelte + TypeScript
- Live weight display in
oz,lb,g, andkg - Auto-connect and manual reconnect
- Raw scale output without calibration or correction layers
- Diagnostics view with detected devices, raw report bytes, and current settings
- Fake backend mode for UI work without hardware
Project Layout
.
├── app.go
├── main.go
├── wails.json
├── internal/
│ ├── config/
│ └── scale/
├── frontend/
│ ├── src/
│ └── package.json
├── build/
│ ├── linux/
│ └── windows/
└── cmd/
└── scale-code-cli/
Development
Prerequisites
- Go 1.24+
- Node.js 24+
- npm 11+
- Wails CLI for
wails dev/wails build
This repo compiles with plain go build, but wails dev and packaged desktop builds still require the Wails CLI to be installed on the machine.
Because the HID library depends on CGO, production builds also require CGO_ENABLED=1 and a working C compiler in PATH. A Windows build without CGO will launch, but it will never enumerate the scale.
The Windows helper tries to load the Visual Studio build environment automatically, then attempts MSVC first with CC=cl and CXX=cl. It preflights runtime/cgo before starting the Wails package build. If MSVC fails, it retries with CC=gcc and CXX=g++ when gcc is available, including common MSYS2/MinGW install paths. The helper temporarily writes these values through go env -w so Wails subprocesses inherit the same CGO toolchain, then restores the previous Go settings. For this HID dependency stack, Go cgo may still require the GCC-compatible fallback because MSVC rejects some GCC-style cgo flags.
If MSVC fails and no GCC fallback is installed, run:
.\build-helpers\build-windows.ps1 -InstallMissingGcc
That switch uses winget to install MSYS2 and the UCRT64 GCC package, then retries the GCC fallback.
If build\bin\scale-code.exe is still running, the build and clean helpers will stop early with a clear message. Use -StopRunningApp to let the helper close the running app before replacing or cleaning the output.
Frontend
cd frontend
npm install
npm run build
Backend validation
go test ./...
go build ./...
Temporary CLI
The legacy-style debug entrypoint is still available while the GUI is being hardened:
go run ./cmd/scale-code-cli
Fake backend mode
Use this for frontend work without a scale connected:
$env:SCALE_CODE_FAKE = "1"
wails dev
Running The GUI
Once the Wails CLI is installed:
wails dev
For a local release-style frontend build before that:
cd frontend
npm run build
cd ..
go build .
Linux Permissions
Do not run the GUI as root as the normal solution.
Install the included udev rule:
sudo cp build/linux/99-scale-code.rules /etc/udev/rules.d/
sudo udevadm control --reload-rules
sudo udevadm trigger
Then unplug and replug the scale before reopening the app.
The app surfaces this message when Linux permissions block access:
Scale found, but permission denied. Install the udev rule, unplug/replug the scale, then reopen the app.
Windows Notes
- The app now enumerates all HID devices first, then filters by supported VID/PID instead of relying only on a direct
hid.Enumerate(vendor, product)call. - No WinUSB / Zadig instructions are included. The intended path is the default HID stack.
- The diagnostics panel is the first place to check if Windows shows the hardware ID but the HID layer still exposes zero matching devices.
Current Validation
Validated locally in this workspace:
go test ./...go build ./...npm run checknpm run build
Not validated yet in this workspace:
wails devwails build -platform windows/amd64- Real hardware streaming through the new GUI
- Linux udev flow on an actual Linux desktop
License
MIT