Skip to content
Taveras Solutions · Go to home
Book a diagnostic

MITPython / FastAPI

CodigoQR-FastApi

An API and a UI to generate QR codes instantly.

You type the text, pick colors and format, and get the QR code as PNG or SVG. It is a lightweight FastAPI microservice with an HTML page that consumes it.

Stars
2
Forks
3
Language
Python / FastAPI
License
MIT

THE PROBLEM

Generating QR codes with custom colors and in vector format without relying on an outside service.

Who it's for

Developers who need to generate QR codes from their own system, and anyone looking for a short FastAPI example with a UI.

WHAT IT DOES

  • A POST /generate_qr endpoint that returns the code image.
  • PNG or SVG output, with three SVG modes: basic, fragment, and path.
  • Custom fill and background colors, validated as hex.
  • An HTML interface with Tailwind that calls the API with fetch.
  • Interactive API docs at /docs.

How it's built

  1. Interface index.html collects text, colors, and format and sends them to the API.
  2. API main.py validates input with Pydantic and builds the code with the qrcode library.
  3. Response The image is streamed back as PNG or SVG, without being saved to disk.

Stack

FastAPIPythonPydantic v2TailwindJavaScript

Getting started

pip install fastapi uvicorn qrcode[pil]
uvicorn main:app --reload
Open index.html in the browser with the API running

Need something like this built for you?

We use these same tools in our client projects.