What platforms do you recommend me to deploy a Payload and NextJS app based on the
nextjs-custom-server
template from this repo:
https://github.com/payloadcms/nextjs-custom-server?
I tried Vercel but I don't know why everything related to Payload is not working...
Hey Juan - our team and a number of our community members use Digital Ocean to host Payload, and then Vercel for the frontend, but there are a number of different combinations you could use. It's whatever works best for your specific situation.
If you look through the threads there are quite a few discussions about this as well
I see but one thing that still confuses me is, in my case I have both my frontend code and my server code in the same repo. How do I deploy only the server code on Digital Ocean? should I just target the repo and Digital Ocean will do the magic? 👀
@Juan Sebastián Mendoza What you are experiencing is to be expected. That example uses a custom server (the server.ts file) to boot up Next, when you use a custom server with Next you cannot deploy on Vercel.
That being said, we normally split the two out, backend (Payload) and frontend (Next) and deploy the backend to Digital Ocean or similar - and then the frontend to Vercel or similar. This workflow works really well.
Maybe we should call this out explicitly in the Readme of this repo to avoid confusion down the road.
Splitting your frontend and backend should be fairly easy to do, lmk if you have questions!
I got it now. And calling this out in the Readme would definitely be very helpful for beginners. And a quick YouTube tutorial showing all this procedure would be much appreciated as well, just in case :D
+1 for more beginner tutorials.
Alternatively, @Alessio 🍣 recently made a very nice video tutorial for hosting Payload on Northflank and Railway (I use Railway and it's fantastic; you can provision a Mongo instance right beside it and it automatically adds all the Mongo env vars -- great for a development environment or smaller projects).
But yes, I'd recommend either Netlify or Vercel to host the frontend, whatever it may be.
@Juan Sebastián Mendoza I would split the project into backend and frontend. Makes its much easier to deploy. Then you can deploy the front end on Vercel as @Jarrod suggested. I have deployed a couple of backend projects to a AWS Lightsail instances running Plesk through a bitbucket pipeline using rsync. Bit of a process to set up, but once done deploying updates to staging/production is as easy committing to staging/production branch