Clients describe the exact shape of the response. Feature Purpose Operation name query DashboardData { ... } — shows up in logs and tooling Variables query ($id: ID!) + JSON variables — never string-concatenate values Aliases fetch the same field twice: admins: users(role: ADMIN) Fragments reuse selections: ...UserCard Inline fragments select fields per type on unions/interfaces: ... on Post { title } Directives @include(if: $withPosts), @skip(if: ...) typename which concrete type was returned Everything is sent as a POST to a single endpoint (usually /graphql) with { "query", "variables", "operationName" }.
Key Takeaways
Always pass dynamic values as variables, never by string concatenation.
Fragments keep selections DRY and map nicely to UI components.
Aliases let you request the same field with different arguments.
Use inline fragments and typename with unions and interfaces.