Skip to content
PromptLab by FEHMER TECH
ENDE
Coding

GraphQL Schema Design

Design a GraphQL schema with types, queries, mutations, and resolvers.

Prompt template

Design a complete GraphQL schema for [PROJECT DESCRIPTION].

**Requirements:**
- Server framework: [Apollo Server/Yoga/Nexus/etc.]
- Programming language: [TypeScript/Python/Go]
- Data source: [Database/REST API/Microservices]

**Please create:**
1. **Type Definitions:** All GraphQL types with fields and relations
2. **Query Types:** Queries with arguments and pagination (cursor-based)
3. **Mutation Types:** Mutations for CRUD operations with input types
4. **Subscription Types:** If real-time updates are needed
5. **Custom Scalars:** For dates, JSON, uploads etc.
6. **Enums:** For fixed value sets
7. **Interfaces & Unions:** For polymorphic types

**Resolver Implementation:**
- DataLoader for N+1 query prevention
- Error handling with custom GraphQL errors
- Authentication/authorization in context
- Caching strategy

**Additionally:**
- Schema documentation with descriptions
- Example queries and mutations
- Code generator configuration (graphql-codegen)

Replace placeholders in [square brackets]: [PROJECT DESCRIPTION][Apollo Server/Yoga/Nexus/etc.][TypeScript/Python/Go][Database/REST API/Microservices]

How to use this template

Copy the prompt, replace the placeholders in square brackets with your details and paste it into the AI assistant of your choice. The more precise your details, the better the result.

Tips for better results

  • Describe the entities and their relationships
  • Specify whether you prefer schema-first or code-first
  • Ask for DataLoader implementations for N+1 problems
  • Request graphql-codegen configuration for TypeScript types

Suitable open models

The selection names current open models as a starting point for your own tests. It is not a measurement for this template.

Keywords: #graphql #schema #api #resolvers

Last updated: