Skip to content

HassanMak29/islamic-toolkit-api

Repository files navigation

Islamic Toolkit API

Prayer times, Qibla direction, Hijri conversion, Islamic holidays, the 99 Names of Allah, and Zakat calculations in one API.

Built on Cloudflare Workers with Hono.

What It Does

  • Daily prayer times with multiple calculation methods and madhab support
  • Qibla direction from any latitude and longitude
  • Gregorian to Hijri and Hijri to Gregorian conversion
  • Islamic holiday lookup by Hijri or Gregorian year
  • Full 99 Names dataset or lookup by number
  • Zakat calculation with gold and silver nisab thresholds
  • Browser tester UI for manual exploration
  • KV-backed caching for repeated prayer time requests

Endpoints

Method Path Description
GET /prayer-times?latitude=<lat>&longitude=<lng> Prayer times, sunnah times, current prayer, and next prayer
GET /qibla?latitude=<lat>&longitude=<lng> Qibla direction and compass heading
GET /hijri?direction=toHijri&date=2026-04-12 Convert between Gregorian and Hijri dates
GET /holidays?calendar=gregorian&year=2026 Islamic holiday calendar data
GET /names All 99 Names of Allah
GET /names?number=1 Single Name of Allah by number
GET /zakat?savings=5000&gold_price_per_gram=85&silver_price_per_gram=1.1 Zakat calculation with nisab comparison
GET /health Public health check
GET / Browser tester UI

Example Response

{
  "coordinates": {
    "latitude": 36.7538,
    "longitude": 3.0588
  },
  "direction": 101.49,
  "compass": "E"
}

Direct Worker Testing

All feature routes are protected so requests cannot bypass the intended API gateway flow. The only public routes are /, /health, and /logo.svg.

Live worker URL:

https://islamic-toolkit-api.hassanmakhloufi.workers.dev

If you want to test protected routes against the worker directly as the owner, send the configured X-RapidAPI-Proxy-Secret header:

curl "https://islamic-toolkit-api.hassanmakhloufi.workers.dev/qibla?latitude=36.7538&longitude=3.0588" \
  -H "X-RapidAPI-Proxy-Secret: YOUR_PROXY_SECRET" | jq

Health is public:

curl "https://islamic-toolkit-api.hassanmakhloufi.workers.dev/health" | jq

Local Development

npm install
npm run dev

Testing

npm run type-check
npm test

Deployment Notes

# Set or rotate the production secret
npx wrangler secret put RAPIDAPI_PROXY_SECRET --name islamic-toolkit-api

# Deploy the worker
npm run deploy

KV binding required in wrangler.toml:

  • ISLAMIC_CACHE

About

Islamic Toolkit API — prayer times, Qibla, Hijri conversion, holidays, 99 Names, and Zakat calculator

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors