Barbarcode is a simple, open-source barcode scanning service with a server and a mobile client, both implemented in JavaScript.
barbarcode-demo-1.mp4
Get started with Barbarcode in four simple steps:
- Install the server:
npm install -g barbarcode
# or use npx without installing
- Create a
config.toml
file with your keystroke mappings:
[sessions]
inventory_input = "{barcode}{enter}"
price_check = "{key:F4}{barcode}{enter}"
- Start the server with your desired session:
barbarcode -p 8080 -s inventory_input
# or with npx:
npx barbarcode -p 8080 -s inventory_input
- Scan the QR code displayed by the server using your mobile device to start scanning barcodes!
The server component handles:
- Running a WebSocket server for client connections
- Converting scanned barcodes into keystrokes
- Managing scanning sessions via CLI
The config.toml
file defines how barcodes are processed using keystroke patterns:
[sessions]
# Press Enter after the barcode
inventory_input = "{barcode}{enter}"
# Press F4, then type barcode, then Enter
price_check = "{key:F4}{barcode}{enter}"
# Type SKU:, the barcode, Tab, then Quantity:
data_entry = "SKU:{barcode}{tab}Quantity:"
# Wait 500ms, press F5, type barcode, Tab, 1, Enter
complex_input = "{delay:500}{key:F5}{barcode}{tab}1{enter}"
{barcode}
: The scanned barcode value{enter}
,{tab}
,{esc}
: Special keys{delay:ms}
: Add delay in milliseconds{up}
,{down}
,{left}
,{right}
: Arrow keys{key:X}
: Any other key (X)- Regular text: Typed as-is
A mobile-first web client that:
- Automatically opens when scanning the server's QR code
- Handles barcode scanning through your device's camera
-
Server:
- ws: WebSocket server
- toml: TOML configuration parsing
- commander: CLI interface
- qr: QR code generation
- robotjs: Keystroke emulation
- ngrok: Public URL tunneling
-
Client:
- html5-qrcode: QR code scanning
- quaggaJS: Barcode scanning
Barbarcode is open-source and available under the MIT License.
Contributions to Barbarcode are welcome! Please feel free to submit a Pull Request.
If you encounter any problems or have any questions, please open an issue on the GitHub repository.