Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
A

apollo-server

> 后端框架
Open source

🌍  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.

13.9K stars0 likes2 views
WebsiteGitHub

About

🌍  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

This @apollo/server package is new since Apollo Server 4. Previous major versions of Apollo Server used a set of package names starting with apollo-server, such as apollo-server, apollo-server-express, apollo-server-core, etc.


Announcement: Join 1000+ engineers at GraphQL Summit 2025 by Apollo for talks, workshops, and office hours. Oct 6-8, 2025 in San Francisco. Get your pass here ->


A TypeScript/JavaScript GraphQL server

Apollo Server is an open-source, spec-compliant GraphQL server that's compatible with any GraphQL client, including Apollo Client. It's the best way to build a production-ready, self-documenting GraphQL API that can use data from any source.

You can use Apollo Server as:

  • A stand-alone GraphQL server
  • The GraphQL server for a subgraph in a federated supergraph
  • The gateway for a federated supergraph

Apollo Server provides a simple API for integrating with any Node.js web framework or serverless environment. The @apollo/server package itself ships with a minimally-configurable, standalone web server which handles CORS and body parsing out of the box. Integrations with other environments are community-maintained.

Apollo Server provides:

  • Straightforward setup, so your client developers can start fetching data quickly
  • Incremental adoption, enabling you to add features as they're needed
  • Universal compatibility with any data source, any build tool, and any GraphQL client
  • Production readiness, enabling you to confidently run your graph in production

Documentation

Full documentation for Apollo Server is available on our documentation site. This README shows the basics of getting a server running (both standalone and with Express), but most features are only documented on our docs site.

Getting started: standalone server

You can also check out the getting started guide in the Apollo Server docs for more details, including examples in both TypeScript and JavaScript.

Apollo Server's standalone server lets you get a GraphQL server up and running quickly without needing to set up an HTTP server yourself. It allows all the same configuration of GraphQL logic as the Express integration, but does not provide the ability to make fine-grained tweaks to the HTTP-specific behavior of your server.

First, install Apollo Server and the JavaScript implementation of the core GraphQL algorithms:

bash
npm install @apollo/server graphql

Then, write the following to server.mjs. (By using the .mjs extension, Node lets you use the await keyword at the top level.)

javascript
import { ApolloServer } from '@apollo/server';
import { startStandaloneServer } from '@apollo/server/standalone';

// The GraphQL schema
const typeDefs = `#graphql
  type Query {
    hello: String
  }
`;

// A map of functions which return data for the schema.
const resolvers = {
  Query: {
    hello: () => 'world',
  },
};

const server = new ApolloServer({
  typeDefs,
  resolvers,
});

const { url } = await startStandaloneServer(server);
console.log(`🚀 Server ready at ${url}`);

Now run your server with:

bash
node server.mjs

Open the URL it prints in a web browser. It will show Apollo Sandbox, a web-based tool for running GraphQL operations. Try running the operation query { hello }!

Getting started: Express middleware

Apollo Server's Express middleware lets you run your GraphQL server as part of an app built with Express, the most popular web framework for Node.

First, install Apollo Server, its Express middleware, the JavaScript implementation of the core GraphQL algorithms, Express, and the standard Express middleware package for CORS headers:

bash
npm install @apollo/server @as-integrations/express5 graphql express cors

If using Typescript you may also need to install additional type declaration packages as development dependencies to avoid common errors when importing the above packages (i.e. Could not find a declaration file for module 'cors'):

bash
npm install --save-dev @types/cors @types/express

Then, write the following to server.mjs. (By using the .mjs extension, Node lets you use the await keyword at the top level.)

…

Now run your server with:

bash
node server.mjs

Open the URL it prints in a web browser. It will show Apollo Sandbox, a web-based tool for running GraphQL operations. Try running the operation query { hello }!

Issues· 89 open

View all issuesOpen on GitHub
  • #4934

    Dependency Dashboard

    Updated Oct 1, 2026
  • #8220

    Support GraphQL v17

    Updated Aug 26, 2026
  • #8225

    @apollo/server-integration-testsuite vitest version

    Updated Aug 9, 2026
  • #8222

    `ApolloServerPluginDrainHttpServer` retains closed sockets when `close` is processed before `finish`

    Updated Jul 25, 2026
  • #7625

    Different dists for CJS and ESM are causing both to be used, leading to TypeScript problems

    Updated Jul 16, 2026
  • #8218

    Typescript6 support for the apollo server.

    Updated Jun 12, 2026
  • #8146

    Plugin method types shouldn't force users to return a promise

    Updated May 12, 2026
  • #8190

    Hono integration - interested in joining apollo-server-integrations

    Updated Mar 16, 2026
  • #8185

    Support incremental delivery (@defer/@stream) in gateway executor path

    Updated Mar 15, 2026
  • #8167

    heartbeatIntervalMs missing from ApolloServerPluginSubscriptionCallback options

    Updated Dec 17, 2025

> Tags

TypeScriptapollographqlexpressexpress-graphqlgraphql

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedOct 1, 2026
Category后端框架
PricingOpen source

> Related tools

N
Node.js
基于 V8 的 JavaScript 运行时
D
Django
Python 高级 Web 框架
S
Spring Boot
Java 生态主流微服务框架