---
title: "Designing news-api-web: a broadsheet reader for static JSON"
description: "Building an editorial newspaper interface on top of zero-server static feeds, with Unslop typography, live documentation, and offline resilience."
date: "2026-11-07"
category: "Design"
featured: false
---

The easiest version of news-api-web would have been a card grid. Fetch the JSON, map over articles, render white cards with thumbnails and a subtitle in gray. Done in an afternoon.

I didn't want that. The underlying data already had structure — country, category, source, timestamp. Cards would have flattened all of it into decoration.

The reference I kept coming back to was a physical broadsheet. High text density. Thin column rules. No images competing with the headlines. The design earns its complexity by giving you more to read per scroll, not less.

## No backend, no database

[news-api](https://github.com/pranav256/news-api) works by running a Python scraper on a schedule and committing the results to GitHub. Each collection run writes JSON files to country/category paths, and GitHub serves them raw.

That means news-api-web doesn't need a server of its own. There's nothing to query except raw URLs.

~~~text
GitHub Actions runs the scraper
  -> writes us/technology.json
  -> commits to main

Your browser
  -> fetches raw.githubusercontent.com/pranav256/news-api/main/us/technology.json
  -> renders the article list
~~~

The CDN cache TTL is five minutes. If the scraper misses a run, the client gets yesterday's feed — which is not the same as the client getting an error. That distinction matters for how you display the data.

## What the reader actually needed to look like

Standard web templates do a few things consistently: oversized padding, card shadows, pill tags, gradient headers. All of it softens density. For a news reader, density is the product.

The layout follows a few rules I tried to stay strict about:

No colored backgrounds. The graphite-on-white or white-on-graphite surfaces stay neutral. Accent color goes to one thing only — the category tag on the lead story.

Dividers are single-pixel hairlines at around 8% opacity. Physical newspapers use column rules to separate stories. A 2px border with a drop shadow is a card, not a rule.

Publication timestamps use `tabular-nums` so they don't shift when the minute increments. It's a small thing. It's also the kind of thing that makes a list of timestamps feel like a table rather than a paragraph.

The lead story gets width. Everything below stacks into a dense right column. The goal is for the page to feel like something you'd pin to a corkboard, not something you'd swipe through.

## Embedding the documentation

The harder design question was where to put developer information.

news-api is meant to be consumed by other projects. If someone lands on the reader, they should also be able to find the raw endpoints. But a documentation tab would split the product in half.

The solution was to surface the curl command next to the category section it serves. You read the Technology headlines, and immediately below the section header there's a small collapsible showing the exact URL and the last modified timestamp from the JSON envelope.

~~~bash
curl -s https://raw.githubusercontent.com/pranav256/news-api/main/us/technology.json
~~~

The documentation is the running data. No mock responses, no fake schemas — the same articles you're reading are the response you'd get from the endpoint shown.

## Stale data needs to say so

GitHub's raw CDN returns `Cache-Control: max-age=300`. Five-minute cache. The scraper runs every two hours. When a scraper run fails — and [it has failed before](https://github.com/pranav256/news-api/issues/1) — the browser can successfully fetch a file that's eight hours old.

Fetching successfully is not the same as getting current data.

The fix is cheap: parse the `last_updated` field from the JSON envelope and compare it to `Date.now()`. If the difference is over four hours, show a small label below the category header. Not an error, not a banner — just a timestamp and a note that this isn't live.

~~~text
Technology · Cached feed (updated 6h ago)
~~~

If the network request fails entirely, the page falls back to whatever IndexedDB has from the last session. You can still read the news. It's just older news.

[Browse news-api-web](https://github.com/pranav256/news-api-web) and the [underlying scraper](https://github.com/pranav256/news-api).
