This repository is a template for Python project to build a GraphQL server. You can use this template to create a new Python project with the following features:
strawberry
for GraphQL serverpoetry
for dependency/requirements management and virtual environment setuppytest
configuration for testingblack
configuration for lintingclick
for command line interfaceloguru
for logging setup at different levelsDockerfile
anddocker-compose
setup for containerizationMakefile
with common tasks
To run the GraphQL server, use the following command:
make lint test # Perform linting and test
make run
This project is using the strawberry python library for GraphQL server which comes with GraphQL/GraphIQL dashboard.
After running the server as shown above, go to the following URI in your browser:
http://127.0.0.1:8000/graphql
You can find more useful commands in the Makefile
.
To create a new project using this template, run the following command:
export APP_NAME=my-new-app
git clone --recursive https://github.com/ylogx/graphql-template.git ${APP_NAME} && cd ${APP_NAME} && bin/new-project
This will clone the repository and setup code for your new specified App Name.
This will install dependencies and setup a virtual environment for the project.
You can use poetry
commands to manage dependencies and virtual environment.
Here's how the installation looks like: