DEV Community

Nishant Paudel
Nishant Paudel

Posted on

How We Engineered a 73% Cache Hit Rate Travel App with Vite + React

GoNepal - Cache-First Travel for Nepal’s Toughest Networks

GoNepal started out as a hackathon project, but right from the beginning, we focused on one big problem: Nepal’s network can be flaky, especially in the mountains, and most travel apps just aren’t built for that. So we built GoNepal to keep working even when your signal drops, your battery’s low, or you’re stuck translating between three languages.

The Core Idea: Cache Comes First

Most apps treat caching like an afterthought. We flipped that. For us, cache isn’t just a speed boost — it’s the backbone.

1️⃣ In-Memory Translation Cache

We built a translation engine that actually watches the DOM for changes (thank you, MutationObserver). Every time you translate something, we stash that result in RAM for the session — no more wasting API calls on the same text.

_const translationCache: Record = {};

export function getCachedTranslation(key: string) {
if (translationCache[key]) return translationCache[key];
return null;
}_

What does that give you? Lightning-fast repeat translations, fewer hits to the translation API, and less battery drain from all those little network wake-ups.

2️⃣ Persistent Offline Layer (localStorage*)*

Critical info gets saved locally, with a little strategy:

Weather? We keep it for 6 hours.

Trail maps? 7 days.

Emergency phrases and your digital tourist ID? Permanent.

Home base GPS? Also sticks around.

So even if you’re hiking off-grid, you’ll have your essentials ready.

3️⃣ Geofenced Safety Protocol

We use your home base GPS and your real-time location. If you stray more than 3km from your base, the app pings you with a warning. Need help? We check Overpass API for hospitals, hotels, and what’s nearby. Need to navigate? We deep link you straight into your native map app. And if you lose your connection, the safety features don’t just crash — they scale back and keep you as safe as possible.

4️⃣ Weather-Smart Itinerary Engine

No more canned suggestions. We pull live weather from Open-Meteo, do reverse geocoding to figure out where you actually are, then serve up recommendations based on the weather, the time, and your current spot.

Performance Target

We’re aiming for a 73% cache hit rate each session. That’s based on how much of the UI and data we can reuse — weather, translations, survival info. It’s a projection based on our app’s structure, not raw production stats (yet).

Tech Stack

_Vite

React (with Context for state)

Tailwind + shadcn/ui

Framer Motion (for page transitions)

Supabase

Leaflet + OpenStreetMap

Open-Meteo API

Overpass API

Vercel (CI/CD)_

Why Go This Route?

Most travel platforms expect you to always be online. In Nepal’s high-altitude trekking zones, that’s just not reality. We built GoNepal for spotty signals, for travelers juggling languages, for people who need their phone battery to last all day.

We’re still building. Would love to hear your thoughts, especially on:

_Cache invalidation

Scaling translations

Better offline sync_

Locking down digital ID security

A short Glance at our Home Page/Hero

Top comments (0)