You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Non-typescript services required for app operation or e2e tests (databases, proxies, message queues, etc).
Such services usually contain only configuration assets and optionally a Dockerfile.
CI/CD pipeline builds the package into a docker image if needed.
Note : the npm types package should always be present to allow centralized management of types across the monorepo.
Prerequisites
software
recommended version
Linux
Debian 12 bookworm
GNU Bash
5.2.15
Node.js
22.15.0
NPM
10.9.2
Docker
28.3.3
docker-buildx-plugin
0.26.1
Puppeteer browser
google chrome / puppeteer defaults
Scaffold your project
Use the following commands to scaffold a new project :
# clone the repository using degit
npx degit https://github.com/mulekick/vittel.git my-vittel-project
# cd into your projectcd my-vittel-project
# initialize monorepo and install dependencies
npm run deps:install
# run the initial build to make types available
npx lerna run build
Project structure
my-vittel-project/
βββ .nx/ # nx cache
βββ packages/ # workspace packages
β βββ backend/ # sample server app
β βββ frontend/ # sample browser app
β βββ types/ # shared types, parsers and enums
β βββ utils/ # shared utilities
β βββ e2e/ # end to end tests
βββ babel.config.js # global babel config (transpiles code for jest)
βββ docker.registry # registry for new docker images
βββ eslint.config.js # global eslint config
βββ jest.config.js # global jest config
βββ lerna.json # lerna config file
βββ nx.json # nx targets definition and orchestration
βββ package-lock.json # global npm lockfile (important)
βββ package.json # monorepo dependencies and workspaces
βββ tsconfig.json # global tsconfig
βββ typedoc.config.js # global typedoc config
Individual packages structures are detailed in their respective README pages.
CI/CD pipeline
Available CI / CD tasks are executed using lerna and depend on packages types :
name
npm
node
frontend
e2e
external
description
list
X
X
X
X
Lists known types for the package
dev
X
X
X
Starts the package in dev mode
typecheck
X
X
X
X
Validates the package types against tsconfig
lint
X
X
X
X
Lints the package code against eslint.config.js
test
X
X
X
X
Runs jest tests for the package
types:build
X
Creates *.d.ts files for the package types
build
X
X
X
X
Creates the package build
publish
X
X
Publishes the package build depending on its type
docker:lockfile
X
Copies global package-lock.json to the package directory
docker:build
X
X
X
Bundles the package and its dependencies into a docker image
docker:push
X
X
Pushes the docker image into the configured docker registry
docs:build
X
X
X
Builds typedoc documentation for the package
Tasks are orchestrated as targets according to the nxconfiguration.
Type npx lerna run <task> to execute the pipeline up to the specified target.
Depending on the use case, other tasks can be added and nx config must be updated accordingly.
Required tasks for external packages can vary depending on the use case.
Dependencies management
The recommended way of updating dependencies for the monorepo or for individual packages is to :
Update the relevant package.json files.
Run npm run deps:install so as to preserve the consistency of package-lock.json (very important).
The npm dependency graph sometime breaks which causes the docker:build target to error (a npm message will show in the docker logs).
If that happens, run the following commands :
# delete lockfile, node_modules folder and nx cache
npm run deps:reset
# reinstall dependencies and clean rebuild graph and lockfile
npm run deps:install
This project is at its fourth major iteration (it started with plain javascript, then react, then typescript, and now a full blown typescript-based monorepo).