all templates
APIs & Data

Random Quote Machine

Load quotes from a data file and show a new one on demand.

Click a button, get a fresh quote. It reads from a bundled JSON file — the exact same fetch pattern as a live API, but reliable and offline. You'll learn to load data and pick a random item without repeats.

What's inside

  • Fetches a local quotes.json data file
  • Random selection that avoids repeating itself
  • The same fetch pattern used for live APIs
  • Runs from a one-line local server
  • Light & dark mode, no dependencies

Quickstart

$ curl -LO https://devai.io/downloads/random-quote.zip$ unzip random-quote.zip && cd random-quote$ python3 -m http.server 8000   # then open http://localhost:8000

Browse the code

The full source, exactly as the zip ships it.

loading…
Download .zip
loading tree…

about this tutorial

A devai.io starter tutorial — loading data with fetch, the reliable way to practice it.