← GraphQL learning path
GraphQL · Module 2 of 10

Schema and types

Define your data with the Schema Definition Language (SDL).

📖 Key ideas

  1. type User { id: ID! name: String! posts: [Post!]! }
  2. Scalars: Int, Float, String, Boolean, ID.
  3. ! means non-null.
  4. [Post] is a list of Post.
  5. Root types: Query, Mutation, Subscription.
💡 Real-life example: The schema is a menu card listing every dish (type) and its ingredients (fields).
SDLSchema Definition Language
ScalarBasic type like Int or String
!Non-null marker
Query typeEntry point for reads