Inspiration
Medicine that is normal at home can get you stopped at a border. Pseudoephedrine, found in common cold tablets, is prohibited in Japan. ADHD medicine needs approval before you travel through the UAE. Most travellers check only their destination, never the layover, and checking means reading embassy pages in other languages or pasting your medical details into sites you don't trust. Two travellers, three medicines and three countries is already nine checks.
What it does
SCAN → HIDE → CHECK EVERY STOP → SHARE STATUS → SHOW THE OFFICER • Scan, privately. Gemini Nano, running inside Chrome, reads the medicine label on your laptop. The photo never leaves the device. You check what it read and confirm. • Check every stop. Each ingredient is checked for the destination and every layover against official government pages (Japan, UAE, Singapore, Greece, UK, USA). • Quote or it didn't happen. The app shows ✅ or ⛔ only when the rule's exact sentence is found word for word on the official page. Otherwise it says ⚠ not confirmed. • Proof of privacy. "What left this device" shows every request: only the ingredient and the country. A "Try to break it" lab fires five real attacks (sending a name, sending the photo, a fake quote, an unlisted URL, reading another family's trip) and shows each one blocked. • Family trips. Everyone shares a status, never their medicine. Amaka sees that Mum needs documents for Japan, not what Mum takes. • Show the officer. A Border Card in English and Japanese that reads itself aloud. Scan the QR code to carry it on your phone. The card travels inside the link, nothing is uploaded, and it opens with no signal. Every verdict screen says: "Information, not legal or medical advice. Confirm with the embassy."
How we built it
Firebase AI Logic gives us two brains behind one SDK, and each one does the job the other can't: • On device (ONLY_ON_DEVICE, Gemini Nano in Chrome): image to JSON label extraction and a framing check. Labels are private, so they stay on the laptop, free and offline. • In the cloud (ONLY_IN_CLOUD, Gemini on the free Developer API): reads long, often foreign-language official pages and returns the rule with an exact quote. These pages are far too big for Nano's context window. • PREFER_IN_CLOUD: translates the Border Card into Japanese. Every cloud call goes through one function, buildCloudRequest(), which allows only listed fields and refuses images. A Vercel function fetches only official pages from a fixed list, by country code. Our own code, not the model, checks that the quote is really on the page. Firestore holds only trip status and a shared cache of verified rules, never medicine tied to a person. App Check (reCAPTCHA Enterprise) protects AI Logic, all on the free Spark plan with no billing. The "Ran on: this device" and "Ran on: cloud" badges come from the SDK's real inference source, not from labels we wrote. Stack: React 19 + Vite + Bootstrap, Firebase (AI Logic, Auth, Firestore, App Check), Vercel. 153 unit tests and 7 Firestore rules tests pass; each privacy and truth rule has its own tests.
Challenges we ran into
• No billing, so no Search grounding. We read the official government pages directly and verify the quote word for word instead, which turned out stricter than web search. • Some official sites block bots (US CBP, UAE Ministry of Health, Japanese embassies). We found other official pages for the same rules and recorded each choice. • Nano on a low-end laptop. It reads clean labels exactly but busy real packs poorly, and a read can take up to 80 seconds. It also once copied an example ingredient from our prompt. We removed the examples and made the confirm step the safeguard: nothing is checked until you save. • Offline card. The service worker missed cached files because assets were served with Vary: Origin. We fixed it and tested in airplane mode on a real phone.
Accomplishments that we're proud of
• A real hybrid split: privacy on device, long pages in the cloud. • No verdict without a verified official quote. • A privacy lab judges can attack themselves. • A Border Card that works with no signal and speaks Japanese.
What we learned
The hard part of AI for legal-ish answers isn't the model. It's proving where the answer came from, and being honest when you can't.
What's next for Carry Safe
More countries and card languages, Search grounding once billing is available, natural voices, and Android (Gemini Nano) and iOS apps. Travel agencies, airlines and patient groups could offer a private pre-trip medicine check without ever holding health data.
Built With
- bootstrap
- chrome-prompt-api
- cloud-firestore
- firebase-ai-logic
- firebase-app-check
- firebase-authentication
- gemini
- gemini-nano
- javascript
- node.js
- pwa
- react
- recaptcha-enterprise
- vercel
- vite
- web-speech-api