Lightweight, easy-to-develop graphql server that includes all you need to build amazing projects 🔥
- 🔮 Gqlgen — Generated, type safe Graphql for Go
- 👽 Mongo Driver - The official Mongodb driver for Go
- 🐶 Dataloaden — Generated type safe data loaders for Go
- 📄 Echo - High performance, extensible, minimalist Go web framework
Server:
- Using Labstack Echo
- Restapi example
- prometheus implementation
- healthz - basic (demo only) health probe implementation
Graphql:
- using the latest (0.13.0) Gqlgen version
- playground security with http header password (Disable Introspection)
- custom scalar example
- dataloader examples (https://github.com/vektah/dataloaden) for n+1 problems
MongoDB
- model examples
- multiple db connections implementation
Other
- Config package for reading and caching ENV-s from global env, kubernetes, or docker swarm
- Using Makefile, Docker-compose for faster development
step1 - build local environment with docker-compose
make generate
make start
step2 - start the server (inside docker)
make run
step3 - restart the server (inside docker)
CTRL + C
make run
regenerate gqlgen files
CTRL + C
make generate
make run
open http://localhost:9090
.
add "Playground-Password": <GRAPHQL_PLAYGROUND_PASS> to request header
add "Authorization": Bearer <JWT TOKEN> to request header
- step 1 - create new user
mutation {
authBasicStrategySignUp(data: {
email: "[email protected]"
password: "xxxxx"
username: "x"
}) {
token
}
}
- step 2 - check created user
query { userMe { email username role } }
- step 2 - add ADMIN role to the generated user (through db admin [mongo atlas, robo3t, etc...])
- step 1 - create the model
- TODO
step0 - make sure to provide envs (copy .env file to build folder or provide global envs)
step1 - binary build
make generate
make build
step2 - run
./build/go-graphql-mongodb-boilerplate