Mediathek docs

Decisions

ADR-0001 — A monorepo whose backend is not a workspace

Status: Accepted · Date: 2026-08-28

Context

The repository holds a Gatsby 5 site, a pure-TypeScript domain package and an AWS Amplify Gen 2 backend. npm workspaces is the obvious way to hold three packages together, and the obvious thing is to make all three workspaces.

It does not work. Gatsby 5 needs graphql 16. The Amplify Gen 2 data construct needs graphql 15. npm workspaces hoists a single copy to the root node_modules, and one hoisted tree cannot satisfy both.

The failure is not a clear version error. Whichever copy npm hoists is what graphql-compose resolves at build time, and if 15 wins, gatsby build dies inside buildSchema with:

Cannot create as TypeComposer … GraphQLScalarType(Date)

which names neither graphql nor Amplify, and points at Gatsby's schema builder — a place where nothing is wrong.

Decision

backend/ is not an npm workspace. It has its own package.json, its own package-lock.json and its own node_modules, installed separately:

npm install && npm --prefix backend install

And, as the other half of the same decision, graphql: ^16 is named as a direct dependency of packages/site, even though nothing there imports it. aws-amplify v6 drags graphql 15 in transitively; naming 16 explicitly is what makes npm hoist 16 deterministically instead of by accident of resolution order.

Consequences