graphile / graphile-engine

Monorepo home of graphile-build, graphile-build-pg, graphile-utils, postgraphile-core and graphql-parse-resolve-info. Build a high-performance easily-extensible GraphQL schema by combining plugins!
https://www.graphile.org/
761 stars 129 forks source link

Example project #55

Closed lifeiscontent closed 6 years ago

lifeiscontent commented 7 years ago

Hey @benjie I'm wondering how to use graphile-build / postgraphql together. I'm planing on wrapping postgraphql in a node app, and writing some custom plugins for the validation we talked about over google hangouts but unsure how to tie it all together.

are there any docs currently that illustrate working examples?

benjie commented 7 years ago

Does this comment help? https://github.com/postgraphql/postgraphql/pull/506#issuecomment-315529696

Help writing docs to illustrate working examples would be welcome!

lifeiscontent commented 7 years ago

@benjie Yep, very helpful, if I wanted to pass a list of plugins from that plugins.js file, how would I do that within the CLI?

benjie commented 7 years ago

I wrote some docs on this yesterday as it happens: https://www.graphile.org/postgraphile/extending/#loading-additional-plugins

benjie commented 7 years ago

(Comma separated list; there's no shortcut for pulling multiple out of the same file currently... perhaps we should add ; for that? `--append-plugins graphile-build-pg:PgTypesPlugin;PgIntrospectionPlugin;PgWhateverElsePlugin,./myplugins.js:Plugin1;Plugin2;Plugin3?)

newswim commented 7 years ago

I'm personally opting for the use-as-library option. Passing paths as arguments isn't that bad, but it might be nicer to use a config file at that point. I could see a lot of plugins getting used.

As an interesting aside, there's a project right now that seems to offer a json/yml alternative, with some degree of type safety. See: https://github.com/graphcool/gcl

chadfurman commented 7 years ago

I'm going to be working on a Relay Modern boilerplate that uses PostgraphQL and Docker Compose. Anyone interested in helping with this? I have a chunk of proprietary code I want to turn into a re-usable open-source template.

lifeiscontent commented 7 years ago

@chadfurman send me a link, I'd love to take a look.

benjie commented 7 years ago

I'm definitely keen to see that example! đź‘Ť

chadfurman commented 7 years ago

Very good, let me scrub any proprietary mentions and custom / non-applicable code. I'm about 2 weeks behind on my current schedule; however, I would like to get the ball rolling on some form of boilerplate.

I'll add this to my task list and try to slip something together asap. I'll need to find a few 2-hour blocks over the next week or so to make this real.

benjie commented 7 years ago

Make it a repository unto itself and ensure it uses a lockfile (preferably yarn.lock); would be great to link out to it from the docs/etc đź‘Ť

chadfurman commented 7 years ago

@benjie I was planning on making a repo for it and calling it the Relay-Postgrres-Graphile boilerplate ^_^

benjie commented 7 years ago

+2 to repo creation

chadfurman commented 7 years ago

Confirmed that I will be working on this over the weekend. Will have something posted here asap

chadfurman commented 7 years ago

@benjie It doesn't run yet, but here is code: https://github.com/chadfurman/rpg-boilerplate

I'll work on it more tomorrow when I wake up and turn it into a running thing.

Note you'll need docker, sqitch, and will want to change the env vars. You'll also have to npm install in both of the api and frontend folders.

I'll try to add a readme also that talks about directory structure and more.

chadfurman commented 7 years ago

@lifeiscontent check it out, let me know. Again, I'll be cleaning it up tomorrow. This is just a rough skeleton I pulled out of my code base.

chadfurman commented 7 years ago

I added you both as collaborators, so feel free to take a whack at it if you'd like.

chadfurman commented 7 years ago

@benjie I tossed this in there also: https://github.com/chadfurman/rpg-boilerplate/blob/master/api/src/plugins/PluginName.js

https://github.com/chadfurman/rpg-boilerplate/blob/master/api/src/index.js#L3

chadfurman commented 7 years ago

@benjie @lifeiscontent I've fixed all the bugs and added some initial documentation. Please let me know what you think.

benjie commented 7 years ago

Have had a quick look through on my phone and it all looks good. A few comments:

Great work; thanks for doing this đź‘Ť

chadfurman commented 7 years ago

@benjie I'll address all of this feedback today. Thanks!

chadfurman commented 7 years ago

@benjie changes made. One thought is that there's a lot of content and discussion in the old postgraphql repo that we need to make sure we don't lose. Also, all new devs using postgraphql should be informed as soon and as often as possible that postgraphile is the new version.

This could possibly be done with a deprecation notice once postgraphile is stable. It could / should also be done on the readme here: https://github.com/postgraphql/postgraphql/

benjie commented 7 years ago

Yeah, once PostGraphile is in beta I'll be making that change. I've already started editing the README. I also added a banner to the header on the graphile.org site once you're inside the PostGraphile documentation. I'm also making an effort to publish both modules at the same time. Basically... I'm on it. But my main priority is to get v4 out of alpha and into beta - once that's done I'm probably going to merge it into a next branch on GitHub and make that the primary README for the postgraphql repo.

benjie commented 6 years ago

[semi-automated message] Hi, there has been no activity in this issue for over 8 weeks so I'm closing it to keep the issues/pull request manageable. If this is still an issue, please re-open with a comment explaining why.