Skip to content

Conversation

SakshiKekre
Copy link
Collaborator

Implements automatic country detection and redirect at root path (/) using IP geolocation.

Implementation

  • Primary provider: ipapi.co (30k free requests/month, no API key required)
  • Fallback: Browser language detection
  • Cache: 4-hour localStorage TTL for traveling users
  • Note: ipinfo.io provider tested but not active (50k free tier available if needed)

Performance Testing

Tested detection timing from initial page load:

  • IP detection: ~333ms
  • Total time to redirect: ~4.8s (mostly React app initialization)

Architecture

  • Chain of responsibility pattern for provider fallbacks
  • Geolocation service under /routing since it's routing-specific
  • Clean separation: providers handle detection, service orchestrates, component handles UI

Why ipapi.co

  • Larger free tier than alternatives
  • Simple country-only endpoint (2 bytes vs full JSON)
  • No API key complexity for development
  • Reliable ~300ms response times

Copy link
Collaborator

@anth-volk anth-volk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small changes requested, but feel confident we can get this in today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants