gitmyhub

apollo-server

TypeScript ★ 14k updated 22h ago

🌍  Spec-compliant and production ready JavaScript GraphQL server that lets you develop in a schema-first way. Built for Express, Connect, Hapi, Koa, and more.

Apollo Server is an open-source TypeScript library for building GraphQL APIs, a single endpoint where clients ask for exactly the data fields they need instead of many fixed URL endpoints.

TypeScriptJavaScriptGraphQLNode.jsExpresssetup: moderatecomplexity 3/5

Apollo Server is an open-source JavaScript and TypeScript library for building GraphQL APIs. GraphQL is an approach to building web APIs where, instead of having many separate URL endpoints each returning fixed data, you define a single schema describing all the data your application can provide, and clients ask for exactly the fields they need in one request. Apollo Server implements that approach on the server side, handling the incoming queries and calling your own code to fetch the actual data.

You can use Apollo Server in a few different ways. The simplest is as a standalone server where it handles all the HTTP details for you: you install the package, define your schema and the functions that return data for each field, and the server is ready to run. It also works as middleware inside an existing web application built with frameworks like Express, which is popular for Node.js projects, letting you add GraphQL to an app that already does other things.

A third use case is in larger federated architectures. GraphQL Federation is a pattern where a single public GraphQL API is assembled from multiple smaller services, each owning a piece of the overall schema. Apollo Server can act either as one of those smaller services (called a subgraph) or as the gateway that combines them all.

When you start the server for the first time, it opens Apollo Sandbox, a browser-based tool for writing and testing queries against your API. This makes development easier because you can explore the schema and run test queries without any separate tooling.

The package is written in TypeScript, works with any GraphQL client (not just Apollo's own client library), and is compatible with any data source. Installation is through npm, and the README includes complete working code examples for both the standalone and Express setups. Full documentation lives on the Apollo website.

Where it fits