ARG Nx Monorepo

The ARG way of running NestJS microservices and a Next.js front end in one Nx and pnpm workspace. The workspace stays organised and each service stays independent as the number of services grows.

Installation

npx skills add ARG-Software/arg-agent-skills --skill arg-nx-monorepo

What it does

  • Each service covers one business area and owns its own data and database schema. No service reads another service's tables, so services can change and deploy independently.
  • Domain, application and infrastructure code live in separate Nx libraries with tags. Nx enforces which library may import which, so architectural boundaries are checked on every build.
  • Services communicate through asynchronous messages on Kafka or RabbitMQ with versioned contracts. An outbox guarantees that no message is lost when a write succeeds, and consumers are safe to run twice.
  • Commands and queries are separated and return explicit Result types. CI uses nx affected to build and test only what changed, and every deployable app gets its own Docker image and version.

Used when

The skill applies when scaffolding or extending an Nx workspace, adding an app, library, service, command, query, repository or message consumer, choosing between Kafka and RabbitMQ, naming services, topics and queues, or setting up CI, Docker images and releases.

This skill is distilled from ARG's Nx monorepo boilerplate. While reviewing that boilerplate we found the problems that usually creep into monorepos: boundaries nobody enforced, application code importing infrastructure, thin tests and CI that rebuilt everything on every change. Each of those is now an explicit rule with a check behind it.