Language and platform choice
Requirements driving the decision
| Requirement | Technical implication |
|---|---|
| Windows + Linux binaries | Cross-compile friendly toolchain, native I/O |
| Raw USB / serial / Bluetooth | Low-level device access, not browser-only |
| ESC/POS byte generation | Binary buffers, barcode/image encoding |
| Live preview UI | Responsive editor + rendered preview |
| Small distributable | Avoid heavy runtime (no full JVM, prefer no Chromium if possible) |
| Long-term maintainability | Strong typing, good deps for hardware |
---
Candidates evaluated
Rust + Tauri 2 (recommended)
| Pros | Cons |
|---|---|
Excellent ESC/POS ecosystem (escpos, nusb, serialport) | Rust learning curve |
| Tauri 2: small binaries, web UI for editor | Two languages (Rust + TS) |
| Proven pattern for serial/USB desktop tools | WebView rendering for preview |
| First-class Windows + Linux support | |
serde for .pos files |
Verdict: Best fit. Hardware logic stays in Rust; React/Svelte/Vue handles editor UX.
Rust + egui / iced (native UI)
| Pros | Cons |
|---|---|
| Single language, single binary | Editor UX more work (no Monaco/CodeMirror out of the box) |
| No WebView dependency | Syntax highlighting needs extra crates |
| Fast iteration for tools | Less familiar to web developers |
Verdict: Strong alternative if minimizing dependencies matters more than rich editor UX.
C# + Avalonia
| Pros | Cons |
|---|---|
| Good desktop UI | USB/BT raw I/O less ergonomic than Rust |
| Cross-platform .NET | Larger runtime |
| Familiar if team is .NET | ESC/POS libs thinner than Rust |
Verdict: Viable if the team is already .NET-heavy.
Go + Fyne / Wails
| Pros | Cons |
|---|---|
| Simple deployment | Weaker ESC/POS and USB ecosystem |
| Fast compile | Fyne UI less polished for split editor/preview |
Verdict: Possible but fighting the ecosystem for printer I/O.
Python + PyQt / PySide
| Pros | Cons |
|---|---|
| Rapid prototyping | Packaging on Windows/Linux painful |
python-escpos, pyserial exist | GIL, dependency hell in frozen binaries |
Verdict: Good for a throwaway prototype, poor for a shipped product.
Electron + native Node addon
| Pros | Cons |
|---|---|
| Best editor UX (Monaco) | Large bundle (~150 MB+) |
serialport npm package | Native addon build complexity per platform |
Verdict: Overkill footprint unless team is JS-only.
C++ + Qt
| Pros | Cons |
|---|---|
| Mature, fast | Slowest development velocity |
| Qt Serial Port | ESC/POS mostly roll-your-own |
Verdict: Over-engineered for a small application.
---
Decision (updated)
Selected: Rust + egui (eframe) — single-language, minimal dependencies
See ARCHITECTURE.md for the current layout.
Previously considered: Rust (core) + Tauri 2 + TypeScript (UI)
┌─────────────────────────────────────────┐
│ Frontend (TypeScript + React/Svelte) │
│ - CodeMirror/Monaco editor │
│ - Preview canvas (width-scaled) │
│ - Parameter modal, printer picker │
└─────────────────┬───────────────────────┘
│ Tauri commands / events
┌─────────────────▼───────────────────────┐
│ Rust backend │
│ - DSL parse → AST │
│ - Preview layout + ESC/POS encode │
│ - Printer discovery (serial, USB, BT) │
│ - `.pos` serde │
└─────────────────────────────────────────┘
Rust crates (planned)
| Crate | Role |
|---|---|
escpos | ESC/POS commands, barcodes, QR, raster |
serialport | USB-serial / COM ports |
nusb or rusb | USB printer class (bulk) |
serde + serde_json | .pos file format |
image | Decode/resize images for raster print |
tauri 2.x | App shell, IPC |
Frontend (planned)
| Library | Role |
|---|---|
| CodeMirror 6 or Monaco | Syntax-aware editor |
| Vite + React (or Svelte) | UI framework |
| Tailwind or similar | Layout |
Fallback: Rust + egui
Choose this if you want a single-language codebase and can accept a simpler text editor (egui text edit + optional syntect highlighting).
---
Platform-specific notes
Windows
- USB-serial:
COMxviaserialportcrate - USB printer class:
escposusbprintfeature (usesusbprint.sys, no Zadig) - Bluetooth SPP: paired devices as COM ports; discovery via Windows APIs (later phase)
- Build: MSVC toolchain, WiX or NSIS for installer
Linux
- USB-serial:
/dev/ttyUSB*,/dev/ttyACM*— user must be indialoutgroup - USB printer class:
nusb+ udev rules optional for non-root - Bluetooth: BlueZ,
/dev/rfcomm*after binding - Build:
cargo deb/ AppImage via Tauri bundler
---
Decision record
| Decision | Choice | Rationale |
|---|---|---|
| Core language | Rust | ESC/POS + USB/serial ecosystem |
| UI shell | Tauri 2 | Small binary, modern editor UX |
| UI language | TypeScript | Editor component ecosystem |
| Print protocol | ESC/POS | De facto POS standard |
| MVP transport | USB-serial | Highest compatibility, lowest risk |
This decision should be revisited only if the implementing team has strong expertise elsewhere (e.g. Avalonia) and accepts additional printer I/O work.
Source
| 1 | # Language and platform choice |
| 2 | |
| 3 | ## Requirements driving the decision |
| 4 | |
| 5 | | Requirement | Technical implication | |
| 6 | |-------------|----------------------| |
| 7 | | Windows + Linux binaries | Cross-compile friendly toolchain, native I/O | |
| 8 | | Raw USB / serial / Bluetooth | Low-level device access, not browser-only | |
| 9 | | ESC/POS byte generation | Binary buffers, barcode/image encoding | |
| 10 | | Live preview UI | Responsive editor + rendered preview | |
| 11 | | Small distributable | Avoid heavy runtime (no full JVM, prefer no Chromium if possible) | |
| 12 | | Long-term maintainability | Strong typing, good deps for hardware | |
| 13 | |
| 14 | --- |
| 15 | |
| 16 | ## Candidates evaluated |
| 17 | |
| 18 | ### Rust + Tauri 2 (recommended) |
| 19 | |
| 20 | | Pros | Cons | |
| 21 | |------|------| |
| 22 | | Excellent ESC/POS ecosystem (`escpos`, `nusb`, `serialport`) | Rust learning curve | |
| 23 | | Tauri 2: small binaries, web UI for editor | Two languages (Rust + TS) | |
| 24 | | Proven pattern for serial/USB desktop tools | WebView rendering for preview | |
| 25 | | First-class Windows + Linux support | | |
| 26 | | `serde` for `.pos` files | | |
| 27 | |
| 28 | **Verdict:** Best fit. Hardware logic stays in Rust; React/Svelte/Vue handles editor UX. |
| 29 | |
| 30 | ### Rust + egui / iced (native UI) |
| 31 | |
| 32 | | Pros | Cons | |
| 33 | |------|------| |
| 34 | | Single language, single binary | Editor UX more work (no Monaco/CodeMirror out of the box) | |
| 35 | | No WebView dependency | Syntax highlighting needs extra crates | |
| 36 | | Fast iteration for tools | Less familiar to web developers | |
| 37 | |
| 38 | **Verdict:** Strong alternative if minimizing dependencies matters more than rich editor UX. |
| 39 | |
| 40 | ### C# + Avalonia |
| 41 | |
| 42 | | Pros | Cons | |
| 43 | |------|------| |
| 44 | | Good desktop UI | USB/BT raw I/O less ergonomic than Rust | |
| 45 | | Cross-platform .NET | Larger runtime | |
| 46 | | Familiar if team is .NET | ESC/POS libs thinner than Rust | |
| 47 | |
| 48 | **Verdict:** Viable if the team is already .NET-heavy. |
| 49 | |
| 50 | ### Go + Fyne / Wails |
| 51 | |
| 52 | | Pros | Cons | |
| 53 | |------|------| |
| 54 | | Simple deployment | Weaker ESC/POS and USB ecosystem | |
| 55 | | Fast compile | Fyne UI less polished for split editor/preview | |
| 56 | |
| 57 | **Verdict:** Possible but fighting the ecosystem for printer I/O. |
| 58 | |
| 59 | ### Python + PyQt / PySide |
| 60 | |
| 61 | | Pros | Cons | |
| 62 | |------|------| |
| 63 | | Rapid prototyping | Packaging on Windows/Linux painful | |
| 64 | | `python-escpos`, `pyserial` exist | GIL, dependency hell in frozen binaries | |
| 65 | |
| 66 | **Verdict:** Good for a throwaway prototype, poor for a shipped product. |
| 67 | |
| 68 | ### Electron + native Node addon |
| 69 | |
| 70 | | Pros | Cons | |
| 71 | |------|------| |
| 72 | | Best editor UX (Monaco) | Large bundle (~150 MB+) | |
| 73 | | `serialport` npm package | Native addon build complexity per platform | |
| 74 | |
| 75 | **Verdict:** Overkill footprint unless team is JS-only. |
| 76 | |
| 77 | ### C++ + Qt |
| 78 | |
| 79 | | Pros | Cons | |
| 80 | |------|------| |
| 81 | | Mature, fast | Slowest development velocity | |
| 82 | | Qt Serial Port | ESC/POS mostly roll-your-own | |
| 83 | |
| 84 | **Verdict:** Over-engineered for a *small* application. |
| 85 | |
| 86 | --- |
| 87 | |
| 88 | ## Decision (updated) |
| 89 | |
| 90 | ### Selected: **Rust + egui (eframe)** — single-language, minimal dependencies |
| 91 | |
| 92 | See [ARCHITECTURE.md](ARCHITECTURE.md) for the current layout. |
| 93 | |
| 94 | ### Previously considered: **Rust (core) + Tauri 2 + TypeScript (UI)** |
| 95 | |
| 96 | ``` |
| 97 | ┌─────────────────────────────────────────┐ |
| 98 | │ Frontend (TypeScript + React/Svelte) │ |
| 99 | │ - CodeMirror/Monaco editor │ |
| 100 | │ - Preview canvas (width-scaled) │ |
| 101 | │ - Parameter modal, printer picker │ |
| 102 | └─────────────────┬───────────────────────┘ |
| 103 | │ Tauri commands / events |
| 104 | ┌─────────────────▼───────────────────────┐ |
| 105 | │ Rust backend │ |
| 106 | │ - DSL parse → AST │ |
| 107 | │ - Preview layout + ESC/POS encode │ |
| 108 | │ - Printer discovery (serial, USB, BT) │ |
| 109 | │ - `.pos` serde │ |
| 110 | └─────────────────────────────────────────┘ |
| 111 | ``` |
| 112 | |
| 113 | #### Rust crates (planned) |
| 114 | |
| 115 | | Crate | Role | |
| 116 | |-------|------| |
| 117 | | `escpos` | ESC/POS commands, barcodes, QR, raster | |
| 118 | | `serialport` | USB-serial / COM ports | |
| 119 | | `nusb` or `rusb` | USB printer class (bulk) | |
| 120 | | `serde` + `serde_json` | `.pos` file format | |
| 121 | | `image` | Decode/resize images for raster print | |
| 122 | | `tauri` 2.x | App shell, IPC | |
| 123 | |
| 124 | #### Frontend (planned) |
| 125 | |
| 126 | | Library | Role | |
| 127 | |---------|------| |
| 128 | | CodeMirror 6 or Monaco | Syntax-aware editor | |
| 129 | | Vite + React (or Svelte) | UI framework | |
| 130 | | Tailwind or similar | Layout | |
| 131 | |
| 132 | ### Fallback: **Rust + egui** |
| 133 | |
| 134 | Choose this if you want a single-language codebase and can accept a simpler text editor (egui text edit + optional syntect highlighting). |
| 135 | |
| 136 | --- |
| 137 | |
| 138 | ## Platform-specific notes |
| 139 | |
| 140 | ### Windows |
| 141 | |
| 142 | - USB-serial: `COMx` via `serialport` crate |
| 143 | - USB printer class: `escpos` `usbprint` feature (uses `usbprint.sys`, no Zadig) |
| 144 | - Bluetooth SPP: paired devices as COM ports; discovery via Windows APIs (later phase) |
| 145 | - Build: MSVC toolchain, WiX or NSIS for installer |
| 146 | |
| 147 | ### Linux |
| 148 | |
| 149 | - USB-serial: `/dev/ttyUSB*`, `/dev/ttyACM*` — user must be in `dialout` group |
| 150 | - USB printer class: `nusb` + udev rules optional for non-root |
| 151 | - Bluetooth: BlueZ, `/dev/rfcomm*` after binding |
| 152 | - Build: `cargo deb` / AppImage via Tauri bundler |
| 153 | |
| 154 | --- |
| 155 | |
| 156 | ## Decision record |
| 157 | |
| 158 | | Decision | Choice | Rationale | |
| 159 | |----------|--------|-----------| |
| 160 | | Core language | **Rust** | ESC/POS + USB/serial ecosystem | |
| 161 | | UI shell | **Tauri 2** | Small binary, modern editor UX | |
| 162 | | UI language | **TypeScript** | Editor component ecosystem | |
| 163 | | Print protocol | **ESC/POS** | De facto POS standard | |
| 164 | | MVP transport | **USB-serial** | Highest compatibility, lowest risk | |
| 165 | |
| 166 | This decision should be revisited only if the implementing team has strong expertise elsewhere (e.g. Avalonia) *and* accepts additional printer I/O work. |