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
| File | Description |
|---|---|
schema.graphql | Base types: Role, ApiError, AuthInfo, Query, Mutation |
user/schema.graphql | Profile, User types and operations |
org/schema.graphql | Organization, 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 operationsOrganizationMembershipResponse- 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:
- Apollo Sandbox - Visit
/api/graphqlin development - Source files - Browse
packages/shared-graphql/src/schemas/*.graphql - Generated types - See
packages/shared-graphql/src/generated/types.tsafter runningnx generate shared-graphql