What are GraphQL object types and how do you define them?

Beginner

Answer

Object types represent entities in your domain with named fields. They're the most common type in GraphQL schemas.

type User {
  id: ID!
  name: String!
  email: String!
  posts: [Post!]!
  createdAt: String!
}

type Post {
  id: ID!
  title: String!
  content: String!
  author: User!
  published: Boolean!
}