A lightweight Cloudflare Workers proxy service for HERE API endpoints with Sentry monitoring. Protects your HERE API key from client-side exposure while providing global edge performance.
- Bun installed
- Cloudflare account
- HERE API key
- Sentry account (optional but recommended for error logging)
bun installCopy the example file and fill in your credentials:
cp .dev.vars.example .dev.varsEdit .dev.vars with your actual values:
HERE_API_KEY=your_here_api_key
SENTRY_DSN=https://your-sentry-dsn@sentry.io/project-idRun the development server:
bun run devThe service will be available at http://localhost:8787
# Autocomplete
curl "http://localhost:8787/autocomplete?q=cincinnati&limit=5"
# Geocode
curl "http://localhost:8787/geocode?q=48 Muir+Rd,+Rogers,+KY+41365"
# Health check
curl "http://localhost:8787/health"Set secrets (one-time setup):
bunx wrangler secret put HERE_API_KEY
# Paste your HERE API key when prompted
bunx wrangler secret put SENTRY_DSN
# Paste your Sentry DSN when promptedVerify secrets are set:
bunx wrangler secret listDeploy to Cloudflare Workers:
bun run deployThe project includes CI/CD that deploys automatically on git tags.
Go to your repo → Settings → Secrets and variables → Actions
Add these secrets:
CLOUDFLARE_API_TOKEN- Get from Cloudflare DashboardHERE_API_KEY- Your HERE API keySENTRY_DSN- Your Sentry DSN
- Go to Cloudflare API Tokens
- Click "Create Token"
- Use "Edit Cloudflare Workers" template
- Copy the token and add it to GitHub secrets as
CLOUDFLARE_API_TOKEN
git tag v1.0.0
git push origin v1.0.0GitHub Actions will automatically deploy to Cloudflare Workers. Monitor deployment in the Actions tab.
Proxies to HERE Autocomplete API.
Example request:
curl "https://your-worker.workers.dev/autocomplete?q=Seattle&limit=5"Query parameters:
q: Search query (required)limit: Max number of suggestionsin: Geographic filter (e.g.,circle:47.6,-122.3;r=50000)- All other HERE Autocomplete API parameters and docs
Note: The apiKey parameter is automatically injected by the proxy. Any apiKey sent by the client will be removed.
Proxies to HERE Geocode API.
Example request:
curl "https://your-worker.workers.dev/geocode?q=1600+Amphitheatre+Parkway"Query parameters:
q: Address to geocode (required)- All other HERE Geocode API parameters and docs
Note: The apiKey parameter is automatically injected by the proxy. Any apiKey sent by the client will be removed.
Health check endpoint.
Response:
{
"status": "ok",
"timestamp": "2024-11-27T12:34:56.789Z"
}All errors return JSON with an error field:
{
"error": "Error message"
}All errors are automatically reported to Sentry with full context.
Client Request
↓
Cloudflare Workers (Global Edge)
↓
Hono Router
↓
API Key Injection & Sanitization
↓
HERE API
↓
Response to Client
(Sentry monitors all errors)
- Runtime: Cloudflare Workers with
nodejs_compat - Framework: Hono
- Language: TypeScript
- Package Manager: Bun
- Monitoring: Sentry
- Wrangler: v4.42.2