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.

Recommended approach serverless/cloud?

default discord avatar
dbssd2 years ago
3

We are just starting out on our journey of integrating with payload, coming from a background of wordpress/ACF and having many other projects with nextjs without a backend, we have been looking for a CMS exactly like payload to bring together the best of both for our projects.



We would like to use payload to power our nextjs website, it has both static and dynamic content with ecommerce elements.



What I'm wondering is, there are many approaches you can take with payload, putting payload into our nextjs repo serverlessly looks powerful for the future with the app directory powering both payload and our frontend.



However, we are not sure if that is the best way deploy, we will want dynamic elements in the near future and are not sure if this is the way forward or if we should separate payload and use payload cloud?



My current understanding is this would keep the two separated (backend repo / frontend repo), which seems more clunky for typescript typings from payload as well as deployments?

  • discord user avatar
    denolfe
    2 years ago

    Welcome

    @1095987858617151568

    ! Glad you found us.



    There are trade-offs to each approach:



    1. Payload + Next.js, serverless on Vercel. This approach is great for lightweight apps that don't do a lot of heavy-lifting. The main downside here is that you'd need to account for cold-starts that are inherent with any serverless platform.



    2. Payload + Next.js deployed separately. This is typically the approach that we recommend as it offers greater flexibility in deployment platforms. The downside is like you said, you have to deal with 2 deployments.



    If I were starting a large, greenfield project with Payload and Next.js. Here's how I would do it:



    - Monorepo with 2 separate "apps": Payload, Next.js


    - Configure a

    payload-types

    package within the monorepo for Payload to compile the types to.



    This has the benefit of:



    - Unified git history and repo tooling


    - Shared types between frontend and backend


    - Can utilize deploying

    either project

    from the same repo as most deployment platforms let you set the src directory (if needed for your monorepo).

  • default discord avatar
    pandazaar2 years ago

    is there anywhere an example for how to do the payload-types package within the monorepo? I currently just copy paste the types but if there's a way to skip that part I'd be glad

  • discord user avatar
    denolfe
    2 years ago

    It will vary between monorepos depending on what you use to manage it. However, they'll all have the concept of a "shared package", which is where you'll configure your payload script to output to



    I don't know of an example offhand

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.