BFF(Backend For Frontend) with GraphQL generated its DB schema (postgres) by sqlc.
- 99designs/gqlgen
- vektah/dataloaden
- kjconroy/sqlc
- Create
.graphql
- Create a new project in hygraph / strapi
- Edit the schema on the browser
- Fill
ACCESS_TOKEN
,ENDPOINT
in.env.local
docker compose run export
createsschema.graphql
- Generate autostub codes in
/gen
- Write
schema.sql
- Write
queries.sql
- Edit generate code for each model in
dataloaders/generate.go
- Generate files in
/gen
bydocker compose -f docker-compose.autogen up
- Write
- Fill the autostub codes.
- Write
resolver/resolvers.go
to pass queries todetaloaders
and mutations torepository
- Fill
repository/relations.go
only for entities with relations - Fill
dataloaders/dataloaders.go
- Write
- To migrate tables, write down DDL in
schema.sql
on pgweb
docker compose up
Then access Playground.
If you want to see raw database or query it, you can access pgweb
If you want to try GraphQL API with Insomnia, you can import Insomnia.yaml
.