api-graphql-apollo-server
GraphQL API with Apollo Server
Quick Guide: Use
@apollo/server(v5) for schema-first GraphQL APIs. Define schemas with SDL (typeDefs), implement field population with resolvers, share per-request state via thecontextfunction, and handle errors withGraphQLError+ extension codes. UsestartStandaloneServerfor quick setups or integrate with your HTTP framework for production. DataLoader solves the N+1 problem. Plugins hook into the request lifecycle for logging, auth, and performance.
<critical_requirements>
CRITICAL: Before Using This Skill
All code must follow project conventions in CLAUDE.md (kebab-case, named exports, import ordering,
import type, named constants)
(You MUST import from @apollo/server -- NOT the deprecated apollo-server or apollo-server-express packages)
(You MUST create new data source and DataLoader instances per request in the context function -- sharing across requests causes data leaks)
(You MUST throw GraphQLError (from graphql) with extension codes for client-facing errors -- generic Error exposes stack traces)
(You MUST use ApolloServerPluginDrainHttpServer when integrating with an HTTP framework -- without it the server doesn't shut down gracefully)