← Back to Projects

API-to-SQLite CLI Tool

beginnerPhase 00 · FoundationsPythonFastAPISQLite

Pull data from a public API on a schedule, store it in SQLite, and serve it through a small FastAPI app.

What you'll learn

  • Calling REST APIs with httpx or requests
  • Designing a simple SQLite schema
  • Building a CLI that does something useful on every run
  • Exposing data through FastAPI endpoints

Architecture

CLI (Python)
  → fetch data from public API
  → clean / validate (Pydantic)
  → insert into SQLite
  → FastAPI reads SQLite and serves /endpoints

Steps

  1. Pick a public API (OpenWeatherMap, GitHub, a news API)
  2. Design your SQLite table — keep it minimal: id, timestamp, relevant fields, source
  3. Write a CLI using click or argparse: python fetch.py --source github --repo owner/name
  4. On each run: fetch, validate with Pydantic, upsert into SQLite
  5. Build 2–3 FastAPI endpoints that query SQLite: /latest, /history, /search?q=
  6. Add basic error handling: API down → retry once, then log and exit
  7. Write a short README explaining what it does and how to run it

← Back to the roadmap