Ask
104
@query_quinn ·

drizzle or prisma for two devs on cloudflare workers, bundle budget is tight Drizzle

Two of us, new B2B app, Workers in front of Postgres. Neither of us has strong feelings, we both know Prisma from previous jobs and neither has shipped drizzle. Deciding now so we do not rewrite the data layer in three months. What actually differs in practice on Workers specifically?

7 answers Share
Report

Answering anonymously — a moderator will review it first.

  • @slowtrainjo · 5mo ago · 2 replies

    Drizzle on Workers, and the reasons are boring rather than ideological.

    • It is plain JavaScript. No query engine to ship, no wasm, nothing that fights the size budget.
    • No codegen step in the deploy path. drizzle-kit runs when you change the schema, not on every build.
    • Swapping between D1, a Postgres HTTP driver and Hyperdrive is a driver import change, not an architecture change.

    Prisma does run on Workers with driver adapters and people ship it. But you are carrying a wasm engine and a generate step in an environment where bundle size and startup both cost you. On a normal Node host that calculus flips and I would tell you to use whichever you already know.

    128
    Share
    Reply

    Answering anonymously — a moderator will review it first.

    Report
    • @pentalobe_junie · 5mo ago

      The generate step was our actual pain, not the size. Fresh CI checkout, generate, cache miss, three minutes. Every branch. drizzle-kit only runs when the schema file changes, which is once a fortnight.

      33
      Share
      Reply

      Answering anonymously — a moderator will review it first.

      Report
  • @nadia_brill · 5mo ago · 2 replies

    The honest counterweight: Prisma is nicer for two people who do not want to think about SQL. Nested writes, the migrate workflow, Studio for poking at data — that is a real productivity story and drizzle does not have an equivalent for all of it.

    Drizzle asks you to know SQL. Not as a slogan — you will write sql template fragments for anything beyond CRUD, and if neither of you enjoys that, you will be slower. In that case pick Prisma and run it somewhere that is not an edge runtime.

    66
    Share
    Reply

    Answering anonymously — a moderator will review it first.

    Report
    • @iron_camber · 5mo ago

      "Drizzle asks you to know SQL" should be at the top of its docs. It is not a shortcut around SQL, it is SQL with types and autocomplete. If you like that, it is the best thing available. If you wanted to not learn window functions, it will not save you.

      24
      Share
      Reply

      Answering anonymously — a moderator will review it first.

      Report
  • @wild_ferment · 5mo ago

    If there is any chance you end up on D1 rather than Postgres, drizzle, no debate. Its batch/prepared statement API lines up with how D1 wants to be called, and you will be doing a lot of batching because chatty per-row queries against D1 is not a good time.

    41
    Share
    Reply

    Answering anonymously — a moderator will review it first.

    Report
  • @kitchen_table_talk · 5mo ago

    Third option nobody lists: kysely. Typed query builder, no migration engine, no opinions, tiny. You bring your own migration runner, which for two people is a folder of .sql files and thirty lines of node.

    22
    Share
    Reply

    Answering anonymously — a moderator will review it first.

    Report
  • @airflow_amir · 5mo ago

    Two people: let whichever of you has an actual opinion pick, write it down with the date, and do not revisit for a year. The cost of the meeting exceeds the difference.

    12
    Share
    Reply

    Answering anonymously — a moderator will review it first.

    Report