https://github.com/sachnaror/graphql_fastapi
GraphQL server using FastAPI and interact with it using GraphQL queries
https://github.com/sachnaror/graphql_fastapi
fastapi graphql
Last synced: 2 months ago
JSON representation
GraphQL server using FastAPI and interact with it using GraphQL queries
- Host: GitHub
- URL: https://github.com/sachnaror/graphql_fastapi
- Owner: sachnaror
- Created: 2024-03-23T03:19:35.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2024-03-24T01:40:14.000Z (over 2 years ago)
- Last Synced: 2025-10-08T23:17:48.727Z (9 months ago)
- Topics: fastapi, graphql
- Language: Python
- Homepage:
- Size: 10.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## GraphQL FastAPI Example
This repository contains a simple example of integrating GraphQL with FastAPI, a modern, fast (high-performance) web framework for building APIs with Python. The project demonstrates how to set up a GraphQL server using FastAPI and interact with it using GraphQL queries.
**Features**
* **FastAPI:** Utilizes FastAPI for building robust and high-performance APIs.
* **GraphQL Integration:** Demonstrates how to integrate GraphQL with FastAPI.
* **Sample Schema:** Provides a sample GraphQL schema with example queries and mutations.
* **Interactive API Documentation:** Utilizes Swagger UI and Redoc to generate interactive API documentation.
**Requirements**
* Python 3.7+
* pip
**Installation**
1. Clone the repository:
```bash
git clone https://github.com/sachnaror/GraphQL_FastAPI.git
```
2. Navigate to the project directory:
```bash
cd GraphQL_FastAPI
```
3. Install the required dependencies:
```bash
pip install -r requirements.txt
```
**Usage**
1. Run the FastAPI server:
```bash
uvicorn main:app --reload
```
2. Access the GraphQL playground in your browser:
```bash
http://localhost:8000/graphql
```
Use the GraphQL playground to interact with the API by executing queries and mutations.
**API Documentation**
* **Swagger UI:** Access the Swagger UI for interactive API documentation:
```bash
http://localhost:8000/docs
```
* **Redoc:** Alternatively, access API documentation using Redoc:
```bash
http://localhost:8000/redoc
```
**Contributing**
Contributions are welcome! Feel free to open issues or submit pull requests to improve this project.
**License**
This project is licensed under the MIT License. See the LICENSE file for details.