Skip to content

Caching, Queues & Real-time

Three problems that always travel together: short-lived shared state (cache), background work (queues), and live bidirectional connections (real-time). The portfolio's defaults are Redis + BullMQ + Socket.IO — with a handful of deliberate exceptions (pg-boss, Celery, arq, Redis Lists).


Redis

What it is. In-memory key-value store with optional persistence. Used for caching, session storage, pub/sub, distributed locks, rate-limit counters, and as the broker for BullMQ.

Why we use it. Fast (microsecond latency), tiny ops footprint (one container), single tool that handles 5+ jobs.

Image: Redis 7.x in compose (7.4 in DOC-AI and GoGreen Verify).

Used in: 17 of 28 products — - Toolbelt Handyman — sessions + BullMQ. - SuperCabs — ioredis cache (including the LLM client budget/cache) + BullMQ. - BidIt — cache + BullMQ worker. - Workflow Hub — BullMQ, rate limiting, WebSocket pub/sub. - DOC-AI — arq broker (Redis 7.4). - GoGreen Verify — BullMQ (Redis 7.4). - AutoDiag AI — cache. - OpenSentinel — BullMQ (Redis 7). - AI Concierge — BullMQ. - SmartForms — Celery broker. - APEX Sales Training — sessions + rate limiting. - Recruiting AI — BullMQ (noeviction policy). - PoligoPro — redis ^5 cache with an in-memory fallback. - HouseKey — BullMQ (host port 6391). - VotigoPro — redis:alpine for the Laravel queue worker. - Marketing AI — Redis Lists (LPUSH/RPOP) as the job queue with a dead-letter list; no BullMQ. - Tutor AI — Redis 7 for sessions (connect-redis) and BullMQ on the same instance.

Products with no Redis found: Sourcing AI, GameTrakker, Go Green Transit, GoGreen Seller AI (pg-boss instead), Do Me A Ditty (pg-boss instead), Writers Room (front end only; its engine is the Workflow Hub), Sell Me A Pen, GGPI website (in-process scheduler instead), Maximus Pet Store and Pecos River Traders (Laravel database driver for cache, queue and session; Redis appears only as an optional line in Maximus's .env.example), and Jarvis (neither the Electron nor the Tauri app uses Redis; the Tauri app's only server is a Postgres container).

Comparison alternatives (not used): - KeyDB / Dragonfly — Redis-protocol-compatible, multithreaded forks. Higher throughput. Not needed at portfolio scale. - Memcached — older, simpler. Loses out to Redis on data structures. - Upstash Redis / Vercel KV / Cloudflare KV — managed Redis-like services. Not used; self-hosted Redis on the IONOS VPS is the default.


BullMQ

What it is. Robust Node.js job queue backed by Redis. Successor to Bull. Features: delayed jobs, repeatable cron, retries with backoff, rate limiting, job priorities, scheduled jobs, and bull-board for a web UI.

Used in (10 products): - Toolbelt Handyman — BullMQ 5.7. - SuperCabs — BullMQ 5.76. - BidIt — BullMQ 5.21 in a dedicated apps/worker. - Workflow Hub — BullMQ 5.34; the Workflow Hub engine runs on BullMQ to execute multi-step user workflows. - GoGreen Verify — BullMQ 5. - OpenSentinel — BullMQ 5.34, central queue for agent jobs. - AI Concierge — knowledge-processing workers. - Recruiting AI — 9 distinct queues (email, sms, webhook, notification, rag-indexing, rag-graph, reminders, cleanup, code-execution), bull-board UI exposed. - HouseKey — BullMQ 5.1 (ragQueue). - Tutor AI — BullMQ ^6.3 with two queues (sessions, maintenance) on the shared Redis; enabled by QUEUE_ENABLED, plus cron-style RAG reindex and memory backfill jobs.

Pattern. A separate worker process consumes from the queue (so the web tier stays responsive). Common to ship the worker as a sidecar container in docker-compose.yml.


pg-boss

What it is. Postgres-native job queue. Uses Postgres LISTEN/NOTIFY and a pgboss schema instead of Redis. Persistence, retries, throttling, cron — same shape as BullMQ but no Redis dependency.

Used in: - GoGreen Seller AI — pg-boss ^10, chosen so the Electron-embedded server needs no Redis.

Tradeoffs. Postgres becomes both the data store and the queue — simpler infra, but heavier load on Postgres. Throughput ceiling lower than BullMQ for very high job rates; well above what this app needs.


Celery (Python)

What it is. The Python world's BullMQ. Distributed task queue with Redis or RabbitMQ broker, beat scheduler, flower UI.

Used in: - SmartForms — Celery ≥5.3 with Redis, queues for processing and webhooks.


arq

What it is. Async-first Python job queue. Uses Redis. Lighter than Celery, native asyncio.

Used in: DOC-AI (arq 0.28).

Why arq over Celery here. The DOC-AI service is async-throughout (FastAPI + asyncpg + LangChain async); arq fits that style.


Other schedulers and queues

  • Redis Lists + dead-letter list — Marketing AI's Go workers pull jobs with RPOP instead of using BullMQ.
  • Laravel queue worker — VotigoPro (backed by Redis).
  • Laravel database driver — Maximus Pet Store and Pecos River Traders configure cache, queue and sessions on the database driver; no Redis container and no dedicated worker.
  • node-cron — OpenSentinel's scheduled jobs.
  • In-process schedulers — GGPI website runs setInterval jobs from a job registry (booking reminders, invoice dunning, blog auto-publish) with no queue library; GameTrakker uses a VPS crontab hitting a cron endpoint guarded by CRON_SECRET; PoligoPro exposes cron endpoints.
  • Kafka (aiokafka) — AutoDiag AI, optional, with an in-memory fallback.

Socket.IO

What it is. Real-time framework over WebSocket with HTTP long-polling fallback. Rooms, namespaces, automatic reconnection, ack callbacks. Cluster-aware via Redis adapter.

Used in (6 products): - Toolbelt Handyman — Socket.IO 4.8 plus a ws bridge for voice. - SuperCabs — NestJS realtime gateway, Socket.IO 4.8 (rider/driver live location and trip state). - BidIt — Socket.IO 4.8 gateway for live auctions. - AI Concierge — dashboard and widget namespaces. - HouseKey — Socket.IO ^4.7. - GGPI website — socket.io-client on the client alongside the raw ws chat endpoint.

Why Socket.IO over raw ws. Multi-room broadcast, fallbacks, reconnect logic, server-side adapter for horizontal scaling. Worth the extra protocol overhead for chat.


Native WebSockets (ws library)

What it is. Raw RFC 6455 WebSockets. Lower overhead, no automatic rooms or reconnection.

Used in: - Toolbelt Handyman — Twilio <-> OpenAI Realtime bridge. - Sell Me A Pen — chatHandler bridging to OpenAI Realtime. - APEX Sales Training — voice-websocket. - Recruiting AI — OpenAI Realtime bridge. - GoGreen Verify — ws 8. - GGPI website — /ws/chat and /ws/chat/realtime. - Tutor AI — ws ^8.18, tutor session handler in src/realtime/tutorHandler.ts. - Jarvis (Electron) — ws ^8.16 in ws-bridge.js, connecting the desktop app to the OpenSentinel server. - Jarvis (Tauri) — Rust tokio-tungstenite (rustls) for the OpenAI Realtime voice connection. - OpenSentinel — WebSocket input channel. - Workflow Hub — /ws via @fastify/websocket, fanned out through Redis pub/sub for live execution updates.

When raw ws is the right pick. Voice / OpenAI Realtime API integration — those are RFC-6455 connections, not Socket.IO. Anything where you control both ends and don't need rooms.


LiveKit

What it is. Open-source WebRTC media server plus SDKs for real-time audio/video rooms.

Used in: BidIt — livekit-server v1.8 with the JS SDK ^2.9, and the LiveKit plugin in the Capacitor Android app, for live-stream auctions.


Server-Sent Events (SSE)

What it is. One-way HTTP streaming from server to client. Browser-native (EventSource), reconnects automatically, plays nicely with HTTP/2.

Used in: Vercel AI SDK in Workflow Hub, and HouseKey's POST /ai/chat/stream. Lightweight alternative to WebSockets when you only need server -> client.


tRPC

What it is. End-to-end type-safe RPC for TypeScript. The client gets the types of every server procedure for free. Subscriptions over WebSocket are supported (used as a real-time mechanism).

Used in: GoGreen Seller AI (tRPC 11 between the Electron renderer and its embedded server).

Tradeoff vs. REST. Rapid iteration when client and server are in the same repo; harder to expose to non-TS consumers. The portfolio uses REST elsewhere.


Real-time on the client

Library Where
socket.io-client Workflow Hub, BidIt, AI Concierge, GGPI website, SuperCabs
Native WebSocket Voice apps, OpenAI Realtime, GGPI website chat
EventSource (SSE) LLM streaming UIs
@trpc/client + @trpc/react-query GoGreen Seller AI

What NOT to reach for

Tool Why not
Kafka Only AutoDiag AI wires it (optional, with an in-memory fallback). BullMQ + Redis covers everything below ~10K jobs/sec.
RabbitMQ BullMQ / pg-boss fill its niche with less ops.
NATS No use case in the portfolio.
AWS SQS / Pub/Sub The portfolio is self-hosted on IONOS — no managed-cloud queues.
Inngest / Trigger.dev / Temporal Workflow engines. Workflow Hub plays this role internally; no need for an external one.

No realtime or queue layer was found in Sourcing AI, GameTrakker (its POS keeps an offline queue instead) or the Go Green Transit API.


Push notifications (server-initiated, distinct from in-app realtime)

  • Expo push notifications — SuperCabs and the other Expo mobile apps.
  • Capacitor push-notifications plugin — AI Concierge Android app.
  • Desktop — native OS notifications from the Electron / Tauri shells.

See Integrations-Comms.md for the integration side.


Cache patterns seen in the codebase

  • Per-request memoization — in-process Map / LRU; GoGreen Seller AI keeps an in-process LRU.
  • Redis-cached Postgres reads — TanStack Query handles client-side, Redis handles server-side.
  • Embedding cache — Seller AI's RAG path keeps an embedding LRU cache; saves OpenAI calls. SuperCabs' LLM client adds a budget and cache layer through ioredis.
  • Rate-limit counters — Redis is the standard store (Workflow Hub, Marketing AI, APEX Sales Training).

Decision guide

Need a cache?                                          Redis.
Need background jobs in a TypeScript app?              BullMQ (default) or pg-boss (drop Redis).
Need background jobs in a Python app?                  arq (async) or Celery (mature).
Need a chat / multi-room real-time channel?           Socket.IO.
Need a voice / OpenAI Realtime channel?               Raw ws.
Live audio/video rooms?                                LiveKit.
Just streaming LLM tokens to the browser?             SSE.
Need type-safe RPC, single TS team?                   tRPC.
"Should we add Kafka / RabbitMQ?"                     Probably no — start with BullMQ.