> For the complete documentation index, see [llms.txt](https://docs.devland.is/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.devland.is/technical-overview/adr/0001-use-nx.md).

# Use NX

* Status: accepted
* Deciders: devs
* Date: 03.05.2020

## Context and Problem Statement

We want a monorepo tool to help us to scale development up for multiple projects and teams. It should not be too much in the way, but help us manage code, dependencies and CI/CD.

## Decision Drivers

* Low complexity and overhead in development.
* Fit for our stack.
* Optimize CI/CD with dependency graphs and/or caching.
* Flexible.

## Considered Options

* [Bazel](https://bazel.build/)
* [Nx](https://nx.dev/)
* [Lerna](https://lerna.js.org/)

## Decision Outcome

Chosen option: "Nx", because:

* It's specially designed around our stack (TypeScript, React, Node.JS, NPM, ESLint, Prettier, Cypress, Jest, NextJS).
* It's relatively easy to learn with focused documentation.
* It has schematics to generate apps, libraries and components that includes all of our tools.
* It is opinionated, which gives us a good base to start developing faster. Many things can still be configured or extended.

## Pros and Cons of the Options

### [Bazel](https://bazel.build/)

* Good, because it's created and maintained by Google
* Good, because it supports multiple programming languages and platforms.
* Bad, because it's difficult to learn, with a custom BUILD files.
* Bad, because JS support is hacky.

### [Nx](https://nx.dev/)

* Good, because it has built in support for our stack.
* Good, because it's been around for a while, originating in the Angular world.
* Good, because it's designed with best practices for large scale web applications.
* Good, because it supports elaborate code generation.
* Good, because it helps optimise CI/CD for large projects.
* Bad, because it's fairly opinionated.
* Bad, because it's an open source project maintained by an agency.

### [Lerna](https://lerna.js.org/)

* Good, because it integrates with NPM and Yarn.
* Good, because it's used by a lot of open source projects.
* Bad, because it's primarily designed for managing and publishing open source projects, not building and deploying large scale applications.

## Links

* [Why you should switch from Lerna to Nx](https://blog.nrwl.io/why-you-should-switch-from-lerna-to-nx-463bcaf6821)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.devland.is/technical-overview/adr/0001-use-nx.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
