DEV Community

adi-ray
adi-ray

Posted on AI-assisted

Trip Buddy — I built my friend a budget trip planner on an open-weight model

Hacktoberfest Weekend Challenge: Build for a Friend Submission 🤝

This is a submission for the Hacktoberfest Weekend Challenge: Build for a Friend

What I Built

MY FRIENDS loves to travel but plans trips the hard way: one tab for trains, five for hostels, a dozen blog posts listing "top 10 things to do", and a mental map that never quite fits into the days available. They're heading to Manali next month with three days and a student budget."

Trip Buddy turns that into one form. Enter where you're starting, where you're going, how many days, a budget, and what you're into. You get:

  • Getting there: train / bus / flight options from your city, cheapest first, with rough costs
  • Where to stay cheaply: three affordable areas with nightly price ranges and why each one works
  • Getting around: local transport options and what they cost
  • What to see, in what order: the famous sights grouped into days by geography, each day routed as a loop from where you're staying, with start times, travel minutes, and a lunch break, all on a map

How I Built It

The key decision: the LLM researches, plain code optimises.

form ──► /api/plan ──┬─► open-weight LLM (Llama 3.3 70B, OpenAI-compatible API)
                     │     → transport, stays, sights with coordinates (strict JSON)
                     ├─► OpenStreetMap Nominatim
                     │     → real coordinates for the destination
                     └─► optimize.js (no AI)
                           priority-select within the time budget
                           → k-means into days → nearest-neighbour + 2-opt per day
                           → timed schedule
Enter fullscreen mode Exit fullscreen mode
  1. Research (open-weight model). One call to Llama 3.3 70B returns structured JSON: transport options, budget stays with coordinates, 10–16 attractions with coordinates, realistic time-on-site, must-see flags, entry fees and best time to visit. Temperature is low, and the prompt asks for price ranges, never exact prices.
  2. Grounding (OpenStreetMap). Models sometimes place things in the wrong city. I geocode the destination with Nominatim and drop any "attraction" more than 80 km away. In testing, a stray "Taj Mahal" in a Jaipur plan was filtered out.
  3. Optimisation (deterministic code). Asking an LLM to "order these optimally" gives a plausible-looking but unverifiable answer. So optimize.js:
    • picks sights by priority (must-sees first) until the day budget is full
    • clusters them into days with k-means (farthest-point init, so it's deterministic), then rebalances overloaded days
    • routes each day as a loop from the stay: nearest-neighbour, then 2-opt
    • converts that into a timed schedule with travel estimates and lunch

In my Jaipur test, Amber Fort, Jaigarh Fort and Nahargarh landed on one day, and City Palace, Jantar Mantar and Hawa Mahal (a few hundred metres apart) on another. That's what a local would tell you.

  1. Frontend. One HTML page with Leaflet and OpenStreetMap tiles. Each day gets its own colour on the map.

No npm dependencies: Node's built-in http and fetch, plus 7 unit tests with node:test.

Why Does Open Innovation Matter?

  • I can swap the brain in two lines. The app speaks the OpenAI-compatible protocol, so Llama on Groq, Qwen on OpenRouter, or a model on my own laptop through Ollama all work by changing LLM_BASE_URL and LLM_MODEL. No vendor lock-in for a tool I'm handing to a friend.
  • It costs my friend nothing. Open-weight models on free inference tiers, OpenStreetMap for maps and geocoding, no paid map SDK. A student trip planner shouldn't need a credit card.
  • It can go fully offline and private. Point it at Ollama and the trip plan (where you're going, when, and your budget) never leaves the laptop.
  • Open data keeps the model honest. OpenStreetMap lets me check the model's coordinates against real geography for free. That's why the itinerary is grounded instead of just sounding right.
  • I control the behaviour, not a black box. The parts that must be correct (what fits in a day, what order to go in) are code I can read, test and fix. The open model does what it's good at: knowing that Jaipur has a ₹300 composite ticket and that you should hit Amber Fort before the heat.

How I Worked

I built this with Claude Code, from idea to tested app in one sitting.

AI Disclosure

Code and this write-up were produced with help from an AI coding agent (Claude Code), reviewed and tested by me. Trip Buddy itself runs on an open-weight model (Llama 3.3 70B).

Top comments (0)