Skip to main content

GraphQL Schema Reference

This document provides an overview of the GraphQL schema. For the complete, authoritative schema definitions, see the .graphql files in packages/shared-graphql/src/schemas/.

Schema Files

FileDescription
schema.graphqlBase types: Role, ApiError, AuthInfo, Query, Mutation
user/schema.graphqlProfile, User types and operations
org/schema.graphqlOrganization, Membership types and operations

Directives

@auth

Authorization directive for controlling field-level access. Used for documentation and future OAuth enforcement.

  • @auth(requires: USER) - Requires authentication
  • @auth(requires: ADMIN) - Requires admin role

Enums

Role

User authorization roles: ADMIN, USER, GUEST

OrganizationRole

Organization membership roles: OWNER, ADMIN, MEMBER

Core Types

Response Pattern

All mutations return response wrappers with data and error fields:

  • ProfileResponse - Profile operations
  • OrganizationMembershipResponse - Membership operations

ApiError

Standard error type with code (string) and message (string) fields.

AuthInfo

Current session information with isAuthenticated, user, and expiresAt fields.

Domain Types

User Domain

  • Profile - User profile with id, authUserId, email, displayName, avatarUrl, bio, timestamps
  • User - Session user info with id, email, name, image

Organization Domain

  • Organization - Organization with id, name, slug, description, timestamps, members
  • OrganizationMembership - Membership with id, userId, organizationId, role, timestamps

Input Types

Profile Inputs

  • CreateProfileInput - authUserId (required), email (required), displayName, avatarUrl, bio
  • UpdateProfileInput - email, displayName, avatarUrl, bio (all optional)

Organization Inputs

  • AddOrganizationMemberInput - userId (required), role (required)

Exploring the Schema

The best way to explore the schema is through:

  1. Apollo Sandbox - Visit /api/graphql in development
  2. Source files - Browse packages/shared-graphql/src/schemas/*.graphql
  3. Generated types - See packages/shared-graphql/src/generated/types.ts after running nx generate shared-graphql