Skip to content
Nomad Programmer

Find your next path.

87 results · Tab to explore · Esc to close

Showing the first 40. Add a word to narrow the search.

TypeScript

Indian Railway Station Search

Next.js app to search Indian Railway stations with fast, accessible UI.

Next.js / TypeScript

Inside the implementation / Source-backed flow

The search lives in the browser.

  1. 01

    Station data

    CDN-hosted JSON is loaded into browser memory. A non-OK HTTP response triggers the bundled JSON fallback.

  2. 02

    Weighted search

    Fuse.js prioritizes station names and codes, then regional names, district and state.

  3. 03

    Suggestions

    Up to 50 ranked matches. Arrow keys, Enter and Escape are handled by the search component.

  4. 04

    Station cards

    Selected station codes are deduplicated. Cards show the location and available regional-language names.

Recent selections → localStorage → latest 10 station records.

Source snapshot: StationSearch.tsx ↗. This is station discovery, without train schedules or ticket availability.

What it does

Search stations by name or code-built for travelers and developers integrating rail data.

The problem

A station may be known by its code, English name, or a regional name. This tool brings those ways of searching into a single interface, then keeps selected stations together for reference.

Implementation

The inspected implementation uses Next.js 14, React 18, TypeScript and Fuse.js 7. Station JSON is fetched into the browser, where Fuse builds a weighted search index. Name and station-code matches have weight 2, regional-language names 1.5, and district/state 1. Results are capped at 50 suggestions.

Selecting a suggestion adds a station card. Repeated station codes are deduplicated. The latest ten selections are stored in localStorage so the interface can offer recent choices on the same browser.

These details come from StationSearch.tsx at revision a0c8dcb, rather than assumptions about a production backend.

Decisions and tradeoffs

Search in the browser. A local Fuse index avoids a search-server round trip after the dataset loads. The tradeoff is downloading and indexing the complete station dataset on the user's device. No mobile performance benchmark is claimed here.

More than one station at a time. Selected station cards support comparison and reference. Available information includes regional names, district/state, address and coordinates; completeness varies by record.

A bounded recent list. Ten recent selections give returning visitors a shortcut without requiring an account. These records are local to the browser, not synchronized between devices.

Limitations

The CDN fallback is conditional: a non-OK HTTP response triggers the bundled JSON. A rejected network request or invalid JSON reaches the error path instead. This is not comprehensive offline support.

Keyboard handling exists for suggestions, but the inspected source does not establish a complete combobox/listbox accessibility pattern. That remains an improvement opportunity for the project itself.

This app searches station records. It does not supply live trains, ticket booking, schedules, or seat availability. The dataset is CDN-hosted; it should not be presented as a real-time government API.

Source and next steps

The working behavior above is supported by the search implementation, station cards, and package declarations.

Useful next steps include testing the data-loading failure paths, measuring first-search performance on a phone, and reviewing suggestion semantics with assistive technology. These are proposed improvements, not completed changes to the linked repository.

Stack

  • Next.js App Router
  • TypeScript
  • Static-friendly data loading

Continue through the lab

More to explore.

All projects ↗