graphback icon indicating copy to clipboard operation
graphback copied to clipboard

Graphback templates improvments

Open wtrocki opened this issue 4 years ago • 5 comments

Templates should have separation of concerns

When using Graphback templates we geting index.ts file that has multiple elements and concerns that developers need to read. It will be much better to have graphback.ts file

See example PR that has this: https://github.com/RedHat-Middleware-Workshops/rhtr-2020-api-mgmt-kafka-workshop/pull/3

Additionally, we could extract migrations and have this also visible for users as well.

Templates should use different subscription mechanisms

In memory, subscriptions are not helping to understand concepts.

Enterprise template is needed

We need to provide an enterprise template. See #2016

Template can be consumable as docker images (along with graphback code)

Building all templates into quay will be desirable to be able to test stuff in container land.

wtrocki avatar Sep 11 '20 12:09 wtrocki

/cc @craicoverflow, @machi1990 Automatically generated comment to notify maintainers

machi1990 avatar Sep 11 '20 12:09 machi1990

Very good issue. Thank you for opening it @wtrocki

I think in this template we can push for a "certain" architecture / project structure. E.g instead of having a db.ts file, maybe we can have a database/create-data-provider.ts, subscriptions/setup-pub-sub.ts, resolvers/mutations/xxx-mutation.ts, resolvers/query/xxx-query.ts etc something self explanatory, with clear separations of folders to indicate a structure / organisation. Add a testing folder and an example test file, unit testing a custom resolver for example, and an integration test etc

/!\ Thinking out loud.

Enterprise template is needed

We need to provide an enterprise template. See #2016

Do you see this issue superseding #2016?

machi1990 avatar Sep 11 '20 12:09 machi1990

In my view, the current templates are "starting points" and do need need to push a certain architecture. From experience I dislike when templates have a certain architecture which I don't plan on keeping, it then creates more work for me. I would like to see an opinionated, production/enterprise template though, this can have more stuff and be more organised.

  • ts-apollo-mongodb-basic-backend
  • ts-apollo-postgres-basic-backend
  • ts-apollo-mongodb-enterprise-backend
  • etc...

https://github.com/graphql-boilerplates/typescript-graphql-server/tree/master

craicoverflow avatar Sep 11 '20 13:09 craicoverflow

In my view, the current templates are "starting points" and do need need to push a certain architecture. From experience I dislike when templates have a certain architecture which I don't plan on keeping, it then creates more work for me. I would like to see an opinionated, production/enterprise template though, this can have more stuff and be more organised.

  • ts-apollo-mongodb-basic-backend
  • ts-apollo-postgres-basic-backend
  • ts-apollo-mongodb-enterprise-backend
  • etc...

I agree with you on templates being a "getting-started" and very fine with what we already have as a getting started. Having a different flavour, with a bit more structure, an example Dockerfile, testing, and possibly other scripts (e.g hot reloading with nodemon or node-dev ) that reflects the workflow likely to be encountered on a modern web API. The idea is to show more than just setting up a Graphback API,

  • but how the project can be organised (this in accordance to our expertise and frankly, our opinion on how to structure a GraphQL API),
  • how it can be tested,
  • how it can be built, deployed etc

machi1990 avatar Sep 11 '20 13:09 machi1990

https://github.com/graphql-boilerplates/typescript-graphql-server/tree/master

This is a good starting point but I see things like testing, which is core, are missing

machi1990 avatar Sep 11 '20 13:09 machi1990