Inspiration

A rider's most sensitive data is not their identity — it is where they were, how they moved, and what almost happened. Most safety products collect that data first and decide what to do with it later. I wanted to flip that boundary: record the ride privately on the phone, use on-device AI to understand it, and let the rider share only a small, verifiable proof.

Ridary is built for riders who want a record without building a surveillance profile of themselves. The same record can help cities see aggregate road-risk patterns and let an insurer verify a safety score without receiving a route, raw sensors, or identity.

What it does

Ridary is an iOS ride witness plus a web dashboard.

On iPhone, a rider starts a motorcycle or bicycle session and puts the phone away. GPS and motion are captured locally. A deterministic detector identifies candidate events such as hard braking, swerves, impacts, and long stops. No camera and no audio are used. The rider can lock the last 30 seconds into a protected local evidence packet with a SHA-256 integrity hash.

When the ride ends, Ridary produces a private recap with a score, risk moments, coaching, and a plain-language summary. Ask Ridary answers questions from a compact local context. Sensitive incident statements are pinned to on-device inference and fall back to local rules if the model is unavailable.

The web dashboard has a different job: anonymized events become a community risk map, and the rider can issue a signed Ridary Proof. An insurer can verify the score, period, and Ed25519 signature without seeing the route or rider identity.

How I built it

The iOS app is SwiftUI for iOS 26, with CoreLocation and CoreMotion capture, a file-backed local ride store, local evidence hashing, a custom sheet/map UI, and a testable deterministic event detector.

The web app is React + Vite + TypeScript. It uses Firebase Auth, Firestore, Cloud Functions, App Check, and MapLibre with the OpenFreeMap Positron style. The public insurer view is token-addressed and redacted.

Firebase AI Logic is the core hybrid layer:

  • iOS uses Apple Foundation Models through FirebaseAI for PREFER_ON_DEVICE ride snapshots and local-context answers. Cloud Gemini is the fallback for features that need it. The sensitive incident interview is ONLY_ON_DEVICE; if the model is unavailable, local deterministic rules answer instead of silently sending evidence to the cloud.
  • The web app uses firebase/ai hybrid inference with Chrome Nano when available and Gemini cloud fallback for the ride review, plus cloud inference for aggregate community insight.
  • Every AI output shows its source: On device, In cloud, Fallback, or Rules.
  • App Check is enforced for AI Logic and credential callables. Limited-use App Check tokens are used for AI Logic.
  • Cloud Functions never call Gemini. They aggregate derived event points, issue and verify Ed25519 credentials, and create short-lived redacted insurer views.

I also built a branded Remotion demo pipeline with real iOS simulator and live web footage. The footage is labelled as sample data, and the demo explains the simulator's speed limitation instead of presenting a fake ride.

Challenges

The hardest part was making privacy a real architectural property rather than a slogan. The AI prompts must not contain raw routes, sensor windows, incident evidence, hashes, signatures, or identities. The UI must also tell the truth when a preferred on-device path is unavailable.

The simulator does not provide realistic motion speed or Apple Intelligence availability in the same way a physical iPhone does. I kept those limitations visible: the demo labels sample footage, and the product shows real model availability and inference provenance.

Other challenges included keeping the evidence hash and credential flow consistent across Swift and TypeScript, making MapLibre useful in demo mode without a Firebase account, and designing a demo that shows functionality rather than a slide deck.

Accomplishments

  • End-to-end iOS capture, recap, Ask Ridary, evidence lock, and source provenance.
  • A public web risk map, signed Ridary Proof, and redacted insurer view.
  • A real Firebase AI Logic hybrid path on iOS and web with honest fallback labels.
  • Deterministic event detection and local evidence hashing behind the AI layer.
  • A live demo at ridary-demo.web.app, a public Apache-2.0 repository, and a complete 2:42 demo video.
  • A test suite covering iOS, web, and Cloud Functions: 40 iOS unit tests, 17 iOS UI tests, 23 web tests, and 33 Functions tests.

What I learned

On-device AI is not only a latency optimization. It changes what the product is allowed to promise. A good hybrid system needs a visible trust boundary, a deterministic fallback, and a UI that never hides where an answer came from.

I also learned that the demo is part of the product. Showing a real timer, a real 30-second lock, a real source badge, and a real signature is more persuasive than claiming a perfect autonomous safety system.

What's next

  • Android capture using the same Firebase AI Logic contracts.
  • Real-device ride validation and more robust motion thresholds.
  • App Attest instead of debug App Check in production.
  • A minimum-contributor threshold for public risk cells.
  • Carrier and insurer integrations that use the proof, not raw telemetry.
  • More languages, starting with Indonesian.

Honest limitations

Ridary is a personal safety record, not court-grade evidence, emergency dispatch, or an insurance guarantee. The demo uses sample data. The simulator cannot produce realistic ride speed; the public demo is labelled accordingly. No camera or audio is recorded, and the app does not call emergency services automatically.

Built With

  • apple-foundation-models
  • chrome-nano
  • cloud-firestore
  • ed25519
  • firebase-ai-logic
  • firebase-app-check
  • firebase-authentication
  • firebase-cloud-functions
  • firebase-remote-config
  • ios-26
  • kokoro-tts
  • maplibre-gl-js
  • node.js
  • openstreetmap
  • react
  • remotion
  • swift
  • swiftui
  • typescript
  • vite
  • xcodegen
Share this project:

Updates

Submission history