AI • Science • Technology • Future

Side Projects

How a Solo Developer Built a Real-Time AI Travel Card

Image from the original article
Featured image: original publisher image. Via original publisher.

A solo developer from Thessaloniki, Greece, built an AI-powered travel feature that delivers real-time flight and hotel data directly in chat. The system uses structured outputs and backend proxies to avoid hallucinations and ensure accuracy. Source: dev.to.

How the Travel Card Works

The core idea is simple: the AI never invents prices or booking links. Instead, it emits a structured JSON block with only the user’s intent.

When a user asks about flights or stays, the AI responds in natural language and adds a small JSON object. This object includes origin, destination, dates, guest count, and three curated hotel suggestions.

The backend then fetches live prices and partner links using Travelpayouts APIs. The frontend renders an interactive card that users can navigate without leaving the chat.

Three Clear Layers of Responsibility

  • AI Agent: Parses user intent and emits a structured JSON block. It does not generate prices or links. This ensures that the AI remains focused on understanding what the user wants, rather than fabricating data.
  • Backend Proxy: Runs on FastAPI. It holds the secret Travelpayouts token, resolves typos, and fetches live data with fallbacks. The backend acts as a secure, isolated layer between the AI and the external APIs, preventing any exposure of sensitive credentials or private tokens in the frontend or in user-facing responses.
  • Frontend Card: Renders the card in real time. It allows users to switch dates, tabs, and cities with instant updates. The card is designed to feel native to the chat interface, not like a clunky, out-of-place widget.

Stack and Tools Used

The system uses Python with FastAPI for the backend. FastAPI is chosen for its speed, asynchronous capabilities, and ease of use in handling HTTP requests with minimal overhead. It supports async operations, which are critical for performance when making multiple API calls in parallel.

The backend communicates with Travelpayouts via the httpx library, which provides asynchronous HTTP client functionality. This allows the system to make multiple requests efficiently without blocking the main thread, improving responsiveness and reducing latency.

The frontend uses React and TypeScript with Tailwind CSS. React enables dynamic, component-based rendering of the travel card, while TypeScript ensures type safety and reduces runtime errors. Tailwind CSS provides a responsive, modern design that adapts seamlessly to different screen sizes and devices.

Travelpayouts provides the data through several key endpoints:

  1. Flight prices via Aviasales API v3: This endpoint returns real-time flight prices for routes between airports, based on actual market data. It is powered by a massive cached index, which makes it fast and reliable, though it has limitations when dealing with rare or obscure routes.
  2. City and airport autocomplete via places2: This endpoint allows users to type in short names like ‘ny’ or ‘mow’ and get accurate IATA codes for cities or airports. It is essential for handling user input errors and ensuring that the system can interpret natural language queries correctly.
  3. Partner link conversion via the links/v1/create API: This endpoint converts standard URLs into affiliate links that track clicks and generate revenue for the developer or partner. It is only effective when the user’s account has joined specific programs such as Aviasales, Trip.com, or Airalo.

Key Implementation Challenges

Several real-world problems emerged during testing and deployment. These challenges were not only technical but also deeply rooted in the behavior of third-party APIs and user expectations.

Challenge 1: Empty Flight Results on Exact Dates

Travelpayouts caches flight prices by date, but the cache is not always comprehensive. If a user searches for a specific day—such as a Tuesday in a small or niche route—the API may return no results at all.

This issue is particularly problematic because users expect to see options when they input a specific date. To address this, the system implements a three-stage fallback waterfall:

Image from the original article
original publisher image. Via original publisher. · Source
  1. Exact date search: First, the system attempts to retrieve prices for the exact departure and return dates provided by the user.
  2. Flexible month search: If no results are found, the system strips the day from the date (e.g., ‘2026-12-10’ becomes ‘2026-12’) and searches for the cheapest flights in that month. A subtle ‘flexible dates’ badge is then displayed to inform the user that the search is not exact.
  3. Cheapest upcoming flights: If the month-level search also returns nothing, the system falls back to showing the cheapest available flights in the next few weeks. This ensures that users still see real, viable options, even if their original date is not available.

The backend implements this logic with a clean, asynchronous pattern. If no flights are found after all stages, the UI displays a message indicating that the route may not be available, and the user is gently guided to adjust their dates or destination.

Challenge 2: User Typos and Shorthand City Names

Users naturally type shorthand names like ‘ny’, ‘ldn’, or ‘mow’ instead of full city names. These inputs can lead to incorrect or missing results, especially when the system relies on full city names for IATA code resolution.

To solve this, the system combines a small, hardcoded alias dictionary with a debounced frontend autocomplete feature. For example:

aliases = {
  'ny': 'New York',
  'ldn': 'London',
  'mow': 'Moscow',
  'ist': 'Istanbul',
  'par': 'Paris',
  'tok': 'Tokyo'
}

When a user types ‘ny’, the system first checks the alias dictionary and resolves it to ‘New York’. It then sends a request to the places2 API to confirm the IATA code (KAT for Atlanta, JFK for New York). This two-step process ensures that even typos are handled gracefully and accurately.

The frontend uses debounced input to avoid sending multiple requests when a user types quickly. This improves performance and reduces unnecessary API calls.

Challenge 3: Partner Links API Rate Limits

Travelpayouts imposes a strict limit of 10 URLs per batch in the partner links conversion API. If the system loops through links one by one, it will hit rate limits and introduce significant delays.

Each batch is processed independently, and the results are stored in memory with a one-hour cache TTL.

This reduces the total time from over 10 seconds to under 2 seconds, while still respecting the API’s rate limits.

If a link fails to convert—due to missing program access or an invalid URL—the system gracefully falls back to the original URL. This ensures that users never see broken or non-functional buttons, maintaining a smooth user experience.

When a user manually types a new city into the card’s search box—say, switching from Istanbul to Moscow—the AI’s initial curated hotel list no longer applies. The system must generate new, relevant suggestions for the new destination.

To solve this, a new /travel/stays endpoint is implemented. This endpoint generates pre-filled hotel search links with check-in, check-out, and guest count fields. It also provides fallback category cards such as ‘Top Central Boutique Stays in Moscow’ or ‘Best Value Hotels in Moscow’ to guide users when no specific hotels are available.

Image from the original article
original publisher image. Via original publisher. · Source

Real photos are fetched using a multi-candidate retry mechanism. If the first photo fails to load, the system tries a second, third, or even a fallback image from a curated database. This ensures that the UI always displays high-quality, visually engaging content, avoiding broken or grey boxes.

Frontend Design for Natural Flow

The card is designed to feel native, not like a clunky widget. Key design choices include:

  • Switching between flight and stay tabs, or changing dates, is instantaneous. The cache is refreshed only when the user manually clicks a ‘Refresh’ button, which bypasses the cache and fetches live data.
  • Independent calendars: Flight and stay dates are not tied together. Users can fly overnight or stay in multiple cities on one trip. This design flexibility allows for more realistic and personalized trip planning.
  • Even in poor network conditions or missing assets, the user still sees meaningful information.
  • Auto-collapse older cards: If a user plans multiple trips in one long conversation, only the latest Travel Card is expanded by default. Older cards are collapsed into a sleek, one-line summary bar that users can re-expand at any time. This keeps the interface clean and avoids visual clutter.
  • These buttons feed directly into the AI companion, allowing users to extend their conversation with natural, context-aware follow-ups.

Monetization and Data Flow

Travelpayouts allows affiliate links for brands like Aviasales, Trip.com, and Airalo. These links are only converted when the user’s account has joined those specific programs. This means that the system does not generate links for services it has no access to.

Before monetization works, the domain must be verified. The source recommends adding a verification script to the frontend index.html file. This script includes a hidden meta tag or a script tag that matches Travelpayouts’ domain verification pattern. Without this, the API will reject or skip the affiliate links entirely.

Only programs the user has joined are converted. Random hotel websites or unconnected brands will fail. A small allow-list on the backend ensures that only known, approved domains are processed. If a link fails, the system falls back to the direct URL, ensuring that users never see a dead button.

Why This Matters for Solo Builders

This feature demonstrates that complex AI interactions do not require large teams or massive funding. A solo developer can build real, interactive features that rival those from billion-dollar labs.

By clearly separating the AI’s role—understanding intent—and the backend’s role—fetching live data—the system avoids hallucinations and edge cases. The AI is responsible only for interpreting what the user wants, while the backend handles the messy, real-world details of data retrieval, error handling, and user experience.

The timeline shows that ARPA.CHAT has shipped features such as interactive maps and live chess games 6 to 12 months before major AI labs release them. This indicates that innovation often begins at the edge—where solo developers experiment with simple, focused ideas and iterate rapidly.

Such features offer tangible value to users—real-time pricing, curated hotel suggestions, and instant booking links—while opening new revenue streams through affiliate partnerships.

Limitations and Open Questions

Travelpayouts does not offer APIs for food delivery apps or AirBnB. These services have no public consumer APIs or vendor-side access. This means that the system cannot show real-time food availability in cities like Thessaloniki via Wolt or provide dynamic restaurant recommendations.

Image from the original article
original publisher image. Via original publisher. · Source

While the system works well for flights and hotels, it cannot show real-time food availability in cities like Thessaloniki via Wolt. This limitation highlights the gap between AI-powered travel planning and the full ecosystem of local services.

The eSIM feature is limited to Airalo and requires pre-verified partner links. It adds minimal UI overhead but is genuinely useful for travelers, especially those arriving in new countries who need instant connectivity.

Rate limits and caching are managed, but the system still depends on third-party data availability and accuracy. Flights may be canceled, prices may change, and hotels may be unavailable—so the system must be designed with dynamic fallbacks and user education.

What to Watch Next

As more AI agents adopt structured output patterns, similar travel cards may become standard in chat interfaces. This could lead to a new category of AI-powered digital assistants that operate like personal travel managers.

Developers should watch for updates to Travelpayouts’ API, especially around link conversion, data freshness, and new partner integrations. Future versions may offer more granular control over pricing, real-time updates, or deeper integration with local services.

Future work could expand to include real-time weather, local events, or activity recommendations—using open APIs or curated data sources. For example, integrating weather data from OpenWeatherMap or event data from Google Calendar could allow AI companions to suggest ideal travel days or activities based on conditions.

For a deeper dive into how structured extraction works in AI agents, see The Real Cost of Structured Extraction.

For a comparison of how AI agents handle decisions without backends, see Ask a Friend with No Backend.

For a similar project on archiving game data, see GamerScroll.

Try the Travel Card live at arpa.chat. Ask your AI companion to plan a weekend trip or find flights anywhere in the world.

Got questions about Travelpayouts quirks, FastAPI proxying, or structuring LLM UI cards? Drop them in the comments—happy to help fellow solo builders ship faster.

Sources & further reading

Featured image: original publisher image. Via original publisher. Image source