Skip to content
Case Study

How We Built BookMyYaan: A Bus & Hotel Booking Platform with FastAPI & Next.js

VViznetic EngineeringMay 20, 202612 min read
How We Built BookMyYaan: A Bus & Hotel Booking Platform with FastAPI & Next.js

BookMyYaan is our own product, live at bookmyyaan.com: bus tickets on real operator seat maps, and hotel rooms with rates and cancellation terms shown before payment. Building it ourselves meant the failures were ours to design out rather than a vendor's to apologise for.

The problem is the seams, not the search box

Travel booking rarely fails at the search box. It fails where systems meet: a fare that moves between the result and the payment screen, a supplier that times out mid-booking and leaves nobody sure whether a ticket exists, a cancellation whose refund you only learn after committing to it. Those three set the architecture.

Why FastAPI + Next.js

  • FastAPI gives us async I/O — a booking is mostly waiting on a supplier, and nothing else should block while it does.
  • Next.js gives us a fast, SEO-friendly storefront, and an admin panel on the same stack.
  • The typed API client is generated from the backend’s own OpenAPI schema, so the two cannot drift apart.
  • PostgreSQL is the only database in every environment, including tests — there is no SQLite fallback to pass a test the real system would fail.

Provider-neutral adapters

Inventory reaches us through a supplier aggregator, but nothing above the adapter boundary knows that. Bus and hotel each have one provider-neutral interface, a registry routes per product, and each product has its own kill switch. Adding a second supplier is writing an adapter, not reshaping the public contract.

Idempotency is the whole trick

Every supplier call that spends money is written through a ledger keyed on the operation and an idempotency key, unique in the database. A retry, a double-click or a replayed payment result replays the recorded answer instead of buying a second ticket. The guarantee lives in a UNIQUE constraint, not in client-side caution.

-- The duplicate-booking guarantee, as a constraint rather than a convention.
ALTER TABLE booking_attempts
  ADD CONSTRAINT uq_booking_attempt
  UNIQUE (operation, idempotency_key);

Collect, then book

Checkout verifies the gateway signature first, then re-reads the payment server-to-server and compares its amount against the booking’s own total before the supplier’s irreversible call is made. The client’s word decides whether to look; the gateway’s own record decides what is true. No card data touches our servers.

Takeaways

The right architecture is the one that lets your team move quickly today and still scales tomorrow. We optimize for clarity, measurable performance, and a codebase your team can own.

Building something similar? We would love to help you ship it — get in touch for a free consultation.
V
Viznetic Engineering

Ten years of building software across web, mobile, and cloud.

Ready to start your project?

Tell us what you're building. We'll come back within one business day with ideas and next steps.