← Back to all products
$39
GraphQL Starter Kit
GraphQL server setup with schema design, resolvers, authentication, dataloader patterns, and subscription support.
JSONMarkdownShellPythonFastAPI
📄 Product Preview
Try the interactive reader and demo tools below, or get the full product with all content unlocked.
📖 Interactive Reader (Free Preview) ⚙ Try Demo Tools 📦 Download Free Sample📁 File Structure 36 files
graphql-starter-kit/
├── LICENSE
├── README.md
├── examples/
│ ├── curl-examples.sh
│ ├── queries.graphql
│ └── variables.json
├── free-sample.zip
├── guide/
│ ├── auth-and-context.md
│ ├── n+1-and-dataloader.md
│ ├── resolver-patterns.md
│ └── schema-design.md
├── guides/
│ ├── auth-and-context.md
│ ├── n+1-and-dataloader.md
│ ├── resolver-patterns.md
│ └── schema-design.md
├── index.html
├── schema/
│ └── schema.graphql
├── src/
│ ├── __init__.py
│ ├── __main__.py
│ ├── __pycache__/
│ │ ├── __init__.cpython-312.pyc
│ │ ├── __main__.cpython-312.pyc
│ │ ├── auth.cpython-312.pyc
│ │ ├── dataloader.cpython-312.pyc
│ │ ├── executor.cpython-312.pyc
│ │ ├── resolvers.cpython-312.pyc
│ │ ├── schema_parser.cpython-312.pyc
│ │ ├── server.cpython-312.pyc
│ │ └── subscriptions.cpython-312.pyc
│ ├── auth.py
│ ├── dataloader.py
│ ├── executor.py
│ ├── resolvers.py
│ ├── schema_parser.py
│ ├── server.py
│ └── subscriptions.py
└── tests/
├── test_dataloader.py
└── test_resolvers.py
📖 Documentation Preview README excerpt
GraphQL Starter Kit
A complete, runnable GraphQL server built with Python's standard library (zero pip dependencies). Includes a realistic blog + commerce schema, resolvers with authentication, the DataLoader pattern for N+1 elimination, and subscription support via Server-Sent Events.
What's Inside
graphql-starter-kit/
├── schema/
│ └── schema.graphql # Full SDL: types, queries, mutations, subscriptions
├── src/
│ ├── __init__.py # Package marker
│ ├── __main__.py # Entry point: python -m src
│ ├── server.py # HTTP server with GraphiQL, CORS, SSE
│ ├── schema_parser.py # SDL + query parser (recursive-descent)
│ ├── executor.py # Query execution engine
│ ├── resolvers.py # Business logic + in-memory data store
│ ├── dataloader.py # Batching + caching DataLoader
│ ├── auth.py # JWT creation/verification, RBAC decorators
│ └── subscriptions.py # PubSub broker + SSE transport
├── examples/
│ ├── queries.graphql # 10 example operations
│ ├── curl-examples.sh # Ready-to-run curl commands
│ └── variables.json # Variable payloads for parameterized queries
├── guides/
│ ├── schema-design.md # Schema design principles and patterns
│ ├── resolver-patterns.md # 8 resolver patterns with code
│ ├── n+1-and-dataloader.md # DataLoader deep dive
│ └── auth-and-context.md # Authentication architecture guide
├── tests/
│ ├── test_dataloader.py # 13 DataLoader unit tests
│ └── test_resolvers.py # 15 resolver unit tests
├── README.md
└── LICENSE # MIT
Features
- Zero dependencies — runs on Python 3.10+ stdlib only (no pip install needed)
- Full GraphQL schema — 15+ types, enums, interfaces, input types, pagination
- Working server — boots on
http://127.0.0.1:4000with embedded GraphiQL IDE - Authentication — HMAC-SHA256 JWT, role-based access control decorators
- DataLoader — batching + caching pattern with performance metrics
- Subscriptions — real-time events via Server-Sent Events (SSE)
- In-memory data — realistic sample data (users, posts, comments, products, orders)
- 28 resolver tests — comprehensive test coverage with stdlib unittest
Quick Start
1. Start the Server
cd graphql-starter-kit
python -m src
Output:
GraphQL server running at http://127.0.0.1:4000/graphql
GraphiQL IDE at http://127.0.0.1:4000/
*... continues with setup instructions, usage examples, and more.*
📄 Code Sample .sh preview
examples/curl-examples.sh#!/usr/bin/env bash
# =============================================================================
# curl Examples for the GraphQL Starter Kit Server
# =============================================================================
# Prerequisites: Server running at http://127.0.0.1:4000
# cd graphql-starter-kit && python -m src
#
# Each example below is a self-contained curl command you can copy-paste.
# Variables are passed inline via the "variables" JSON key.
set -euo pipefail
SERVER="http://127.0.0.1:4000/graphql"
echo "=== 1. Health Check ==="
curl -s http://127.0.0.1:4000/health | python3 -m json.tool
echo
echo "=== 2. List Published Posts ==="
curl -s -X POST "$SERVER" \
-H "Content-Type: application/json" \
-d '{
"query": "query { posts(status: PUBLISHED, first: 5) { edges { node { id title slug readingTimeMinutes author { displayName } likeCount } cursor } pageInfo { hasNextPage endCursor } totalCount } }"
}' | python3 -m json.tool
echo
echo "=== 3. Fetch Post by Slug ==="
curl -s -X POST "$SERVER" \
-H "Content-Type: application/json" \
-d '{
"query": "query { postBySlug(slug: \"getting-started-with-graphql\") { id title body author { displayName email } comments(first: 5) { edges { node { body author { displayName } } } totalCount } } }"
}' | python3 -m json.tool
echo
echo "=== 4. Search ==="
curl -s -X POST "$SERVER" \
-H "Content-Type: application/json" \
-d '{
"query": "query { search(query: \"graphql\", first: 3) { __typename ... on Post { id title } ... on Product { id name price } } }"
}' | python3 -m json.tool