1
Prerequisites
Before you begin, make sure your development environment meets the following requirements:
Figentra is designed to live inside a monorepo workspace. It works with both Turborepo and plain pnpm workspaces. If you already have a workspace, skip to the next step. If you are starting from scratch, the next step covers the minimal setup.
2
Create your workspace
Initialize a new monorepo workspace and configure pnpm to recognise your packages directory.Create a If you are using Turborepo, add a
pnpm-workspace.yaml file at the repository root to tell pnpm where your packages live:pnpm-workspace.yaml
turbo.json at the root as well:turbo.json
3
Add your first Figentra packages
Install the two core Figentra packages you will use in this guide. Run the following command from the root of your monorepo:The
-w flag installs the packages into the workspace root so every app and package in your monorepo can import them without repeating the install.Always pin all
@figentra/* packages to the same version. Mixing versions across packages in the same workspace can lead to subtle type mismatches at compile time.4
Define a contract
Contracts are the heart of Figentra — they are plain TypeScript interfaces that describe the shape of your data and service boundaries, enforced at the type level across your entire monorepo.Create a new file in your The
packages directory:packages/core/src/contracts/user.contract.ts
defineContract helper attaches metadata — a name and a semver string — to your interface so Figentra can surface meaningful diagnostics when contract versions drift between services.packages/core/src/services/user.service.ts
5
Handle errors
Figentra provides
@figentra/error for typed, structured errors that carry a machine-readable code alongside the human-readable message — making error handling consistent across every service boundary.packages/core/src/services/user.service.ts
FigentraError extends the native Error class, so it is fully compatible with any existing try/catch logic. The code field lets downstream callers branch on error type without parsing message strings.6
Run your tests
Figentra’s typed packages are compatible with any test runner. If you have A minimal test for the service you just wrote might look like this:
@figentra/testing installed, you get a pre-configured test environment with contract assertion helpers out of the box.packages/core/src/services/user.service.test.ts
You now have a working Figentra setup with a typed contract and structured error handling. Explore what to build next:
Architecture Overview
Understand how Figentra organises packages, enforces boundaries, and scales across large monorepos.
Packages Overview
Browse every first-party
@figentra/* package, its API surface, and recommended usage patterns.