GraphQL is a query language and runtime for APIs, developed by Facebook in 2012 and open-sourced in 2015. Instead of the server defining fixed response shapes (as in REST), the client specifies exactly which fields it needs, and the server returns only that data. This eliminates over-fetching and under-fetching, two of the most common pain points with traditional REST APIs.
A GraphQL API exposes a single endpoint (typically /graphql) and a typed schema that describes all available data and operations. Clients send queries specifying the exact fields they want, and the server resolves each field and returns a JSON response matching the query structure. Mutations handle writes (create, update, delete), and subscriptions enable real-time data via WebSocket connections.
The schema acts as a contract between client and server. It defines types, their fields, and relationships. Tools can auto-generate documentation, client code, and type definitions from the schema, which makes development faster and less error-prone than maintaining separate API docs.
For frontend developers, GraphQL means fewer API calls, smaller payloads, and no more waiting for backend teams to create new endpoints. A mobile app can request minimal data to save bandwidth while a desktop app fetches the full dataset, all from the same API. Major platforms including GitHub, Shopify, and Stripe offer GraphQL APIs alongside or instead of REST.
TerminalFeed's API uses REST endpoints for simplicity and caching, but several of the upstream data sources the Worker calls (like GitHub's API) offer GraphQL interfaces. The developer documentation covers how to work with the TerminalFeed API using standard HTTP requests.