Skip to content
Sina KalantariAll Projects

Power outage schedules

Roshanban

A Persian web app that collects the official power-outage schedule for Mazandaran province and tells people when the electricity is due to go off on their own street. I built it end to end.

Role
Full Stack Developer
Year
2026
Coverage
Mazandaran, 14 counties
Format
Installable web app, in Persian
Roshanban home page in Persian, laid out right to left: a search box for a city, neighbourhood or address, shortcuts to the busiest cities, and a count of today's outages
A saved place named Home on a phone, marked as starting soon, with the announced window from 20:00 to 22:00
The home page, and a saved place on a phone. The app reads right to left.

The schedule is public. Finding your street in it is the hard part.

When the grid runs short, the electricity distribution company in Mazandaran publishes its planned outages: two-hour windows, each with a long line of streets, alleys and villages. The information is public, but answering one question with it, when does my street go dark, means searching that list again every day.

Roshanban, roughly “keeper of the light” in Persian, does the searching. It collects the official list every fifteen minutes, lets people look up a city, a neighbourhood or an address, and remembers the places they care about. From then on it shows what is scheduled there, warns them before a window starts, and notices when the schedule changes.

From a street name to a warning in time

Screens from the app itself, showing the schedule published for 1 October 2026.

  1. Home page on a phone with a headline, a search box and shortcuts to two cities

    Search the way people describe a place

    One box takes a city, a neighbourhood or part of an address. Arabic and Persian keyboards, digit styles and spacing all match the same street.

  2. Search results for the city of Sari: a card for one area, announced from 20:00 to 22:00 and starting in 28 minutes

    Read the schedule as times

    Each result is one area with its announced start and end and a countdown. The list can be narrowed to a city and a day, and says when it was last received from the official source.

  3. Alert settings with browser notifications turned on and a switch for each kind of alert

    Choose what is worth an interruption

    A saved place can send alerts: before a window starts, when a new one is published, and when one is moved or removed. It all lives in the browser, with no account and no phone number.

  4. Share sheet with a generated image of one outage: the city, the area, the date and the announced times

    Pass it on

    Any outage can be shared as text or as a ready-made image, for the family group chat or the neighbours.

One saved place, through one evening

A saved place always shows where it stands against the schedule. The wording changes as the announced window approaches, runs and ends, and it stays careful the whole way through: the app knows the timetable, not the state of the wires.

Time of the evening
announced window, 20:00 to 22:00

Official source

A model of the saved-place card, with its Persian wording translated. Pick a time on the line.

When the connection drops, the schedule stays

A power cut takes the home Wi-Fi down with it. If the connection goes while the app is open, the schedule it already received stays on screen, and a notice says so and gives the time of that copy, so a saved list is never mistaken for a live one.

The schedule for Sari on a phone, with a notice across the bottom: you are offline, saved version, last successful fetch at 11:22, and a retry link
The notice over the schedule for Sari, with the connection switched off.
“You are offline. Saved version”
Appears a moment after the connection is lost, once the app has checked that it is really gone.
“Last successful fetch: 1405/7/10, 11:22”
When the schedule on screen was received. The date is in the Persian calendar: 2 October 2026.
“Retry”
Checks the connection again and loads the current schedule as soon as it is back.

That's the project. The rest is how it's built.

From here on, this page is written for technical readers: how the schedule is collected and kept current, what I built around it, and the stack it runs on. If you came to see the work itself, you've seen all of it.

Scroll to contact

One refresh, start to finish

A worker queues a refresh every fifteen minutes. Each run goes through the same steps and leaves a record behind, so a bad fetch can be seen and never silently replaces good data.

  1. Fetch through an adapter

    Each official source is one file behind a five-method interface: check the configuration, fetch, parse, validate, report health. The request covers the next seven days and retries with a growing delay, longer when the source rate-limits.

  2. Compare with the last payload

    The raw response is hashed. If the same hash is already stored, nothing was published since the last run and the run ends there.

  3. Parse and validate

    Jalali dates and local times become instants in Tehran time. Rows with missing or masked times are dropped, and a window that ends before it starts is rejected.

  4. Insert, or record a revision

    Rows are matched by the source's own id. A new one is inserted; one whose times moved gets a numbered revision, which the outage page shows as its history.

  5. Cancel what disappeared

    The response covers the whole window, so an upcoming outage that is no longer in it was withdrawn. It is marked cancelled instead of being left to mislead.

  6. Log the run

    Accepted and rejected counts, the trigger and any error are stored per run. In production the worker then asks search engines to recrawl the city pages.

Run of 1 October 2026: 741 outage windows accepted, 0 rejected, across 14 counties.

What I built

Stack

  • Next.js 15
  • React 19
  • TypeScript
  • Tailwind CSS
  • NestJS
  • Prisma
  • PostgreSQL
  • Redis
  • BullMQ
  • Docker
  • Vitest
  • Playwright

Alerts without accounts

Saved places and alert settings stay in the browser. Once a minute a checker compares the schedule with the last snapshot for each place and raises an event when a window is about to start, is newly published, has moved or was withdrawn. Each is keyed by place, outage and revision so it fires once, and a window that simply ends is never reported as cancelled.

Saved-place status

One pure function turns a place's outages, the source's health and the age of the data into one of ten states, with its wording, badges and next action. Unit tests check its output against the list of phrases the app must never show.

Persian search

Queries and addresses are normalised before matching: Arabic and Persian forms of the same letter, Persian, Arabic and Latin digits, zero-width joiners, spacing and punctuation.

Pages search engines can read

Server-rendered pages for every city, neighbourhood, today and tomorrow, with a sitemap, structured data and one set of rules deciding which routes are indexable. Filtered and personal views stay out of the index.

Offline and installable

A service worker answers schedule requests from the network first and from its cache when that fails, and the app labels cached data with the time it was received. HTML is never cached, so an installed app cannot open on a stale shell after a deploy.

Admin panel

Refresh runs with a manual trigger, outages, per-city status, community reports, visitor analytics, ad slots and system health, with CSV export.

Delivery

The apps are built locally into self-contained artifacts and synced to a small server, where thin runtime containers mount them behind a reverse proxy and a CDN. The server never runs a build.

Tests

Over a hundred unit tests around dates, search, alerts and status wording, and browser tests for the main flows, including accessibility checks and layout at phone width.

Let's Work Together

Have a project in mind?

I'm always open to discussing new ideas, collaborations and exciting opportunities.