{"id":14427,"library":"apollo-server","title":"Apollo Server","description":"Apollo Server is a community-maintained open-source GraphQL server that works with many Node.js HTTP server frameworks or can run standalone. Version 3.13.0 is the final stable release of this package, which has since been superseded by the `@apollo/server` package (v4+). Active development and new features are now released under the `@apollo/server` package, which follows a rapid release cadence.","status":"deprecated","version":"3.13.0","language":"javascript","source_language":"en","source_url":"https://github.com/apollographql/apollo-server","tags":["javascript","GraphQL","Apollo","Server","Javascript","typescript"],"install":[{"cmd":"npm install apollo-server","lang":"bash","label":"npm"},{"cmd":"yarn add apollo-server","lang":"bash","label":"yarn"},{"cmd":"pnpm add apollo-server","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"While `apollo-server` v3 supports both CommonJS and ESM, ESM is the modern recommendation. The successor package, `@apollo/server` v4+, is ESM-only.","wrong":"const { ApolloServer } = require('apollo-server');","symbol":"ApolloServer","correct":"import { ApolloServer } from 'apollo-server';"},{"note":"While `apollo-server` v3 supports both CommonJS and ESM, ESM is the modern recommendation. The successor package, `@apollo/server` v4+, is ESM-only.","wrong":"const { gql } = require('apollo-server');","symbol":"gql","correct":"import { gql } from 'apollo-server';"}],"quickstart":{"code":"import { ApolloServer, gql } from 'apollo-server';\n\n// The GraphQL schema\nconst typeDefs = gql`\n  type Query {\n    \"A simple type for getting started!\"\n    hello: String\n  }\n`;\n\n// A map of functions which return data for the schema.\nconst resolvers = {\n  Query: {\n    hello: () => 'world',\n  },\n};\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n});\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`);\n});","lang":"typescript","description":"Basic Apollo Server setup with a 'hello world' GraphQL query that starts a standalone server."},"warnings":[{"fix":"Migrate your application to use `@apollo/server`. Refer to the official Apollo Server migration guide for details.","message":"The `apollo-server` package (v3) has been superseded by the `@apollo/server` package (v4+). Future development and active maintenance are focused on the new package, which introduces breaking changes and a new API structure.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Install a compatible version of `graphql`: `npm install graphql@^16.0.0` or `npm install graphql@^15.3.0`.","message":"The `graphql` package is a peer dependency. Ensure you have a compatible version installed, as `apollo-server` v3.13.0 requires `^15.3.0 || ^16.0.0`.","severity":"gotcha","affected_versions":">=3.0.0"},{"fix":"Refactor your project to use ES modules. For example, change `const { ApolloServer } = require('apollo-server');` to `import { ApolloServer } from '@apollo/server';` and ensure your `package.json` specifies `\"type\": \"module\"`.","message":"When migrating to the successor `@apollo/server` (v4+), note that it is ESM-only. Code using CommonJS `require()` will need to be updated to `import` statements and your project configured for ESM.","severity":"gotcha","affected_versions":">=3.0.0"}],"env_vars":null,"last_verified":"2026-04-18T00:00:00.000Z","next_check":"2026-07-17T00:00:00.000Z","problems":[{"fix":"Ensure you are importing the correct package for your module system. If using `apollo-server` v3, ensure you're using compatible CJS/ESM. If migrating to `@apollo/server` v4+, update your project to use ESM `import` statements.","cause":"Attempting to use `require('apollo-server')` to import a version or package (e.g., `@apollo/server` v4+) that is ESM-only, or a misconfigured `package.json`.","error":"TypeError: ApolloServer is not a constructor"},{"fix":"Run `npm install graphql` to add the necessary peer dependency.","cause":"The `graphql` package is a peer dependency and must be explicitly installed alongside `apollo-server`.","error":"Error: Cannot find module 'graphql'"},{"fix":"Carefully review your `gql` template literal for any syntax errors in your schema definition (e.g., missing curly braces, incorrect type names, etc.).","cause":"The `typeDefs` string passed to `ApolloServer` contains an incomplete or malformed GraphQL schema definition.","error":"Syntax Error: Expected Name, found <EOF>"}],"ecosystem":"npm"}