$ show ni5arga/sightline
Sightline is a Next.js web application for discovering and analyzing real-world infrastructure using OpenStreetMap data. It provides a search interface that accepts natural language queries (e.g., 'telecom towers in karnataka') or structured syntax (e.g., 'type:telecom operator:airtel region:karnataka'). The application uses Nominatim for geocoding to convert location queries to bounding boxes, then queries the Overpass API for matching OSM assets. Results are displayed on an interactive Leaflet map with marker clustering and in a filterable list. The architecture features a clean separation between frontend React components, backend API routes for search and geocoding proxying, and utility libraries for query parsing, caching, and API interactions. The application implements proper rate limiting, timeout handling, fallback API endpoints, and efficient caching to respect external service limits while providing a responsive user experience.
The LLM identified 5 files worth highlighting for reuse:
Implements a robust in-memory caching system with TTL-based expiration and LRU eviction when exceeding max size. Features isolated key generation strategy, automatic cleanup of expired entries, and thread-safe operations. Demonstrates non-obvious skill in cache invalidation strategies and size management. Easily extractable to any JavaScript/TypeScript project with minimal modification.
Handles geocoding via Nominatim with proper rate limiting (1 request/second), server/client environment detection, and timeout management. Includes automatic fallback to proxy when client-side to avoid CORS issues. Shows expertise in respecting API usage policies while maintaining responsiveness. The module is largely isolated from framework specifics and could be adapted to other geocoding services with minimal changes.
Builds and executes Overpass API queries with intelligent fallback across multiple endpoints. Implements proper timeout handling, query construction from OSM tag mappings, and response parsing into standardized asset formats. Demonstrates skill in handling API rate limits and failures gracefully. The query building logic is decoupled from OSM specifics and reusable for any Overpass API interaction.
Parses both natural language and structured infrastructure queries into normalized query objects. Features extensive pattern matching for 100+ asset types, operator aliases, and geographic modifiers. Shows craftsmanship in handling ambiguous user input while maintaining precision. The parsing logic is completely isolated and reusable for any domain-specific query system.
Defines comprehensive TypeScript interfaces for all data structures and maps OpenStreetMap tags to application asset types. Includes detailed operator aliases for common variations (e.g., 'google' → 'google llc', 'google inc'). Demonstrates deep domain knowledge of OSM tagging conventions. The mappings are completely reusable in any OSM-based project and represent significant curation effort.