Architecture

Docs: Jekyll · Mermaid diagrams · Playwright E2E · Prettier formatting

flowchart LR A["POS / Client"] -->|"Raw ESC/POS
TCP 9100"| B["Node.js sidecar
apps/sidecar"] B -->|"Internal HTTP ingest
token-auth"| C["Laravel API"] C --> D["Store print_jobs
+ broadcast events"] D --> E["Inertia React UI
Jobs / Listeners / Profiles"]

Technical flow: TCP ingest → sidecar parsing → Laravel ingest/storage → realtime UI.

Stack

Local Setup

cp apps/web/.env.example apps/web/.env
cp apps/sidecar/.env.example apps/sidecar/.env
make up           # or: make up ENGINE=docker
kiri compose exec web composer install
kiri compose exec web php artisan key:generate
kiri compose exec web php artisan migrate --seed

Make Targets

Target Description
make up Start stack (build)
make down Stop stack
make logs Follow logs
make ps Show services
make test Web + sidecar tests
make lint Pint + TS lint/checks
make e2e Playwright smoke tests

Use ENGINE=docker to run with Docker Compose. Kiri is the default runtime.

Configuration

Web (apps/web/.env)

  • DB_* — database
  • REVERB_*, VITE_REVERB_* — realtime
  • SIDECAR_INTERNAL_URL — web to sidecar
  • SIDECAR_SHARED_TOKEN — internal auth
  • LARAVEL_CONTROL_TOKEN — sidecar to Laravel control
  • PRINT_JOBS_RETENTION_DAYS — prune retention (default 30)

Sidecar (apps/sidecar/.env)

  • Listener bind/port settings
  • Laravel ingest URL/token
  • Parser/runtime settings

Key Routes

  • /jobs — Jobs workspace
  • /jobs/{id} — Job detail
  • /jobs/feed — polling feed
  • /listeners — listener management
  • /printer-profiles — printer profiles
  • /jobs?ui=blade — Blade fallback

Internal Behavior

  • Print jobs stored in print_jobs.
  • Ingest is idempotent by external_id.
  • Raw payload preserved, including parse failures.
  • Internal endpoints validate sidecar token.
  • Job/listener/profile queries scoped to authenticated user.

Testing

make test
make lint
make e2e

Manual:

kiri compose exec web php artisan test
kiri compose exec web ./vendor/bin/pint --test
kiri compose exec sidecar npm test
kiri compose exec sidecar npm run lint
kiri compose exec web npm run build

TCP Smoke Test

printf "\x1B\x40Hello ESC/POS\n\x1D\x56\x00" | nc 127.0.0.1 9100