#Connecting Payload CMS to Next.js more seamlessly?

12 messages · Page 1 of 1 (latest)

distant vale
#

I'm curious if this sounds crazy or not, but I'm looking to take the GQL queries Payload CMS makes possible and automatically make them available on the Next.JS side of my application.

Is there a tool or common methodology for this? I noticed types and schema are exportable by default. Not sure if these are related to a potential solution.

distant vale
#

I discussed this with my team and it seems like the tradeoff is to either use REST to not have to define GQL requests and have less control over the request size or use GQL but have to maintain the Query strings.

We opted for the latter and just to improve our interface for making requests. If there's any feedback as to why this would be a terrible idea, let me know lol.

red briar
distant vale
#

autocompletion isn't a huge concern for me atm. but yeah you're right that that should do that for me.

The issue is that any time I update fields in Payload, I have to go over to the Next.js side and make sure it's sync'd up.

Ultimately though, it's hard to tell what fields you want to keep and want to exclude in an automated fashion so we prefer to keep that maintenance layer going and to just do what we can to make that a clean process.

red briar
#

I swear to god this was mentioned somewhere in this discord but I cannot find it - it was months ago

#

you can add a remote schema there

#

and in there you specify the gql endpoint or sth like that

distant vale
#

interesting... I'll def take a look! Thanks @red briar

red briar
#

You're welcome!

#

oh shame on me