Service: QR Code Generator - EyevinnOSC/community GitHub Wiki

QR Code Generator

QR Code Generator (serviceId eyevinn-qr-generator) is an open source service that creates a QR code image for a URL, with an optional logo overlay. In Eyevinn Open Source Cloud (OSC) it is a long-running service instance; each instance serves a single QR code at a stable URL.

What it can do

  • Generate a QR code image that encodes a URL (GotoUrl).
  • Overlay a logo in the center of the QR code (LogoUrl; the upstream project recommends a square logo).
  • Provide a stable image URL to embed in print materials, landing pages or digital signage, without a third-party QR service. To change the QR code, update the instance.

Creating an instance

Create the instance with create-service-instance using serviceId: "eyevinn-qr-generator". The name must be alphanumeric and at most 20 characters. The service has no dependencies.

{
  "name": "myqr",
  "GotoUrl": "https://example.com/landing",
  "LogoUrl": "https://example.com/logo.png"
}

Wait with wait-for-service-ready, then use describe-service-instance for the instance URL. OSC CLI forms: npx -y @osaas/cli create eyevinn-qr-generator myqr -o GotoUrl="https://example.com/landing", optionally with -o LogoUrl="https://example.com/logo.png".

Options

Option Required Type Meaning
name Yes string Name of the instance. Letters, digits and underscore only, at most 20 characters; also part of the instance URL.
GotoUrl Yes string The URL the QR code encodes (the upstream project's TEXT setting, which can be any text such as a webpage URL).
LogoUrl No string Public URL of a logo image to place in the center of the QR code (the upstream project's LOGO setting).

Using the instance

The QR code image is served at the root path of the instance URL, for example https://myqr.eyevinn-qr-generator.auto.prod-se.osaas.io/. The service has no authentication; the image is publicly accessible. Embed it directly:

<img
  src="https://myqr.eyevinn-qr-generator.auto.prod-se.osaas.io/"
  alt="QR code"
  width="200"
  height="200"
/>

React:

function QRCodeImage({ instanceUrl }: { instanceUrl: string }) {
  return <img src={instanceUrl} alt="QR code" width={200} height={200} />;
}

Resources