Aller au contenu

🧱 Bricks - Monorepo

This repository contains all the code maintained by the Bricks Engineering team.

Requirements

  • Node 22.13.0 (pinned in .nvmrc)
  • PNPM 11.xcurl -fsSL https://get.pnpm.io/install.sh | sh -
  • Turborepo — installed automatically via pnpm

Getting started

Install all dependencies across the monorepo:

pnpm install

Environment variables are managed through Doppler (no .env files). See docs/doppler-environment-variables.md for setup.

Launch apps

Root package.json exposes Turborepo-powered dev scripts:

pnpm dev:mobile              # Expo mobile app (front-mobile-app)
pnpm dev:webapp              # Vite web app (front-app)
pnpm dev:api                 # NestJS API
pnpm dev:app-pdp-financement # Porteur de projet app
pnpm dev:bricksoffice-invest    # Admin backoffice (investor management)
pnpm dev:bricksoffice-projects  # Admin backoffice (project management)

Each command wraps turbo watch dev --filter <package>. For project-specific setup, refer to each project's README.

Architecture

Overview

+-- projects/
|   +-- api/                    REST API (NestJS)
|   +-- front-mobile-app/       Investor mobile app (Expo / React Native)
|   +-- front-app/              Investor web app (Vite)
|   +-- app-pdp-financement/    Project owner app (Expo / React Native)
|   +-- bricksoffice-invest/    Admin backoffice for investor management (React / Vite)
|   +-- bricksoffice-projects/  Admin backoffice for project management (React 19 / Vite 8 / TanStack)
|   +-- storybook/              Storybook for web components
|   +-- storybook-native/       Storybook for native components
|   +-- common/
|       +-- both/
|       |   +-- api-communication/                    Shared API contract (endpoints, validators, branded types)
|       |   +-- api-communication-bricksoffice/ Admin-specific API contract
|       |   +-- helpers/                               Pure helpers shared between front and back
|       +-- front/
|       |   +-- helpers/             Front-specific helpers (i18n, formatters, Datadog)
|       |   +-- theme/               Uniwind theme tokens (colors, spacing, typography)
|       +-- uimmo/                   Design system (74+ components, Uniwind-based)
+-- docs/                       Team documentation
+-- tools/                      Internal tooling (bricks-intel)

Build system

The monorepo uses pnpm workspaces + Turborepo for task orchestration, caching, and dependency graph awareness.

pnpm test             # Run tests for affected packages (vs develop)
pnpm test:api         # Run API tests
pnpm test:mobile      # Run mobile tests
pnpm knip             # Detect unused exports and dependencies

ESM vs CommonJS

The monorepo uses ESM modules. The API is configured with CommonJS. Shared libraries that are consumed by the API produce dual builds (ESM + CommonJS) via tsup.

The API builds its dependency libraries first via tsconfig-deps.json, producing CommonJS output, then builds itself with nest build.

Adding a shared library to the API

  1. In the library's package.json, replace "type": "module" with dual exports:
{
  "main": "dist/commonjs/index.js",
  "module": "dist/esm/index.js"
}
  1. Create a tsconfig-api.json extending the library's tsconfig with CommonJS output:
{
  "extends": "./tsconfig.json",
  "compilerOptions": {
    "module": "CommonJS",
    "baseUrl": "./",
    "rootDir": "./",
    "outDir": "dist/commonjs"
  }
}
  1. Add the path to projects/api/tsconfig-deps.json.

Branching model

The project follows the One Flow branching model with a single long-lived branch: develop.

# Create a feature branch
git checkout -b feat/TICKET-ID-small-description develop

# Keep up to date
git fetch && git rebase origin/develop

Feature branches are merged into develop through pull requests with approvals.

Commit specification

This project follows Conventional Commits:

feat(front-app eslint)[#Jira ID]: allow provided config object to extend other configs
docs(front-app): correct spelling of CHANGELOG
fix(wallet): prevent racing of requests

GitHub Actions

Remove workflow runs

brew install parallel gh
gh auth login
export GH_PAGER=false

WORKFLOW_NAME=<workflow-file-name.yml>
LIMIT=20

gh run list --json databaseId -q '.[].databaseId' -w $WORKFLOW_NAME -L $LIMIT |
  parallel 'gh api "repos/brickssas/monorepo/actions/runs/{}" -X DELETE; echo {} deleted'