⬡ GraphQL Intermediate

What is the difference between Apollo Server v3 and v4?

Answer

Apollo Server v4 (released 2022) introduced major architectural changes from v3. Key differences: (1) Framework integration: v4 is framework-agnostic — no built-in Express integration. Use startStandaloneServer for simple setups or expressMiddleware for Express integration (separate package). (2) Removed built-in landing page: no embedded GraphQL Playground; replaced by Apollo Sandbox link. (3) Plugin system overhaul: cleaner hook-based plugin API. (4) Built-in TypeScript: written in TypeScript, better type inference. (5) No more subscriptions integration: subscriptions must be set up separately with graphql-ws. (6) CSRF prevention by default. (7) HTTP batching removed by default. (8) Better error handling: error formatting is more controlled. Migration from v3 to v4 requires updating server initialization and subscription setup.