HTTP Server for GraphQL.
Project description
GraphQL HTTP
📚 Documentation | 📦 PyPI | 🔧 GitHub
A lightweight, production-ready HTTP server for GraphQL APIs built on top of Starlette/FastAPI. This server provides a simple yet powerful way to serve GraphQL schemas over HTTP with built-in support for authentication, CORS, GraphiQL integration, and more.
Features
- 🚀 High Performance: Built on Starlette/ASGI for excellent async performance
- 🔐 JWT Authentication: Built-in JWT authentication with JWKS support
- 🌐 CORS Support: Configurable CORS middleware for cross-origin requests
- 🎨 GraphiQL Integration: Interactive GraphQL IDE for development
- 📊 Health Checks: Built-in health check endpoints
- 🔄 Batch Queries: Support for batched GraphQL operations
Installation
uv add graphql_http
Or with pip:
pip install graphql_http
Quick Start
Basic Usage
from graphql import GraphQLSchema, GraphQLObjectType, GraphQLField, GraphQLString
from graphql_http import GraphQLHTTP
# Define your GraphQL schema
schema = GraphQLSchema(
query=GraphQLObjectType(
name="Query",
fields={
"hello": GraphQLField(
GraphQLString,
resolve=lambda obj, info: "Hello, World!"
)
}
)
)
# Create the HTTP server
app = GraphQLHTTP(schema=schema)
# Run the server
if __name__ == "__main__":
app.run(host="0.0.0.0", port=8000)
Using with graphql-api
For building GraphQL schemas, use graphql-api:
from graphql_api import GraphQLAPI
from graphql_http import GraphQLHTTP
api = GraphQLAPI()
@api.type(is_root_type=True)
class Query:
@api.field
def hello(self, name: str = "World") -> str:
return f"Hello, {name}!"
server = GraphQLHTTP.from_api(api)
server.run()
Related Projects
- graphql-api - Build GraphQL schemas with decorators
- graphql-db - SQLAlchemy integration for database-backed APIs
- graphql-mcp - Expose GraphQL as MCP tools
See the documentation for configuration, authentication, and advanced features.
Documentation
Visit the official documentation for comprehensive guides, examples, and API reference.
Key Topics
- Getting Started - Quick introduction and basic usage
- Configuration - Configure your HTTP server
- Authentication - JWT and auth setup
- Testing - Test your GraphQL endpoints
- Examples - Real-world usage examples
- API Reference - Complete API documentation
License
MIT License - see LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file graphql_http-2.2.4.tar.gz.
File metadata
- Download URL: graphql_http-2.2.4.tar.gz
- Upload date:
- Size: 186.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0ef20eb910646ada063ba419b6240273082ccf6dbef873d92ffe892b57ef0527
|
|
| MD5 |
0d6d0a560ce76e0942b48c8d46bfccaf
|
|
| BLAKE2b-256 |
3570a01df3447b7d031c7faa18a9567e6adb7d1c75aaa9840b46612384f7486c
|
File details
Details for the file graphql_http-2.2.4-py3-none-any.whl.
File metadata
- Download URL: graphql_http-2.2.4-py3-none-any.whl
- Upload date:
- Size: 81.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
feb76648ab360e19b05af6283a87e5e8e44d07df7d80e52bb413467dc1ff8510
|
|
| MD5 |
d7edaee61bee1409a4bdb6c2fd473dd6
|
|
| BLAKE2b-256 |
d0c7d72f65efc5cb0dc5d3cf0c72436ab27da0cd5c0c6707a3d4efbbc324bebd
|