← Back to Projects
TripTrack

TripTrack

A shared trip planner where a group builds one itinerary on a map and calendar, with AI suggestions that never change the plan until someone approves them.

ReactTypeScriptRedux ToolkitRTK QueryGoogle Maps APIPythonFlaskSQLAlchemyPostgreSQLSocket.IORedisGoogle Cloud TasksGemini AIMarshmallow
1,200+
automated backend tests
40
database migrations
3
AI providers with automatic fallback
CI
backend, frontend and browser tests on every push

The problem

Planning a holiday with friends usually means spreadsheets, pinned map links and endless group chats, with no clear way to agree on what makes the cut. TripTrack puts the schedule, the map, the budget and the group in one place, updates everyone's screen as soon as a change is saved, and lets AI draft or change plans without ever applying anything until a person approves it.

What it does

AI Trips With Approval

Describe a trip in one sentence, or ask for a change such as moving a dinner. Every AI result is shown as a suggestion to review before anything is saved.

Realtime Collaboration

Everyone viewing a trip sees changes the moment they are saved, on every device, so nobody is chasing the latest version through a group chat.

Google Calendar Sync

Keeps each trip in step with Google Calendar, with changes flowing both ways, so the whole group has the right plan in their own calendar.

Map and Calendar View

Shows the schedule and the map on one screen, with routes and place details from Google Maps.

Budget and Expenses

Tracks what everyone spends and splits costs between the group. Flights, templates and Word or calendar export sit alongside it.

Admin and Viewer Roles

Give co-planners full editing rights, or let others follow the plan without being able to change it.

See it working

A month calendar of a Lisbon trip beside a map of the planned places.
The trip schedule as a calendar, next to its places on the map.
A dialog titled Review proposed changes listing four suggested events, each with a checkbox, and buttons to reject all or apply the selected changes.
AI suggestions are reviewed first and only apply once you approve them.
A dialog titled Optimise your days where the user picks which days to improve and priorities such as minimising travel.
The day optimiser asks what to improve, then proposes changes to review.
A budget with spending by category, the group's balances, and suggested payments to settle up.
Spending against a budget, with suggested payments to settle up.
A saved flight showing departure and arrival airports and times, price and a book button.
Saved flights sit in the trip, with times, price and a link to book.
A day's events with a walking route drawn on the map between two of them and step-by-step directions below.
Routes between events are drawn on the map, with walking or transit directions.

How it's built

How TripTrack fits together: the browser talks to a Flask API, a change tracker on the database triggers realtime notices and background jobs, and jobs call Google Calendar and AI providers.

Frontend

  • React and TypeScript single page app built with Vite.
  • Server data lives in one RTK Query cache. When the server announces a change, only the affected cached data is refreshed, so the map, calendar and list always agree.
  • Redux slices hold only interface and sign-in state.
  • Google Maps renders the map, routes and place details.

Backend

  • Python and Flask using the application factory pattern: about 100 routes across 20 blueprints.
  • Marshmallow validates every request. SQLAlchemy and Alembic manage 24 tables on PostgreSQL.
  • Socket.IO rooms (one per trip and per user) deliver live updates, with Redis shared between server instances.

Background work and AI

  • Google Cloud Tasks runs calendar syncing and AI generation outside the request, calling back into the app with signed requests that are verified.
  • Gemini, Groq and AWS Bedrock sit behind adapters, and the app falls back to the next provider if one fails.
  • Web push notifications tell users when a background job has finished.

Delivery

  • Docker images for each service, a GitHub Actions pipeline, deployed on Google Cloud Run.

Key decisions and tradeoffs

  • One save hook powers live updates and calendar sync

    Instead of writing sync code for every feature, one listener watches the database save step, notes what changed, and announces it only once the save has definitely gone through. A failed save announces nothing.

    The cost: Behaviour that happens automatically is harder for a newcomer to trace, and every new table has to be registered with a rule for who should be told about it.

    Technical detail

    A SQLAlchemy listener collects changes after each flush, emits them only after the commit succeeds, and discards them on rollback. Thirteen models are registered, each with a resolver that finds the trip and users to notify. Calendar sync is a second listener on the same tracker that queues a push job for the changed items.

  • Use a managed task queue for slow work

    Calendar updates and AI calls take seconds. The hosting platform slows a server right down once it has replied to a request, so a job started in a thread would stall. Google's managed queue makes a fresh request back into the app, which runs at full speed and is retried automatically if it fails.

    The cost: Local development needs a stand-in for the queue, so the same job code runs either way, and the app depends on a Google service rather than software I run myself.

    Technical detail

    A dispatcher factory picks Cloud Tasks, a thread or an inline call. Task names are deterministic so a duplicate is ignored, callbacks are verified by checking Google's signed token, and each run is claimed atomically with an attempt limit.

  • AI proposes, people approve, and stale proposals are flagged

    An AI reply can take a while, and the plan may change in the meantime. So the result is a suggestion, not a saved change, and anything edited or deleted since the request started is flagged before the user applies it.

    The cost: Every AI feature needs an extra review step and a stored snapshot, which is more work than saving the result straight away.

    Technical detail

    A snapshot is taken before the slow call. Each entity type has a validator that checks the model's output, and registered appliers apply an approved change set. Anything that has changed or disappeared is marked CHANGED or DELETED in the preview.

  • Do not depend on a single AI provider

    A rate limit or outage at one provider should not switch off trip planning.

    The cost: Prompts have to work across different models, and each provider adds an adapter to maintain and test.

    Technical detail

    Gemini, Groq and AWS Bedrock adapters share one interface, and a request falls through to the next provider in order. AI endpoints have per-user rate limits by task type.

  • One cache for server data, refreshed by the server

    The map, the calendar and the location list all show the same trips and events. Keeping one cached copy and refreshing it when the server says something changed means they cannot drift apart.

    The cost: Redux Toolkit adds more setup and boilerplate than a lighter library would, in return for predictable updates and caching without extra code.

    Technical detail

    RTK Query defines about 86 endpoints with cache tags. A socket notice invalidates the tags for the changed trip, and only the affected queries refetch.

Hard problems I solved

  • Fixing time zones after launch

    The problem
    Event times were first saved with no time zone attached. When I added reminder notifications, a trip to Tokyo booked from London would have fired at the wrong local time.
    What I did
    I worked out a time zone for each trip from its map coordinates, backfilled every existing trip and event, and converted stored times to UTC by reading the old values as local to the trip, not to the user. The frontend converts in both directions using the trip's zone. I built and tested the migration on a separate branch with custom backfill scripts and only merged once the data and the frontend were both ready.
    The result
    Reminders fire at the right local time, and users with existing trips never saw incorrect data.
  • Taking AI out of the user's wait

    The problem
    The first version ran AI planning while the user waited for the request to finish, and saved the result straight away with no chance to check it.
    What I did
    Starting an AI feature now creates a background job that is picked up a moment later. Its progress is tracked and the user is told when it is done, instantly if they are still on the page or by push notification if they have moved on.
    The result
    Slow AI calls no longer block a request, and the result arrives as a suggestion to approve instead of something already saved.
    Code: runner.py

Testing and quality

About 1,230 backend tests across 96 files, about 250 frontend unit tests and 24 Playwright browser tests.

GitHub Actions runs the backend tests, then frontend lint, build and unit tests, then the browser tests on every push and pull request.

  • 40 Alembic migrations, including backfill scripts with their own tests.
  • Google refresh tokens are encrypted at rest.
  • Rate limits on AI and flight-search endpoints.

Known limitations

  • Some leftover MySQL-era code remains from before the database moved to PostgreSQL and is waiting to be removed.
  • Approving an AI proposal can overwrite newer edits to the fields it changes. A warning is shown, but it does not block acceptance and there is no automatic conflict resolution.
  • If an AI provider replies with something that fails validation, the request does not automatically retry with the next provider. Fallback only covers a provider that fails or returns nothing.
  • Repayment suggestions use a simple greedy match, so they are not guaranteed to need the fewest transfers, and group balances are held in a single currency (GBP).
  • Reminders run from a standalone script rather than inside the web process, so they need a scheduler.
  • Tests use fakes for Google, flights and AI, so they cannot show that the live integrations are configured correctly.

Database model

Schema for TripTrack

Use and further reading

Friends and early users have planned several real trips with it. Building it also taught me the wider Google Maps suite (Places, Directions, Geocoding and Time Zone) and how to handle geospatial and datetime data correctly.

Read more in the repo: CI workflow