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? 👀
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,
@360823574644129795recently 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.
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
@281120856527077378suggested. 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
I've just tried Railway with a Payload Instance inside a Turborepo. Seamlessly noice. 👌
However I was wondering what where your recommendation for persistent media?
What are alternatives to S3 buckets?
For any kind of images, I'm currently using ImageKit - works very nice
I'll check it out. Do you have a tutorial on how you implemented it?
Pretty simple, I'm just using the cloud storage plugin - my imagekit PR wasn't merged yet though:
https://github.com/payloadcms/plugin-cloud-storage/pull/32You can use it directly from my PR branch:
https://github.com/AlessioGr/plugin-cloud-storage/tree/imagekitso pretty much just install that and set the imagekit endpoint, public & private key accordingly
I'll git it a shot! You might wanna update the README with the additional adapter in your PR before you get a comment on it
Thank you
@360823574644129795Done! I've added ImageKit to my readme ^^
❤️🔥
left you a comment
https://github.com/payloadcms/plugin-cloud-storage/pull/32/files#diff-3bd0e4d81b03310102214fbcac7783ff2f0fd5024b7028eb5980a165ec4b6f81resolved it!
How are you installing it in your project, by the way? Didn't find a reliable way to add branches not added to npm without copying it over manually
...
"@payloadcms/plugin-cloud-storage": "https://github.com/AlessioGr/plugin-cloud-storage.git#imagekit",
...
Like this but I have declaration issues.
Ahhh hm, didn't know that works! What declaration issues?
These
Error: Cannot find module '@payloadcms/plugin-cloud-storage'
Cannot find module '@payloadcms/plugin-cloud-storage' or its corresponding type declarations.ts(2307)
import imageKitAdapter
const imageKitAdapter: any
Module '"@payloadcms/plugin-cloud-storage/imagekit"' has no exported member 'imageKitAdapter'.ts(2305)
Ah weird - no idea why. I've always had issues adding a github project directly into the package.json - tried various ways there.
Prob best to just copy the plugin manually into your project - that's how I'm doing it currently.
Any news from the Payload team to review your PR?
🤷♂️
@967118574445547650since you've been working on the plugin lately, what do you think about
https://github.com/payloadcms/plugin-cloud-storage/pull/32?
Currently using it in production just fine - I think what could mainly be weird with my PR is the introduction of an extra "cloudImageID" field
To be completely honest, it's been all hands on deck to get Cloud out, and we haven't had a chance to look this over.
oh sure no worries - cloud comes first! 😄
Talking about the Cloud. When will we able to test it out?
They're announcing it on Monday, not sure if that also means availability on Monday or if it'll be a bit later though.
is this still a way to go in 2025? cant find some good guidelines how and where to host payloadcms backend + frontend.
I hate to be this guy, but I want to warn you not to use Payload Cloud. I decided to use Payload Cloud for a recent project, expecting everything to work out of the box, but S3 uploads fail 3 times out of 4 with the error "Error: Empty file" and there's no real way for me to debug it since it's all plug and play. You really need to roll your own.
thanks, any info is good. Was not considering payload cloud. Looking into Vercel as it seems to be preferred option as I see from other posts/articles/tutorials but not sure yet about limitations. I guess it will be trial and error.
Star
Discord
online
Get dedicated engineering support directly from the Payload team.