{"id":15994411,"url":"https://github.com/oskarrough/bonpi","last_synced_at":"2025-04-05T00:16:18.119Z","repository":{"id":50611688,"uuid":"516466440","full_name":"oskarrough/bonpi","owner":"oskarrough","description":"This repo explains how to print things on a thermal receipt printer using node.js, optionally via a Raspberry Pi. It also has an example webhook for printing Linear issues","archived":false,"fork":false,"pushed_at":"2024-02-22T09:21:19.000Z","size":780,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-10T08:31:50.287Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/oskarrough.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-07-21T17:39:23.000Z","updated_at":"2024-03-04T11:24:36.000Z","dependencies_parsed_at":"2025-02-10T08:37:39.201Z","dependency_job_id":null,"html_url":"https://github.com/oskarrough/bonpi","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oskarrough%2Fbonpi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oskarrough%2Fbonpi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oskarrough%2Fbonpi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oskarrough%2Fbonpi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oskarrough","download_url":"https://codeload.github.com/oskarrough/bonpi/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247266566,"owners_count":20910837,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-08T07:08:49.014Z","updated_at":"2025-04-05T00:16:18.087Z","avatar_url":"https://github.com/oskarrough.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bonpi\n\nThis repo explains **how to print things on a thermal receipt printer using node.js**, optionally via a Raspberry Pi. The idea is the following:\n\nWe have a Raspberry Pi with some Linux installed. I used Ubuntu Server.\n\n- connected to the Printer via USB\n- connected to the internet via Wi-Fi\n- runs the `src/server.js` script from this repo\n- expose it to the interwebs with ngrok\n\t\t\nThe server exposes two endpoints:\n\n- `/print` which accepts a JSON object with a required `msg` and an optional `url` property. It then prints the message and a QR code with the URL.\n- `/my-linear-webhook` is to be used as a webhook for Linear.app, and is able to print new issues, comments and more.\n\t\t\nThe server uses `printer.js` to connect to the printer. And `print.js` to actually print stuff.\n\n## Step-by-step guide\n\n### Get hardware: Raspberry Pi + Epson TM88IV\n\nEbay is your friend. Other ESCPOS printers should also work.\n\n\tBus 001 Device 002: ID 04b8:0202 Seiko Epson Corp. Interface Card UB-U05 for Thermal Receipt Printers [M129C/TM-T70/TM-T88IV]\n\n### Install distro on pi\n\nInstall Raspberry Pi Imager from https://www.raspberrypi.com/software/ or https://github.com/raspberrypi/rpi-imager.\n\nBefore you start copying the image, make sure to use the imagers option to enable ssh and configure wifi directly. That way it \"just works\".\n\n### Connect to pi using ssh\n\n\tssh bonpi@bonpi.local\n\trsync -azvh bonpi@bonpi.local:~/bonpi/ ./ --exclude node_modules\n\nAlso see https://www.raspberrypi.com/documentation/computers/remote-access.html.\n\n### Download this repo to the pi\n\nEasiest would be to get the zip from github.\n\n### Start the server\n\n\tnode server.js\n\nor\n\n    npx nodemon start\n\n### Optionally install and use `ngrok` to expose the local server to the public\n\n    ngrok http --domain blablabla.ngrok-free.app 3000\n\nor maybe this?\n\n    ngrok http --subdomain bonpi 3000\n    ngrok http --region=eu --hostname=bonpi.eu.ngrok.io 80\n\n## Tips\n\n### Trouble with permissions\n\nMost likely it won't print out of the box. I needed to run this to get the printer to respond:\n\n\tusermod -a -G lp bonpi\n\tsudo chmod +777 /dev/usb/lp0\n\n### Find local IPs\n\n    arp -a\n\tnmap -sn 192.168.0.0/24\n\n### Find open ports\n\n\tnz -z 192.168.0.198 1-50000\n\n### Look up architecture on the pi\n\n\tuname -m\n\n### Print via REST API\n\n\tcurl -X POST -H \"Content-Type: application/json\" -d '{\"msg\": \"Radio Oskar. The channel of your wet dreams, an ode to perfume — for optimal peace and pleasure, shuffle this radio.\", \"url\": \"https://radio4000.com/oskar\"}' localhost:3000/print\n\n\tsudo raspi-config\n\n\n### Running in the background\n\nYou can either run `node start \u0026` or use pm2:\n\n    npm i -g pm2\n    pm2 start src/server.js\n    pm2 start ngrok -- http --domain INSERTDOMAINHERE.ngrok-free.app 3000 \u003e /dev/null \u0026\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foskarrough%2Fbonpi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foskarrough%2Fbonpi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foskarrough%2Fbonpi/lists"}