Prayer times are the first feature almost every Muslim app needs. In this tutorial we build a small Next.js 15 (App Router) widget that:
fetches prayer times JSON on the server (so browser CORS rules never get in the way),
caches it with ISR ( revalidate: 3600 ),
shows Fajr, Dhuhr, Asr, Maghrib and Isha with their Arabic names,
highlights the next prayer and counts down to it, in the city's own time zone , not the visitor's or the server's,
keeps the time logic in plain functions you can unit test with node --test .
The data comes from the public sample of the SunnahSource Prayer Times API :
https : // sunnahsource . org / data / json / prayer - times . json
Enter fullscreen mode
Exit fullscreen mode
The sample is a fixed day for one city (Makkah, Umm Al-Qura method). The full API covers any city with several calculation methods. You request a key on the Prayer Times API page . The widget below works the same way with both, because it only reads timezone , times and items .
1.…