This repository was archived by the owner on Apr 24, 2026. It is now read-only.
Description Phase 3: GraphQL Client & Hooks Setup
Establish Quickslice GraphQL integration with reusable React hooks for all CRUD operations.
Depends On
Completion of Phase 2 (Authentication working)
Phase 1 assessment: Understanding of Quickslice GraphQL schema
Objectives
Create GraphQL client configuration
Define GraphQL queries and mutations
Create reusable React hooks
Establish patterns for form components
Tasks
Task 1: GraphQL Client Setup
Task 2: Define GraphQL Operations
Create separate files for each domain:
Task 3: Create React Hooks
Task 4: Test GraphQL Integration
Task 5: Document GraphQL Patterns
Task 6: Create Hook Usage Examples
Files to Create
src/lib/graphql/
├── client.ts # Apollo/graphql-request client
├── hooks.ts # 20+ React hooks
├── queries/
│ ├── affiliations.ts
│ ├── qualifications.ts
│ ├── skills.ts
│ ├── events.ts
│ ├── works.ts
│ ├── socialLinks.ts
│ └── webLinks.ts
├── mutations/
│ ├── affiliations.ts
│ ├── qualifications.ts
│ ├── skills.ts
│ ├── events.ts
│ ├── works.ts
│ ├── socialLinks.ts
│ └── webLinks.ts
└── __tests__/
└── client.test.ts
src/types/
└── graphql.ts # TypeScript types
docs/
└── GRAPHQL_PATTERNS.md # Documentation
GraphQL Query Structure (Example)
query GetAffiliations ($did : String ! ) {
affiliations (did : $did ) {
rkey
organizationName
role
startDate
endDate
isPrimary
location {
city
country
}
website
createdAt
}
}
mutation CreateAffiliation ($input : CreateAffiliationInput ! ) {
createAffiliation (input : $input ) {
success
rkey
affiliation {
rkey
organizationName
role
startDate
}
error
}
}
React Hook Pattern (Example)
// useAffiliations hook
export function useAffiliations ( did : string ) {
return useQuery ( GET_AFFILIATIONS , {
variables : { did } ,
} ) ;
}
// useCreateAffiliation hook
export function useCreateAffiliation ( ) {
const [ mutate , { loading, error } ] = useMutation ( CREATE_AFFILIATION ) ;
return {
createAffiliation : async ( input : CreateAffiliationInput ) => {
const result = await mutate ( { variables : { input } } ) ;
return result . data . createAffiliation ;
} ,
loading,
error,
} ;
}
Testing Checklist
No Changes to Other Code
These continue to work without changes during Phase 3:
src/app/api/ (REST endpoints still exist)
Dashboard pages (still use REST)
Form components (still use fetch)
All other code
Risks
Risk
Mitigation
GraphQL schema doesn't match expectations
Test queries against Quickslice before committing
Wrong authentication header format
Verify Quickslice docs, test with real requests
Type generation issues
Use graphql-codegen to auto-generate types
Success Criteria
Estimated Duration
1-2 weeks
Next Phase
Once Phase 3 complete:
→ #92 : Phase 4: REST to GraphQL Migration (Affiliations module)
→ #93: Phase 5: REST to GraphQL Migration (Qualifications)
→ #94: Phase 6: REST to GraphQL Migration (Skills + Links + Events + Works)
→ #95: Phase 7: Public Profile & Dashboard Pages
→ #96: Phase 8: Database & Code Cleanup
Notes
This phase establishes the pattern used in all subsequent phases
Quality matters here - good hooks make Phase 4-7 easier
Document patterns well for team reference
Don't migrate forms yet - Phase 4 starts that
Reactions are currently unavailable
Phase 3: GraphQL Client & Hooks Setup
Establish Quickslice GraphQL integration with reusable React hooks for all CRUD operations.
Depends On
Objectives
Tasks
Task 1: GraphQL Client Setup
Create
src/lib/graphql/client.tsCreate
src/types/graphql.tsTask 2: Define GraphQL Operations
Create separate files for each domain:
src/lib/graphql/queries/src/lib/graphql/mutations/Task 3: Create React Hooks
src/lib/graphql/hooks.tsTask 4: Test GraphQL Integration
src/lib/graphql/__tests__/client.test.tsTask 5: Document GraphQL Patterns
docs/GRAPHQL_PATTERNS.mdTask 6: Create Hook Usage Examples
Files to Create
GraphQL Query Structure (Example)
React Hook Pattern (Example)
Testing Checklist
No Changes to Other Code
These continue to work without changes during Phase 3:
Risks
Success Criteria
Estimated Duration
1-2 weeks
Next Phase
Once Phase 3 complete:
→ #92: Phase 4: REST to GraphQL Migration (Affiliations module)
→ #93: Phase 5: REST to GraphQL Migration (Qualifications)
→ #94: Phase 6: REST to GraphQL Migration (Skills + Links + Events + Works)
→ #95: Phase 7: Public Profile & Dashboard Pages
→ #96: Phase 8: Database & Code Cleanup
Notes