An open API service indexing awesome lists of open source software.

https://github.com/fabioc-aloha/qr-code

Azure Functions HTTP API for generating PNG, JPEG, and SVG QR codes from text, URLs, and workflow payloads.
https://github.com/fabioc-aloha/qr-code

azd azure-functions bicep jpeg logic-apps nodejs png qr-code qrcode serverless svg typescript

Last synced: 19 days ago
JSON representation

Azure Functions HTTP API for generating PNG, JPEG, and SVG QR codes from text, URLs, and workflow payloads.

Awesome Lists containing this project

README

          

# qr-codes

![qr-codes banner](assets/banner.svg)

QR code generation HTTP API. Mirrors a useful subset of [goqr.me's `create-qr-code` API](https://goqr.me/api/doc/create-qr-code/), runs on Azure Functions Premium.

## What this is

A small HTTP endpoint that turns text or a URL into a QR code image. Called from server-side automation (Azure Logic Apps and any HTTP client) to embed QR codes in outbound emails or documents. End recipients never call the API directly — they just see the embedded image.

```http
GET /api/v1/create-qr-code/?data=Hello+world HTTP/1.1
Host: .azurewebsites.net

HTTP/1.1 200 OK
Content-Type: image/png
Cache-Control: public, max-age=31536000, immutable
Content-Length: 1541

```

## Documentation

Everything user-facing lives in **[`docs/`](docs/)**. Pick the doc that matches your role:

| You are… | Read |
|---|---|
| Calling the API from an Azure Logic App | [docs/logic-apps-integration.md](docs/logic-apps-integration.md) |
| Calling the API from anything else (curl, browser, custom script) | [docs/api-reference.md](docs/api-reference.md) |
| **Deploying to your own Azure subscription** | [docs/deployment.md](docs/deployment.md) |
| Maintaining this codebase | [docs/developer-guide.md](docs/developer-guide.md) |
| Stuck — something isn't working | [docs/troubleshooting.md](docs/troubleshooting.md) |

The full index lives at [docs/README.md](docs/README.md).

## Quick try

Once you have a deployment (see [Quick Azure deploy](#quick-azure-deploy) below), test it:

```pwsh
Invoke-WebRequest "https://.azurewebsites.net/api/v1/create-qr-code/?data=Hello+world" -OutFile qr.png
Start-Process qr.png
```

For 13 ready-made sample QRs covering every supported content type (URL, vCard, Wi-Fi, mailto, tel, SMS, geo, calendar, branded colours, SVG output, ...), see [qr-samples/](qr-samples/).

## Quick local dev

```pwsh
npm install
Copy-Item local.settings.json.example local.settings.json
npm test # 172 tests pass
npm start # `func start` on http://localhost:7071
```

Full developer setup, deploy mechanics, infrastructure detail, and v2 planning are in [docs/developer-guide.md](docs/developer-guide.md).

## Quick Azure deploy

```pwsh
Copy-Item qr-codes.config.example.json qr-codes.config.json
# Edit qr-codes.config.json with your subscription ID, region, tags
./scripts/deploy.ps1
```

This works against any Azure subscription you have Contributor + RBAC Administrator on. See [docs/deployment.md](docs/deployment.md) for the full walkthrough, prerequisites, costs, and optional custom-domain binding.

## Repo layout

```text
src/ # TypeScript source — the Function App
test/ # 172 vitest tests
bench/ # Performance harness + committed baselines
infra/ # Bicep templates (azd-compatible)
scripts/ # PowerShell helpers: configure-azd + deploy
docs/ # Audience-specific documentation (start here)
qr-samples/ # 13 ready-made sample QR codes (12 PNGs + 1 SVG)
.github/workflows/ # CI (build/test/audit/SBOM/CodeQL)
azure.yaml # azd manifest
qr-codes.config.schema.json # JSON Schema for IDE validation of config
qr-codes.config.example.json# Template to copy + edit
qr-codes.config.json # Your edited copy (gitignored)
host.json, package.json, tsconfig.json, vitest.config.ts
```

## Key facts

| | |
|---|---|
| **Deployment** | `azd up` from any Azure subscription with the config in place; see [docs/deployment.md](docs/deployment.md) |
| **Default hostname** | `https://func-qr--.azurewebsites.net/api/v1/create-qr-code/` |
| **Custom hostname** | Optional, bound manually after deploy ([Map a custom DNS name](https://learn.microsoft.com/azure/app-service/app-service-web-tutorial-custom-domain)) |
| **Test count** | 172 (vitest) |
| **Worst observed p99** | 16.85 ms (latest bench; SVG path is 0.94 ms) |
| **Live PROD ramp test** | Production sustained 41,449 req/min for SVG at 200 concurrency and 7,902 req/min for JPEG at 25 concurrency, both with 0 errors (local client, 2026-05-28) |
| **Cold start** | None (EP1 with `alwaysOn=true` + 1 pre-warmed instance) |
| **Auth in v1** | None (open service); break-glass via `AUTH_MODE=production` |

## License

MIT. See [LICENSE](LICENSE).