Simplify your stack and build anything. Or everything.
Build tomorrow’s web with a modern solution you truly own.
Code-based nature means you can build on top of it to power anything.
It’s time to take back your content infrastructure.

separate nextjs + payload apps, or use the custom nextjs server?

default discord avatar
sibergenomelast year
2

I'm building out a website that that serves static content that will regularly change. there aren't any users, its just going to show posts, articles etc. I'm thinking either next js's ISG or opting for CSR since I want loading between pages to be fast and smooth. however I've been looking at payload's custom server (

https://github.com/payloadcms/nextjs-custom-server

) and wondering if this would be ideal? I'm a reasonably experienced developer, having used react + express + TS etc, and I've got the gist of payload, however I'm not very familiar with nextjs. I can't decide if i should have separate servers for payload + nextjs, or take advantage of the custom server. Anyone got any hints / tips / recommendations?

  • default discord avatar
    derosullast year

    Hey, I don't think any of the options you mentioned are wrong. If you're not too sure that you want to use NextJS, you probably want to keep it separate for now. The beautiful thing about Payload is that the CMS you create are mostly config files in Typescript and payload takes care of the rest. Meaning it's pretty easy to switch between the setups.



    One of the main advantages for the NextJS setup for both the custom server and the NextJS integration they released recently, is that you can deploy your CMS and your frontend together.



    So my recommendation would be, start of with the standard payload setup, try to do some things with NextJS and once you decided that you want to use NextJS. Migrate you payload collections and configs to a NextJS custom server / next-payload project.



    And fyi: there is a difference between nextjs-customer-server and next-payload.



    NextJS custom server is a combination where you run an express server and NextJS app simultaneously.


    The next-payload is a setup where you can deploy Payload "serverlessly" on for example Vercel (which is pretty awesome) directly from your NextJS project.

  • default discord avatar
    sibergenomelast year

    I'm pretty set on Nextjs just because of how well it pairs with payload, and since I'm familiar with react. But I agree that since payload is mostly just config then migrating the project to the nextjs custom server shouldn't be too tricky! So then I think I'll probably keep it separate projects until I feel more comfortable with nextjs and migrate if it seems beneficial, or otherwise use next-payload.


    Thanks for the help!

Star on GitHub

Star

Chat on Discord

Discord

online

Can't find what you're looking for?

Get dedicated engineering support directly from the Payload team.