🌍
🛰️ A Chob Group project

GeoIP API

Give it an IP, get back the country name and country code. A Supabase Edge Function with automatic failover and caching.

🔍 Try It Live

Enter an IP address below to look up its country and flag.

Enter an IP and tap Lookup

📡 API Endpoint

One endpoint. One parameter. That's it.

GET /?ip=45.196.201.208

→ { "ip": "45.196.201.208", "country": "Philippines", "countryCode": "PH" }

⚡ Quick Start

curl https://bprkazfxqmanrybiexnh.supabase.co/functions/v1/geo-api?ip=8.8.8.8

Returns: {"ip":"8.8.8.8","country":"United States","countryCode":"US"}

✨ Features

  • Primary: Supabase IP geolocation data (fast, internal)
  • Fallback: ip-api.com cloud API (when Supabase is down)
  • 1-hour in-memory cache for fast repeat lookups
  • Circuit breaker — auto-disables Supabase after 5 failures
  • Full CORS support — use it from any web app

🔧 Deploy Your Own

git clone <repo>
cd supabase/functions/geo-api
supabase functions deploy geo-api --no-verify-jwt

Requires Supabase project with SUPABASE_URL and SUPABASE_SERVICE_ROLE_KEY set.