graphql-patterns

Solid

Use when designing or operating GraphQL APIs with schemas, resolvers, authorization, pagination, federation, code generation, and hostile-input controls.

API & Backend 25 stars 6 forks Updated 3 days ago MIT

Install

View on GitHub

Quality Score: 85/100

Stars 20%
47
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# GraphQL Patterns (Apollo + TypeScript) Acknowledgement: Shared by Peter Bamuhigire, techguypeter.com, +256 784 464178. <!-- dual-compat-start --> ## Use When - Designing a new GraphQL API or migrating from REST - Building Apollo Server + TypeScript with typed resolvers and clients - Adopting Relay pagination, DataLoader, directive auth, or federation - Hardening a GraphQL service for production ## Do Not Use When - Pure REST/gRPC — use `api-design-first` - Threat-modelling GraphQL against malicious input — load `references/graphql-security.md` first - Single canonical UI shape, CDN caching dominant — REST is simpler ## Required Inputs Domain entities + UI shapes; auth model (JWT/roles/tenants); federation needs; target clients and pagination style. ## Workflow 1. Draft SDL against real UI shapes before resolvers. 2. Model relationships in the schema, not in resolvers. 3. Wire `context` (auth + loaders) before the first resolver. 4. Add depth + complexity `validationRules` before the first public client. 5. Add graphql-codegen to CI before the schema has a second consumer. 6. Ship with `formatError` masking production stack traces. ## Quality Standards - Lists are `[T!]!` unless partial failure is legal. - Every mutation takes `input: XxxInput!` and returns a payload type. - Every resolver is pure: reads `context`, calls services/loaders, returns the schema shape. - Every relationship crossing uses DataLoader — no direct DB calls in nested resolvers. - Production always...

Details

Author
peterbamuhigire
Repository
peterbamuhigire/chwezi-dev-engine
Created
7 months ago
Last Updated
3 days ago
Language
HTML
License
MIT

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category