Swarmion tools
In order to manage a scalable codebase, Swarmion comes with state of the art tooling for a Typescript monorepo. In this section, you'll learn why we chose each one, and what is important to know about them.
The main philosophy is to allow easy customization of the different tools used in the packages, without having to write too much code. Every tool can be configured at the root level and extended through composition at the package level.
Main features
📄️ pnpm with workspaces
pnpm and workspaces allows to create a monorepo with multiple packages, each with their own dependencies. Every package in the monorepo is considered as an npm package inside the monorepo. Every modification to its source code is instantly available to the other packages.
📄️ Nx
Nx is a powerful and extensible build system used to manage dependencies between packages, provide visualization of the monorepo dependencies through the pnpm nx graph command and gain access to powerful custom generators. Our nx plugin already has two generators, for libraries and serverless services (more are coming).
📄️ Eslint
A comprehensive set of formatting (through eslint-plugin-prettier) and linting rules, generated with Clinter. Once again, each package can easily extend the root configuration.
📄️ Vitest
Every package has testing configured through vitest, with a default configuration that can easily be extended, thanks to the vitest.config.ts file at the package level.
📄️ Typescript
Since every package inside the monorepo is using Typescript, every line of code can be statically checked. A strict and strong Typescript configuration is located at the root level, extended throughout the packages using composition.
📄️ Shared Typescript libraries
One of the main challenges of a Typescript monorepo is to build shared Typescript libraries. Packages are transpiled and bundled in cjs, esm (thanks to tsup) and .d.ts Typescript declaration file, to enable any usage across the monorepo.
📄️ VSCode support
Each package in the monorepo is defined as a workspace in the multi-root workspaces. It enables easier browsing and searching features, bringing the same navigation than in a standard codebase.