Breaking: a job with a raw element prints only with a token issued with uberbringer token --raw. Every other token, every existing one included, gets 403 token_scope for it, with the raw elements in details, and keeps every other route. The notify module prints a notification card from a title, message, priority and tags, with topic, click, up to three actions, image, markdown and time as options; it decodes strictly and refuses a payload over its length caps. The ntfy module takes one ntfy message as ntfy sends it, such as the ntfy client's $NTFY_RAW, ignores fields it does not know, cuts text over the caps, and answers 204 for other events and binary bodies. Both print every message plain: one message cannot tell the first of a sequence from a replacement, since a publisher may choose the sequence ID. internal/pkg/ntfy holds ntfy's message types. Both print the same card. The priority picks the form: a dark URGENT rule and a double box, a double box headed HIGH, a single box with the title in its border, or a rule with no box. Tags print as markers in front of the title, the rest on a Tags row; links print as QR codes with their labels; attached PNG, JPEG, GIF and WebP images print after the card. A line-level markdown subset is laid out without a dependency, keeping marks inside code spans and URLs, and emoji are removed after a few typed ones become markers. A card that cannot be laid out prints as a plain receipt, and the server logs the fault once at ERROR and reports it to Sentry once. [ntfy.format] and [ntfy.markers] shape the cards; the markers table is a setting with the user's own keys, also settable as UBERBRINGER_NTFY_MARKERS=name=value,... uberbringer token --modules issues a token limited to those modules' print and preview routes, job status and the module list; each route in the table says which tokens it takes, and a scope claim that could read as absent makes the token invalid. image elements take optional, which also shrinks a too-wide image to the paper; a QR code that could be too wide for the paper prints with smaller modules; box takes title_bold. Submit takes a Meta whose source shows in job status and, with a copy of the request ID, in every worker log line of the job. The four ntfy cards passed on the TM-T88IV, posted as the client recipe posts them, and their bytes are pinned in TestPaperReceipts. docs/api.md describes the modules, the card and the client recipe, with tokens read from a header file; docs/swagger.json is regenerated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
20 KiB
Überbringer
Bringer of information. A small daemon that takes print jobs as JSON over a REST API and prints them on an EPSON ESC/POS network receipt printer.
- Queue with job status: jobs return immediately with an ID and print in order on a background worker, with retries when the printer is offline.
- Plain-text input: send UTF-8 text, including accents,
£ ° ±and box-drawing┌─┐│└┘░▒▓. It is transcoded to the printer's code page (CP437 by default), and typographic quotes, dashes and the ellipsis print as ASCII look-alikes where the code page lacks them. - Word wrap: text wraps at word boundaries for the paper width and character size, so words are never cut in half.
- Rich elements: bold, underline, inverse, sizes 1–8, two fonts, alignment, QR codes, EAN/UPC/CODE39/CODE128 barcodes, images, raw ESC/POS.
- Boxes, rules, key-value rows and lists: single or double CP437 borders with titles, dividers and footers, and bulleted, numbered or checkbox lists, sized to the paper when the job prints.
- Modules: send a few plain fields, such as a note's title, text and checklist, and get a laid-out receipt back.
- Notifications: print ntfy messages as they arrive, through the ntfy client with no other tools, or post a title, message, priority and tags from any script. Each prints as a card styled by its priority, with links as QR codes.
- Scoped tokens: integration tokens reach only their modules, and only tokens issued for it can send raw ESC/POS.
- Preview: see the exact lines a job prints, without using paper.
- Images that print well: PNG, JPEG, GIF or WebP from a URL or base64, scaled to the paper and dithered. Image URLs can't reach internal network addresses unless you allow it.
- Health endpoint with live printer status: paper low or out, cover open, errors.
Note
Pre-refactor code: no AI was used. The original Überbringer (v0.1.x), up to commit
bb73348from January 2025, was written without any AI. That commit shows the code as it was before the 0.2 refactor.
Contents
Quick start
Debian/Ubuntu server with Caddy and TLS
sudo ./install.sh printer.example.com you@example.com 192.168.1.245
- Sets up a fresh Debian or Ubuntu host: the latest release, a systemd service, and Caddy for HTTPS with an automatic certificate. It does not upgrade a host set up by the 0.1 script.
- Arguments: the server's domain, whose DNS must point at the server, with ports 80 and 443 free and reachable; the email address for the certificate account; and the printer's IP address or host name, without a port.
- A given release, v0.2.0 or later:
sudo UBERBRINGER_VERSION=v0.2.0 ./install.sh <domain> <acme-email> <printer-address>. - The config is
/etc/uberbringer/config.toml. The first API token is in/etc/uberbringer/initial-token: copy it to your client, then delete the file. Issue more withuberbringer token --config /etc/uberbringer/config.toml --subject <client>. - Re-running the script upgrades the install and keeps the config. After
editing the config, run
systemctl restart uberbringer; after changingwebserver.body_limit,bind_iporport, re-run the script instead. - Change the systemd unit with
systemctl edit uberbringer. - The install log is
/var/log/uberbringer-install.log.
Docker
docker build -t uberbringer .
docker run -d -p 127.0.0.1:8080:8080 -v "$PWD/config.toml:/etc/uberbringer/config.toml:ro" uberbringer
The image is a microservice for running behind your own reverse proxy. It
contains no proxy and no TLS: it serves plain HTTP on port 8080, and the proxy
terminates HTTPS. The examples publish the port on the host's loopback
address only, for a proxy on the host; a proxy in another container reaches
it over a shared Docker network instead, with no -p at all. In the mounted
config.toml:
- Set
bind_ip = "0.0.0.0"in[webserver]. - Set
trusted_proxiesto the address the proxy's requests come from: its container network (e.g.["172.18.0.0/16"]), or for a proxy on the host, the Docker bridge's gateway (usually172.17.0.1). Have the proxy setX-Real-IPto the client's address. Otherwise every request appears to come from the proxy, and all clients share one rate limit. - Let the proxy pass request bodies up to
webserver.body_limit(4 MiB by default).
The settings can come from environment variables instead (see
Configuration). To run without a config file, set
UBERBRINGER_CONFIG empty and put the variables in an env file that only you
can read (chmod 600 uberbringer.env), so the secret stays off the command
line:
UBERBRINGER_CONFIG=
UBERBRINGER_WEBSERVER_BIND_IP=0.0.0.0
UBERBRINGER_WEBSERVER_TRUSTED_PROXIES=172.18.0.0/16
UBERBRINGER_API_SECRET=<the output of uberbringer secret>
UBERBRINGER_PRINTER_ADDRESS=192.168.1.245
docker run -d -p 127.0.0.1:8080:8080 --env-file uberbringer.env uberbringer
Publish port 8080 only to the proxy, never directly to the internet. For
container health checks, use GET / to see whether the daemon is up.
/healthz answers 503 while the printer is unreachable, so it suits
alerting better than restarting the container.
From source
cp configs/config.example.toml config.toml
go run ./cmd/uberbringer secret # paste into api.secret
$EDITOR config.toml # set printer.address
go run ./cmd/uberbringer token # prints a bearer token
make run
API
docs/api.md is the API reference: the routes, the print
elements and blocks, the modules, and the error codes.
docs/swagger.json is the OpenAPI 3.1 document,
generated from the route table; the daemon serves it at GET /openapi.json.
Configuration
Copy configs/config.example.toml to
config.toml. Only api.secret (at least 32 bytes) and printer.address are
required; every other setting has a default, which the example shows. Configs
from 0.1 still load, because their keys are unchanged, but printer.address
is now required. Unknown keys are reported as errors, so a typo can't
silently fall back to a default, and so are two keys that differ only in
case. A duration is a string such as "5s"; a bare number is refused.
Every key can also be set by an environment variable named
UBERBRINGER_<SECTION>_<KEY>, such as UBERBRINGER_PRINTER_ADDRESS for
printer.address, and a variable wins over the file:
- Values are written without quotes: decimal digits for a number,
trueorfalsefor a flag,5sfor a duration. Lists take comma-separated values, e.g.UBERBRINGER_WEBSERVER_TRUSTED_PROXIES=127.0.0.1,::1; an empty item, from a doubled or trailing comma, is an error. In the file, a number, flag or list may also be written as such a string. A table of your own entries,ntfy.markers, takesname=valueentries separated by commas, e.g.UBERBRINGER_NTFY_MARKERS=backup=[B],nas01=; a value cannot hold a comma. - An empty variable counts as unset, and one that holds only spaces is an error. Variables that name no key are ignored, but when the configuration fails to load, the error names them, since they are likely misspelt.
--confignames the file, and defaults toconfig.tomlor toUBERBRINGER_CONFIGwhen that is set.--config "", or an emptyUBERBRINGER_CONFIG, reads no file, so the settings come from the environment and the defaults alone.
Settings worth knowing:
-
printer.modelsets the print width and characters per line:Model Printers Width Font A / B columns tm-t88(default)TM-T88IV, V, VI, VII 512 dots (180 dpi) 42 / 56 tm-m50TM-m50, TM-m50II 512 dots (180 dpi) 42 / 56 tm-t20TM-T20, II, III 576 dots (203 dpi) 48 / 64 generic-80mmother 80 mm, 203 dpi 576 dots 48 / 64 generic-58mm58 mm paper, 203 dpi 384 dots 32 / 42 For 58 mm paper on a 180-dpi printer (TM-T88VII, TM-m50II), use a
tm-t88ortm-m50model withpaper_width = 360(30 Font A columns).If words break at the right edge (for example
seveon one line andralon the next), the model is wider than the printer.paper_width(dots) andcolumns(Font A characters per line) override the model. -
printer.codepage:cp437(default),cp850,cp858(has €) orcp1252. -
printer.box_line_spacing(default0): the line spacing, in motion units (ESC 3, 0–255), used while a box prints. Lines of box drawing leave small gaps in the vertical borders at the printer's default spacing; a value checked on paper closes them.0keeps the default, which was checked on a TM-T88IV withexamples/blocks.jsonand looks fine. -
format.max_lines(default2000): a job that would print more lines, all copies counted, fails instead of printing. It is a backstop against runaway text;/api/v1/previewanswers such a job with422. -
format.timezone(defaultLocal) andformat.time_layout(default02 Jan 15:04): how modules print times, such as a note's stamp. The zone is an IANA name such asEurope/London,UTC, orLocalfor the host's zone; the binary carries the zone database, so names load on hosts and containers without one. The layout is Go's notation, in which02 Jan 2006 15:04:05stands for the parts of a date, e.g.2006-01-02 15:04. A layout that shows no part of a date is an error. -
[ntfy.format]shapes the notification cards of thenotifyandntfymodules:Key Default Values styleautoautopicks the form from the priority;boxprints priorities 1 and 2 in a box too;compactprints every priority without a boxmax_lines401–400 lines of the message, as written, before ... N more linesqrallWhich links print as QR codes: all,first(the rest as text) ornoneimagestruefalsenames attached images on aFilerow instead of printing themmarkdowntruefalseprints markdown messages as written -
[ntfy.markers]adds or changes the markers printed for tags, at most 16 characters each, and""hides a tag:backup = "[B]",nas01 = "". -
webserver.trusted_proxies/proxy_header: the real client IP for per-client rate limits comes from theX-Real-IPheader set by the reverse proxy (Caddy, asinstall.shconfigures it) on127.0.0.1. -
sentry.dsn: error reporting. When neither the file norUBERBRINGER_SENTRY_DSNsets it, it falls back to theSENTRY_DSNenvironment variable, then to a DSN built into release binaries (from theSENTRY_DSNCI secret). Request bodies and theAuthorizationheader are never sent to Sentry. -
log.level(debug,info,warn,error) andlog.format(textorjson) control what is logged:- Each request is logged once, as
request: at INFO, or at WARN when the status is 5xx. Only the path is logged, never the query string, the body or the token. - An unexpected failure adds one ERROR
request failedline, witherrandrequest_id, and one Sentry event. - A recovered panic adds one ERROR
panicline, withpanicandstack, and one Sentry event. - The worker logs each job with its
job_id, itssource(printormodule:<name>) and itsref, the ID of the request that sent it, never with what it prints. A job that fails after its retries is logged as ERRORjob failedand is reported to Sentry. - A module that builds an invalid receipt (
422module_failed) is logged as ERRORmodule built an invalid receipt, with themoduleand the number ofproblemsbut not the problems themselves, and is reported to Sentry once. - A notification card that cannot be laid out prints as a plain receipt,
and is logged as ERROR
module printed its fallback receipt, with themodule, the cause inerrand, after a panic, itsstack, and is reported to Sentry once. Neither quotes the notification. - Refusals are never logged at ERROR and never go to Sentry. Refusals are
4xx answers other than
module_failed, thequeue_fullandshutting_down503s, and 503s from/healthz.
- Each request is logged once, as
Command line
uberbringer [--config config.toml] run the daemon (default command)
uberbringer secret print a new random API secret
uberbringer token [--subject s] [--ttl 720h] print a signed bearer token
[--modules ntfy,notify] [--raw] ... limited to modules, or able to print raw ESC/POS
uberbringer preview [file.json|-] show the lines a job would print
uberbringer preview --module note [file|-] show the receipt a module builds
uberbringer config get <key> print one setting, e.g. webserver.port
uberbringer version print the version
token signs a token with api.secret. Without flags, it may use every
route but cannot print jobs with raw elements:
--rawlets it print them. Give it only to clients that send ESC/POS bytes of their own.--modules ntfy,notifylimits it to those modules' print and preview routes, job status and the module list. Give integrations, such as the ntfy client, one of these. The names must be modules the daemon has, and--rawcannot be added.
config get prints a setting as the daemon would use it, from the file,
UBERBRINGER_* variables and the defaults, and fails when the configuration
does not load. Durations print as 15s, lists comma-separated, and tables
as sorted name=value entries. It never prints api.secret.
Every command that reads the config takes --config (-c); see
Configuration for its default and for running without a
file.
preview reads a job from the file, or from standard input with - or no
argument, and lays it out for the printer in the config, as
/api/v1/preview does. It prints nothing and fetches no images. On a
terminal it shows bold, underlined and inverted text as such; warnings go
to standard error. With --module, the input is that module's payload, as
/api/v1/print/:module takes it, built at the time now. It reads the same
config as the daemon, so api.secret and printer.address must be set even
though neither is used.
The daemon shuts down gracefully on SIGINT/SIGTERM. A receipt that is already printing is finished, and jobs still waiting are marked failed.
Development
The Go version is the go 1.27.4 line in go.mod, the latest Go release:
- It is the minimum for building, and builds with
GOTOOLCHAIN=localneed at least that. With the defaultGOTOOLCHAIN=auto, an older local Go downloads go1.27.4 by itself. - CI tests, scans and releases with exactly that release; the workflows read
it from
go.mod. There is no separatetoolchainline. - To move to a new Go release, change the go line
(
go mod edit -go=1.27.5). In the same commit, bump the tool modules golang.org/x/tools, golang.org/x/vuln and honnef.co/go/tools.
make check # the CI gate, below
make build # bin/uberbringer
make fmt # gofmt + goimports
make vuln # govulncheck
make openapi # regenerate docs/swagger.json (go generate ./...)
make snapshot # release archives in dist/; publishes nothing
make check runs the same steps as .gitea/workflows/test.yml, in the same
order:
fmt-check: gofmt and goimports.tidy-check:go mod tidy -diff.go vet.- staticcheck.
openapi-check:go generate ./...must leavedocs/swagger.jsonunchanged.go test -race -timeout 5m.release-check:goreleaser check, which validates the release config without building.
It needs goreleaser installed. govulncheck is not part of it; run
make vuln. make snapshot builds the release archives locally; run it
after changing .goreleaser.yaml or packaging/. make builds report the
version without the leading v, e.g. 0.1.2-3-gabc1234, as release
binaries do.
docs/swagger.json is generated by tools/genopenapi from the route table
in internal/app/uberbringer/server/routes.go, which the server also
registers its routes from. The schemas come from the Go types the routes
name: their json and jsonschema tags and their doc comments. Never edit
the file by hand: change the route table or the types, run
go generate ./..., and commit the document with the change.
The linters are pinned as Go tools in go.mod, so go tool staticcheck,
go tool govulncheck and go tool goimports need no separate install. The
module path is uberbringer, so packages import as
uberbringer/internal/.... Build from a clone of the repository.
cmd/uberbringer/ main: build info, signals, exit code
internal/app/uberbringer/ CLI commands and wiring
server/ Fiber HTTP API, auth, health
internal/pkg/config/ Config from TOML and UBERBRINGER_* variables (Viper): defaults, validation
internal/pkg/escpos/ ESC/POS command builder, code pages, barcodes, QR, raster, status, interpreter
internal/pkg/receipt/ Job format, validation, text folding, word wrap, blocks, rendering, preview
internal/pkg/modules/ Modules that build jobs from plain payloads: note, notify, ntfy; notification cards, markdown
internal/pkg/ntfy/ ntfy's message types
internal/pkg/raster/ Image decoding, scaling and dithering
internal/pkg/safehttp/ SSRF-guarded image fetching
internal/pkg/printer/ TCP printer client (port 9100) and status queries
internal/pkg/printqueue/ Job queue, worker and status history
configs/ Example configuration
examples/ Example jobs, such as the block calibration receipt
packaging/ systemd unit
tools/genopenapi/ Generates docs/swagger.json from the route table
docs/ API reference, OpenAPI document, design notes and feature plans
docs/design.md explains why the daemon is shaped as it is. CHANGELOG.md lists the changes in each release.
CI and releases
CI runs on the Gitea runner from .gitea/workflows/. The repository has no
.github/ directory.
test.ymlruns themake checkgate on every branch push. It lints, checks thatdocs/swagger.jsonis up to date, tests and validates the release config, but builds no binaries, and it does not run on pull requests or tags. Binaries are built only byrelease.yml.security.ymlruns govulncheck on pushes to main and every Monday at 06:00 UTC. Scheduled runs use main's copy of the workflow.release.ymlbuilds and publishes a release with goreleaser 2.20.3 when av*tag is pushed.- It runs only for tags whose commit is on main, and refuses any other tag.
vX.Y.Z-rc.Ntags are published as prereleases, so they never become the latest release thatinstall.shinstalls.- Each archive holds the binary,
LICENSE.txt,README.md,docs/api.md,docs/swagger.json,CHANGELOG.md,configs/config.example.tomlandpackaging/uberbringer.service. - The release notes link to
CHANGELOG.mdat the tag.
License
Copyright © 2025-2026 William Gill.
Licensed under the European Union Public Licence v. 1.2 (EUPL-1.2). The full text is in LICENSE.txt, and translations into every official EU language are equally valid. Releases up to and including 0.1.2 were published under the GNU Affero General Public License v3.0.