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
IntegrationsNovember 22, 20265 min read

Scan QR Codes in a Web App

A web app can read QR codes through the phone camera without anyone installing anything. Here is how scanning works, where iPhones differ, and how to make check-in safe.

Startbase Team
Editorial ink illustration of a magnifying glass over a square ticket stub pinned to a corkboard, the magnifying glass rim in ember orange

Key takeaways

  • Web apps can scan QR codes with the camera over HTTPS; use a JavaScript library so it works in Safari on iPhone as well as Chrome on Android.
  • Treat every scanned value as untrusted input: never auto-open links, and verify tickets on the server.
  • Make check-in atomic: one database update that only succeeds if the ticket has not been used yet.

Yes, a web app can scan QR codes with no app install. The page asks for camera access with the browser's getUserMedia API (HTTPS only), streams the rear camera into a video element, and a JavaScript decoding library reads codes from the frames several times a second. Chrome on Android also has a built-in BarcodeDetector, but Safari on iPhone does not offer it at the time of writing, so use a library such as ZXing, jsQR, qr-scanner or html5-qrcode as the default or the fallback. If the code is a ticket or pass, send the value to your server to verify it instead of trusting the phone.

What you will build

A scanner screen for staff or users: full-width camera view with a square guide, a beep and vibration on success, and a big green or red result card ("Valid: Maya Cohen, General admission" or "Already checked in at 19:42"). Real uses: event door check-in, a library or tool-lending checkout, inventory counts where each shelf has a code, a museum trail that unlocks stops, or a game where players scan codes hidden around a venue. If you need to make the codes, our QR code app guide covers generating them, static versus dynamic codes and print rules.

What you need

  • HTTPS. Browsers only give camera access on secure pages. Published Startbase sites are served over HTTPS on startbase.app or your custom domain, so this is handled once you publish.
  • A scanning library. No account or key: these are open-source packages your app bundles.
  • A backend, if scans mean something. Tickets, loans and points must be checked and recorded on the server; an edge function is the natural place.
  • A real phone to test on. Laptop webcams focus poorly at close range and hide problems your users will hit.

Getting the camera right

  • Ask on a tap. Call getUserMedia when the user presses "Start scanning", not on page load. A denied prompt is hard to undo: the user must change it in browser settings, so show short instructions if access was refused.
  • Rear camera. Request facingMode: "environment". Ask for a moderate resolution (around 1280 by 720); higher resolution makes decoding slower without reading codes better.
  • iPhone quirks. The video element needs the playsinline and muted attributes, or Safari tries to play it full screen. Home-screen web apps on older iOS versions had camera restrictions; test the exact way your users open the app.
  • Decode a crop, not the frame. Draw only the central square of the video to a small canvas and decode that, about 8 to 15 times a second. It is faster, uses less battery and avoids reading the wrong code when several are in view.
  • Torch and focus. Some Android browsers expose a flashlight toggle through the camera track's capabilities. Offer it when present; dim venues are where check-in happens.
  • Stop the camera. Stop every track when the scanner closes or the tab is hidden. A camera light that stays on erodes trust fast.

Tip

Always offer a fallback: a "type the code" field and, for odd devices, a file input with accept="image/*" and capture="environment", which opens the camera app and lets you decode the photo it returns.

Data flow for ticket check-in

  1. 01What the code holds. Not the attendee's details: a random ticket token with enough entropy to be unguessable (at least 128 bits, for example a long random string). Optionally prefix it with your domain so stray scans can be recognized as yours.
  2. 02Scan. The scanner decodes the token and immediately pauses decoding for about 1.5 seconds, so one code is not submitted ten times.
  3. 03Verify. The page sends the token and the event ID to a check-in function. The function confirms the staff member is allowed to check in for that event.
  4. 04Mark used atomically. One update: set checked_in_at = now() where token matches, event matches and checked_in_at is null. If it updated one row, the ticket is valid. If zero rows, look up why: unknown token, wrong event, or already used (and when).
  5. 05Respond and log. Return the attendee name and ticket type, or the reason for refusal. Log every attempt in a scans table with time, staff member and result, so disputes at the door can be settled.

The single conditional update matters. Two staff at two doors scanning the same screenshot at the same second cannot both get "valid", because only one update can change a null to a time. The event ticketing guide covers the rest of that system: ticket types, transfers and refunds.

A brief you can paste

Add a staff check-in scanner at /checkin, available to users with the staff role for the selected event. A Start scanning button opens the rear camera (playsinline, muted, about 1280x720) with a square guide; decode QR codes from the center crop about 10 times per second using a library that works in Safari on iPhone. On a read, pause scanning for 1.5 seconds, vibrate, and send the token to an edge function check-in that verifies the staff member, then sets checked_in_at only if it is still empty, in one update. Show a full-screen green card with the attendee name and ticket type, or a red card saying unknown ticket, wrong event, or already checked in with the time. Log every scan. Include a manual code field, a torch toggle when the device supports it, and stop the camera when leaving the page.

Pitfalls

  • Auto-opening scanned links. A sticker over a real QR code can point anywhere. If your scanner handles URLs, show the full domain and ask before opening it, and only follow links on domains you expect.
  • Putting data in the code. A code that contains "name=Maya;paid=true" can be forged by anyone with a QR generator. Codes should carry an unguessable token; meaning lives in your database.
  • Offline doors. Venue Wi-Fi fails. If check-in must work offline, download the event's token list to the device before doors open and sync results later, accepting that two offline devices could both admit a duplicate until they sync.
  • Screen glare and brightness. Codes shown on phones are harder to read at low brightness. Ask attendees to turn brightness up, and keep your ticket page's code large with a white quiet zone around it.
  • Testing only on desktop. Focus distance, permissions and video playback rules all differ on phones. Test on at least one iPhone and one Android phone.

Scanning is a good fit for a web app precisely because nobody has to install anything at the door. If you are weighing a web app against a native one for this, PWA vs native app lays out the tradeoffs.

Frequently asked questions

Can a website scan QR codes without an app?

Yes. Over HTTPS, a web page can use the phone camera through getUserMedia and decode QR codes with a JavaScript library. The user only has to allow camera access.

Does QR scanning in the browser work on iPhone?

Yes, with a JavaScript decoding library. Safari on iPhone does not offer the built-in BarcodeDetector API at the time of writing, and the video element needs the playsinline attribute so it stays inside the page.

How do I stop the same ticket being scanned twice?

Mark the ticket used with a single conditional update that only succeeds when it has not been used. If the update changes no row, report the earlier check-in time instead of admitting the ticket.

Why is my web QR scanner slow?

Usually it decodes full-resolution frames too often. Request a moderate resolution, decode only a central crop, and limit decoding to about 10 frames per second.

On this page

  • What you will build
  • What you need
  • Getting the camera right
  • Data flow for ticket check-in
  • A brief you can paste
  • Pitfalls

Keep reading

More in Integrations
Editorial ink illustration of a folded paper street map with a brass compass and pushpins, the center pushpin in ember orange
IntegrationsNovember 22, 2026

How to add a map to your app

A map is two jobs: drawing tiles in the browser and turning addresses into coordinates. One key can be public, the other never should be.

6 min read
Editorial ink illustration of a carrier pigeon on a windowsill with a rolled note tied to its leg, the note in ember orange
IntegrationsNovember 22, 2026

How to send SMS from your app

Sending one text is ten lines of code. Sending texts people agreed to, that arrive, and that nobody can abuse, is the real work.

5 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.