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.

Using Drizzle/Mongoose directly

default discord avatar
jasonaa12 months ago
10

If I use Payload CMS, I get a admin interface, GraphQL and REST APIs for free, migrations handled, etc.



Can I still use Drizzle or Mongoose directly to update data, or do I need to exclusively use Payload's tooling for changes? I think this is the case but wanted to be sure.

  • discord user avatar
    alessiogr
    12 months ago

    Absolutely you can! Drizzle and Mongoose is fully exposed by payload - you can find it inside of

    payload.db
  • default discord avatar
    jasonaa12 months ago

    thanks, looking forward to playing with payload!

  • default discord avatar
    techinverted9 months ago

    @Alessio🍣 Would it be faster using payload.db to update or create data ?

  • discord user avatar
    alessiogr
    9 months ago

    payload.db is faster, but it lacks support for lots of things like access control and hooks. It's basically a direct database call with very little payload other than where queries and pagination

  • default discord avatar
    techinverted9 months ago

    Okay makes sense. It’s exactly what I was looking for



    @Alessio🍣 I had another question, if I run payload in a nodejs cluster is there anything I need to keep in mind or best practices?

  • default discord avatar
    ssyberg8 months ago

    Did you end up trying this? If so how did you configure it?

  • default discord avatar
    techinverted8 months ago

    @seth It’s quite simple. You can use payload.db anywhere you need with the local api.



    I’ll try and find you an example when I get back



    Oh wait, are you referencing the cluster setup? I did set it up



    I used pm2 to create a cluster, I’ve also implemented on railway using their cluster implementation (replicas)

  • default discord avatar
    ssyberg8 months ago

    So I actually had a huge performance boost just spawning multiple workers in

    server.ts

    I saw a 3-4x increase overall without using PM2!

  • default discord avatar
    techinverted8 months ago

    Ooh nice @seth , I’ve done that as well. I use them for intensive cronjobs. What are you using for workers to do ?

  • default discord avatar
    ssyberg8 months ago

    Just serving lots of web requests!

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