A simple API server for generating QR codes.
- ✅ Asynchronous QR code generation
- ✅ Fast and lightweight
- ✅ Different formats (PNG, SVG, etc.)
- ✅ Customizable QR code size, color, etc
Clone the repository
git clone https://github.com/tobycm/qr-code-generator-server
cd qr-code-generator-server
Install the dependencies
bun i
Start the server
bun run start
Returns a message:
{
"message": "Hello World"
}
Generates a QR code.
Any text data
Examples:
https://tobycm.dev
-
format
The format of the QR code. Default is
png
.Supported formats:
png
svg
utf8
(try it out xd)
-
margin
The margin of the QR code. Default is
4
. -
errorCorrection
The error correction level of the QR code. Default is
M
.Supported error correction levels:
L
M
Q
H
-
scale
The pixel per block of the QR code. Default is
4
. -
width
The width of the QR code. Overrides
scale
. -
background
The background color of the QR code in RGBA. Default is
#ffffffff
. -
foreground
The foreground color of the QR code in RGBA. Default is
#000000ff
.
Headers:
-
Content-Type
The content type of the QR code. Based on the
format
query parameter.
Body:
The QR code image or text data.
Request:
POST /qr?format=svg&margin=8&errorCorrection=H&scale=8&background=%23ff0000ff&foreground=%2300ff00ff
Body:
https://tobycm.dev
This project is licensed under the MIT License - see the LICENSE
file for details.
Any contribution is appreciated. Just create an issue/pull request and I will review it ASAP.
If you like this project, please give it a ⭐ and share it with your friends!