Prompt Library ⚙️ Technical Write a GraphQL API
Any ⚙️ Technical Advanced

Write a GraphQL API

Design and implement a complete GraphQL API for any application.
👁 5 views ⎘ 0 copies ♥ 0 likes

The Prompt

Design and implement a GraphQL API for the following:

Application type: [describe what the app does]
Data entities needed: [list the main types — e.g. User, Post, Comment, Product]
Key relationships: [describe how entities relate]
Authentication: [JWT / session / API key / none]
Database: [PostgreSQL / MySQL / MongoDB / other]
Language/framework: [Node.js with Apollo / Python with Strawberry / other]
Existing REST API (if migrating): [describe current endpoints — optional]
Special requirements: [real-time subscriptions / file uploads / pagination / caching]

Provide a complete GraphQL API implementation:

SCHEMA DESIGN:
- Full type definitions for all entities
- Input types for mutations
- Enums and custom scalars
- Interface and union types where appropriate

QUERIES:
- All query resolvers needed
- Filtering, sorting, and pagination patterns
- Nested relationship resolution

MUTATIONS:
- Create, update, delete mutations for each entity
- Input validation approach
- Error handling and custom error types

SUBSCRIPTIONS (if applicable):
- Real-time events to expose
- Subscription resolver implementation

RESOLVERS:
- Complete resolver implementations
- DataLoader pattern for N+1 problem prevention
- Context setup

AUTHENTICATION AND AUTHORISATION:
- Auth middleware implementation
- Field-level permissions
- Directive-based auth

PERFORMANCE:
- Query depth limiting
- Query complexity analysis
- Caching strategy

TESTING:
- Example queries and mutations to test each resolver
- Error case examples

DOCUMENTATION:
- Schema description comments
- Example operations for each query and mutation

📝 Fill in the blanks

Replace these placeholders with your own content:

[describe what the app does]
[list the main types — e.g. User, Post, Comment, Product]
[describe how entities relate]
[JWT / session / API key / none]
[PostgreSQL / MySQL / MongoDB / other]
[Node.js with Apollo / Python with Strawberry / other]
[describe current endpoints — optional]
[real-time subscriptions / file uploads / pagination / caching]

How to use this prompt

1
Copy the prompt

Click "Copy Prompt" above to copy the full prompt text to your clipboard.

2
Replace the placeholders

Swap out anything in [BRACKETS] with your specific details.

3
Paste into Any

Open your preferred AI assistant and paste the prompt to get started.