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
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/imagekit
so 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 @Alessio 🍣
Done! I've added ImageKit to my readme ^^
❤️🔥
@Alessio 🍣 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?
🤷♂️ @denolfe since 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.
Star
Discord
online
Get help straight from the Payload team with an Enterprise License.