I have two separate projects:
- 1. a NextJS frontend project
- 2. a PayloadCMS project
Now, I want to consume my APIs from payload on my NextJS frontend. But I also want to query the API with type-safety. Do I just copy the types from
payload-types.ts
? What's the best way of going about this?
I also wish I knew about this template sooner:
https://github.com/payloadcms/nextjs-custom-serverDoes this template make you run NextJS and Payload in a monorepo and one express server?
Not sure if it is the
bestway, but copying
payload-types.ts
definitely works. Personally I like to include that step in my build process, that way I can't forget to update the types for a new deployment
Star
Discord
online
Get help straight from the Payload team with an Enterprise License.