About one Payload repo and different frontend repo #9513
Replies: 2 comments 4 replies
-
I don't think so. The getPayload function is an local api. So the frontend and payload have to live together. But thats why the rest/graphql api exists. You could fetch the api endpoint in your server components to achieve the same outcome as you do with payload.find. I can imagine if you have payload installed and the configs copied over to your frontends then it would work too. (As its "only" db calls). But that defeats the purpose a bit for having it extra. So no you cant really but thats no payload restriction. Its more an technical one as your Browser cant call the DB directly. Use the Rest Api and copy over the types generated by your payload repo. Then you have type Safe api calls. :) |
Beta Was this translation helpful? Give feedback.
-
i am using this rest client which is very close to the local API in my astro project |
Beta Was this translation helpful? Give feedback.
-
My scenario here is i do have one payload repo that have all the collections added there but we are thinking to have different frontend repo that is going to be used in different frontend language some repo will be Reactjs project some of them NextJS project. we will use payload api there.
so my question is can i get payload.find or getPayloadHMR in frontend? I want to fetch data using payload.find in frontend can i use it ?
Beta Was this translation helpful? Give feedback.
All reactions