Recommended platforms to deploy a Payload app

default discord avatar
Juan Sebastián Mendoza
6 months ago
30

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...

  • discord user avatar
    zubricks
    Payload Team
    6 months ago

    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

  • default discord avatar
    Juan Sebastián Mendoza
    6 months ago

    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? 👀

  • default discord avatar
    Jarrod
    6 months ago

    @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!

  • default discord avatar
    Juan Sebastián Mendoza
    6 months ago

    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

  • default discord avatar
    Taun
    6 months ago

    +1 for more beginner tutorials.

  • default discord avatar
    TheDunco
    6 months ago

    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).



    https://discord.com/channels/967097582721572934/967105150068092968/1082037639395422351

    But yes, I'd recommend either Netlify or Vercel to host the frontend, whatever it may be.

  • default discord avatar
    christopher.nowlan
    6 months ago

    @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

  • default discord avatar
    TheBilTheory
    6 months ago

    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?

  • default discord avatar
    Alessio 🍣
    6 months ago

    For any kind of images, I'm currently using ImageKit - works very nice

  • default discord avatar
    TheBilTheory
    6 months ago

    I'll check it out. Do you have a tutorial on how you implemented it?

  • default discord avatar
    Alessio 🍣
    6 months ago

    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/32

    You 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

  • default discord avatar
    TheBilTheory
    6 months ago

    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 🍣

  • default discord avatar
    Alessio 🍣
    6 months ago

    Done! I've added ImageKit to my readme ^^

  • default discord avatar
    Alessio 🍣
    6 months ago

    resolved 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

  • default discord avatar
    TheBilTheory
    6 months ago
    ...
    "@payloadcms/plugin-cloud-storage": "https://github.com/AlessioGr/plugin-cloud-storage.git#imagekit",
    ...


    Like this but I have declaration issues.

  • default discord avatar
    Alessio 🍣
    6 months ago

    Ahhh hm, didn't know that works! What declaration issues?

  • default discord avatar
    TheBilTheory
    6 months ago

    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)
  • default discord avatar
    Alessio 🍣
    6 months ago

    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.

  • default discord avatar
    TheBilTheory
    6 months ago

    Any news from the Payload team to review your PR?

  • default discord avatar
    Alessio 🍣
    6 months ago

    🤷‍♂️ @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

  • discord user avatar
    denolfe
    Payload Team
    6 months ago

    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.

  • default discord avatar
    Alessio 🍣
    6 months ago

    oh sure no worries - cloud comes first! 😄

  • default discord avatar
    TheBilTheory
    6 months ago

    Talking about the Cloud. When will we able to test it out?

  • default discord avatar
    Tinouti
    6 months ago

    They're announcing it on Monday, not sure if that also means availability on Monday or if it'll be a bit later though.

Open the post
Continue the discussion in Discord
Like what we're doing?
Star us on GitHub!

Star

Connect with the Payload Community on Discord

Discord

online

Can't find what you're looking for?

Get help straight from the Payload team with an Enterprise License.