← Back to all products

GraphQL Starter Kit

$39

GraphQL server setup with schema design, resolvers, authentication, dataloader patterns, and subscription support.

40 files
PythonShellMarkdownJSONFastAPI

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 40 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 ├── interactive.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/ ├── __pycache__/ │ ├── test_dataloader.cpython-312-pytest-9.0.2.pyc │ └── test_resolvers.cpython-312-pytest-9.0.2.pyc ├── 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:4000 with 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 .py preview

src/__main__.py """ __main__.py — Entry point for `python -m src`. Boots the GraphQL server with configurable host/port via environment variables or command-line arguments. Usage: python -m src # default: 127.0.0.1:4000 python -m src --host 0.0.0.0 --port 8080 # bind to all interfaces GRAPHQL_PORT=5000 python -m src # env var override """ from __future__ import annotations import argparse import logging import os import sys # Configure logging before importing anything else so all modules # pick up the format. logging.basicConfig( level=os.environ.get("LOG_LEVEL", "INFO").upper(), format="%(asctime)s [%(levelname)s] %(name)s: %(message)s", datefmt="%Y-%m-%d %H:%M:%S", ) from .server import run_server def main() -> None: parser = argparse.ArgumentParser( description="GraphQL Starter Kit — stdlib-only GraphQL server", ) parser.add_argument( "--host", default=os.environ.get("GRAPHQL_HOST", "127.0.0.1"), help="Bind address (default: 127.0.0.1, env: GRAPHQL_HOST)", ) parser.add_argument( "--port", type=int, default=int(os.environ.get("GRAPHQL_PORT", "4000")), help="Listen port (default: 4000, env: GRAPHQL_PORT)", ) args = parser.parse_args() run_server(host=args.host, port=args.port) # ... 3 more lines ...