Skip to content
AI-powered appsNewChat, vision, voice, generationBookings & schedulingAppointments that book themselvesShops & sellingA storefront in every pocketClient & businessRun the operation from one placeCommunities & clubsA home that is not a group chat
Health & wellnessHabits, tracking and calmGames2D, 3D and multiplayerPersonal & toolsThe tool you wish existedInternal toolsThe tool ops never had time for
See all use cases
ArcadeNewPricingSecurity
EngineThe game engine and World EditorHow it worksFrom one sentence to a live productDocsGuides for building and publishingBlogStories, guides and newsChangelogWhat shipped latelyStatusUptime of every serviceSupportGet help from the team
AI-powered appsBookings & schedulingShops & sellingClient & businessCommunities & clubsHealth & wellnessGamesPersonal & toolsInternal tools
See all use cases
ArcadeNewPricingSecurity
EngineHow it worksDocsBlogChangelogStatusSupport
Language
Blog
GuidesNovember 22, 20266 min read

How to Build a QR Code Generator

A static QR code is the destination itself, frozen in ink. A dynamic one points at a short link you control. That one choice shapes the whole app.

Startbase Team
Editorial ink illustration of a rubber stamp lifted off a paper tag leaving a checkered square print, the ink pad in ember orange

Key takeaways

  • Static codes encode the content directly: free, permanent, untrackable and impossible to change after printing.
  • Dynamic codes encode a short link you own, so you can change the destination and count scans, but they break if your service goes away.
  • Most failed scans come from design, not data: low contrast, a missing quiet zone or a logo covering too much.

A QR code generator turns text, a link, Wi-Fi details or contact information into a square pattern a phone camera can read. Building one is mostly about one decision: static codes put the content straight into the pattern, while dynamic codes put a short link to your own service into the pattern and look up the real destination when someone scans. Static is simpler and permanent. Dynamic adds editing and scan counts, at the cost of a database, a redirect and a promise to keep the service running for as long as the codes are printed.

Static vs dynamic codes

  • Static: the URL or text is encoded directly. Generating it needs no server at all; it can happen in the browser. It works forever, even offline, but you cannot change it or count scans. A typo on 5,000 printed flyers is permanent.
  • Dynamic: the code contains something like yourdomain.com/q/7Hk2pQ. Scanning hits your service, which logs the scan and redirects to the current destination. You can fix typos, swap a seasonal menu, and see scans by day, but the code depends on your domain and database staying alive.

A good generator offers both and explains the difference in one sentence on the create screen. Restaurants, events and packaging usually want dynamic. Wi-Fi codes, contact cards and anything personal usually want static.

What a code can contain

Phones recognize several formats beyond plain links, and supporting a few makes the tool far more useful:

  • URL: the most common. Validate the scheme and show the final link before generating.
  • Wi-Fi: network name, password and security type in the WIFI: format; scanning offers to join the network. Always static: there is no reason for a Wi-Fi password to pass through your server.
  • Contact card: a vCard with name, phone, email and company.
  • Plain text, email, SMS and phone number: simple prefixes that open the right app.

The data model for dynamic codes

  • codes: id, owner, short slug, name ("Table tents, spring menu"), type, current destination, design settings (colors, logo path, error correction level), active flag, created at.
  • destination_history: code id, old destination, new destination, changed by, changed at. When someone asks why the poster went to the wrong page last Tuesday, this answers it.
  • scans: code id, time, coarse country, device type and a likely-bot flag. No precise location and no IP addresses.
  • daily_scan_stats: a nightly rollup for fast charts.

Static codes do not need a table at all, but saving them to the user's account (content plus design settings) is a kindness: people come back months later to reprint the same code.

Pausing and retiring codes

Dynamic codes outlive campaigns. A flyer from last summer is still taped to a café wall, and someone will scan it. Never delete a dynamic code that has been printed. Instead, let owners pause it (scans land on a friendly "this offer has ended" page with a link to the main site) or point it at an evergreen page. Give the owner a fallback destination per code, used when the code is paused or the main destination is removed, so a scan never ends in an error page with your brand on it.

The hard part: codes that scan every time

Generating the pattern is a solved problem; well-tested open source libraries do it in a few lines. What makes a generator good is preventing the mistakes that make printed codes fail:

  • Contrast. Dark modules on a light background, with strong contrast. Inverted codes (light on dark) and pale brand colors fail on many older scanners. Warn when contrast is low.
  • Quiet zone. Scanners need an empty margin around the code, four modules wide in the specification. Users love cropping it off. Bake it into the export.
  • Error correction. QR codes have four levels (L, M, Q, H), recovering roughly 7, 15, 25 and 30 percent of damaged data. A logo in the middle needs level H and should cover well under that share of the code.
  • Data length. More data means more, smaller modules. This is a quiet advantage of dynamic codes: a short slug produces a simple, chunky pattern that scans from farther away, even when the real destination is a long tracking URL.
  • Print size. A common rule of thumb is a scanning distance about ten times the code's width, so a code meant to be read from a meter away should be around 10 cm wide. Treat it as a starting point and test.
  • Export format. Offer SVG or PDF for print, which stay sharp at any size, and PNG for screens.

Tip

Build a "Test scan" step into the flow: show the final code full screen and ask the user to scan it with their own phone before downloading. It catches most design mistakes before they are printed.

Serving dynamic scans

The redirect behind a dynamic code is the same mechanism as a link shortener: look up the slug, log the scan, send the phone onward. A Startbase web app is a static single-page app, so a redirect from the published site happens in the browser after the page loads, which is acceptable for a phone that just scanned a code but adds a moment of delay. A server-side redirect can run in an edge function. Our URL shortener guide covers the tradeoff, bot traffic and abuse controls in more detail; all of it applies here.

Put dynamic codes on a domain you control. If codes point at a generic subdomain and you later move, every printed code breaks. Custom domains are available on paid plans, and connecting one before the first print run is much easier than after.

Screens of a first version

  1. 01Create: choose a type, fill the fields, choose static or dynamic, see a live preview update as you type.
  2. 02Design: foreground and background colors with a contrast warning, an optional center logo (which switches error correction to H), and a frame with a short call to action such as "Scan for the menu".
  3. 03Download: SVG, PDF and PNG, with the quiet zone included, plus the test-scan step.
  4. 04My codes: every saved code, with scans in the last 30 days for dynamic ones.
  5. 05Code detail: change the destination (logged to history), pause the code, see scans per day.

A brief for Startbase

Build a QR code generator web app for small restaurants and shops. Anyone can make static codes without an account (URL, Wi-Fi, contact card, plain text), generated in the browser. Signed-in users can make dynamic codes that point at /q/:slug on our site; scanning logs the scan (time, country, device, likely bot, no IP) and redirects to the current destination. Users can edit a dynamic code's destination, and every change is kept in a history list. Design options: colors with a contrast warning, a center logo that forces error correction level H, and a frame with a short label. Downloads in SVG, PDF and PNG with the quiet zone included. Add a full-screen test-scan step before download, and a My codes page with 30-day scan counts.

For a shop or menu use, the shops use case has related ideas worth combining, such as a menu page the code opens. Connecting a custom domain explains the DNS side, and the small business guide has more ideas for printed codes.

Out of scope for v1

  • Bulk generation from a spreadsheet of hundreds of codes.
  • Artistic codes with heavily styled modules or images blended in, which fail more often.
  • Payment codes and app-store routing by device.
  • Paid plans for scan limits, until free users actually exist.

Frequently asked questions

What is the difference between a static and a dynamic QR code?

A static code stores the content itself and can never change. A dynamic code stores a short link to a service that redirects to a destination you can edit, and it can count scans, but it stops working if that service shuts down.

Do QR codes expire?

Static codes never expire because the content is in the pattern. Dynamic codes work only as long as the service and domain behind them keep running.

Can I put a logo in the middle of a QR code?

Yes, if you use the highest error correction level (H) and keep the logo small. Always test-scan the final printed design with several phones.

How big should a printed QR code be?

A common rule of thumb is a width about one tenth of the scanning distance, with a clear margin around it. Test at the real distance before printing a large run.

On this page

  • Static vs dynamic codes
  • What a code can contain
  • The data model for dynamic codes
  • The hard part: codes that scan every time
  • Serving dynamic scans
  • Screens of a first version
  • A brief for Startbase
  • Out of scope for v1

Keep reading

More in Guides
Editorial ink illustration of a kitchen scale with an apple on its pan beside a notepad and a spoon, the apple in ember orange
GuidesNovember 22, 2026

How to Build a Calorie Tracker App

Calorie tracking fails when logging is slow or the numbers are wrong. Get reliable food data, make repeat meals one tap, and be honest that every number is an estimate.

6 min read
Editorial ink illustration of two tin-can telephones joined by a string across a garden fence, the knot in the string in ember orange
GuidesNovember 22, 2026

How to Build a Chat App

Chat looks simple and hides four hard problems: delivering messages live, knowing who is online, tracking who has read what, and keeping strangers from abusing it.

6 min read

Read less. Ship more.

Everything in this post is one prompt away. Describe your app and watch it build.

Start building

Apps, games, backends and publishing from one conversation.

Product

  • Features
  • Use cases
  • Pricing
  • Changelog

Resources

  • Blog
  • Docs
  • Support
  • Status
  • Security

Contact

  • w@startbase.ai
  • X / Twitter
  • LinkedIn
  • Instagram

Legal

  • Terms
  • Privacy

© 2026 Startbase. All rights reserved.