Trij is an offline-first progressive web app that brings AI-assisted medical triage to community health workers in remote areas. Powered by Google DeepMind's Gemma 4 models — entirely on-device.
Built for the Gemma 4 Good Hackathon (Kaggle + Google DeepMind, $200K prize pool).
Track: Health & Sciences / Global Resilience.
Take a photo → AI assesses → Get urgency + recommendation → Save offline → Auto-sync
No internet needed. No patient data leaves the device.
- 📸 Wound & rash triage — Snap a photo, Gemma 4 analyzes it on-device
- 📄 Medical document scanner — OCR + analysis of lab reports, prescriptions
- 🎤 Voice-guided assessments — Speak in your language, get spoken responses
- 📋 Patient records — Create, view, and track patients offline
- 🏷️ Urgency triage — Green (routine), Yellow (soon), Red (urgent)
- 📎 Referral PDFs — Auto-generated referral slips for clinic handoff
- 🔄 Offline-first sync — All data stored locally, syncs when online
- 🌍 Multilingual — English, Spanish, French, Swahili, Hindi, Arabic, Portuguese
- 🔒 Privacy-first — All AI runs on-device. No cloud AI API.
| Layer | Technology |
|---|---|
| Frontend | Vite + TanStack Start + React 19 + TypeScript |
| AI | WebLLM (WebGPU) + Ollama bridge + Demo mode |
| Styling | Tailwind CSS v4 + shadcn/ui |
| Offline | Dexie.js (IndexedDB) + background sync |
| Backend | Supabase (Auth, Postgres, Storage, RLS) |
| Voice | Web Speech API (7 languages) |
| PWA | vite-plugin-pwa (installable on Android/iOS) |
- Node.js 22+
- Bun (recommended) or npm
- A Supabase account (free tier)
- (Optional) Ollama for local Gemma 4 inference
git clone https://github.com/Mosss-OS/trij.git
cd trij
bun install- Create a project at supabase.com
- Copy
.env.exampleto.envand fill in your Supabase credentials - Run migrations:
npx supabase db push| Option | Setup | Notes |
|---|---|---|
| Demo mode | Nothing to do | App works immediately with mock data |
| Ollama | ollama pull gemma4 |
Best real-model experience on laptop |
| WebLLM | Requires Chrome + WebGPU | Loads ~1.5GB model on first triage |
For Ollama:
ollama pull gemma4
# Or download from Kaggle: scripts/download-gemma4.shbun run devOpen http://localhost:5173 — sign up, and you're ready.
cp .env.docker .env
docker compose upThis starts the app (hot-reload), Ollama with Gemma 4, and a local Supabase stack.
Open http://localhost:5173.
src/
├── routes/ # TanStack file routes
│ ├── index.tsx # Login / sign-up
│ ├── _app.tsx # Auth layout
│ ├── _app.dashboard.tsx
│ ├── _app.triage.tsx # Camera → AI → result
│ ├── _app.document.tsx # Document scanner
│ ├── _app.patients.index.tsx
│ ├── _app.patients.$patientId.tsx
│ ├── _app.supervisor.tsx
│ └── _app.settings.tsx
├── components/ # Reusable UI components
├── lib/ # Core logic
│ ├── gemma.ts # WebLLM + Ollama + demo engines
│ ├── gemma-prompt.ts # System prompts for Gemma 4
│ ├── db.ts # Dexie IndexedDB schema
│ ├── sync.ts # Background sync engine
│ ├── voice.ts # Speech I/O
│ └── referral.ts # PDF generation
├── hooks/
│ ├── useGemma.ts # Model lifecycle hook
│ └── useOnlineStatus.ts
├── stores/ # Zustand state
└── types/
- Technical writeup: TECHNICAL_WRITEUP.md
- SRS: SRS.md
- Development prompt: DEVELOPMENT_PROMPT.md
- Model setup: scripts/download-gemma4.sh
See CONTRIBUTING.md for development setup, code conventions, and pull request process.
Apache 2.0 — see LICENSE.
Built with ❤️ for the Gemma 4 Good Hackathon.