> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nanoforge.eu/llms.txt
> Use this file to discover all available pages before exploring further.

# Workspace

> Generate a NanoForge workspace (monorepo root)

## Overview

The `workspace` schematic creates the root of a NanoForge monorepo: the `nanoforge.config.ts` workspace declaration, `package.json`, and TypeScript or JavaScript base config. A workspace holds one or more projects generated with the [`project`](https://docs.nanoforge.eu/docs/cli/schematics/project) schematic under `apps/`.

`@nanoforge-dev/cli`, `@nanoforge-dev/config` (using the engine version resolved from `@nanoforge-dev/core`) and (for TypeScript) `typescript` are pinned to the newest registry version published at least 48h ago at generation time, mirroring pnpm's own `minimumReleaseAge` supply-chain protection so a freshly (and potentially compromised) published release isn't picked up immediately. Non-nanoforge packages like `typescript` are pinned to a specific version rather than a range; `typescript` is also kept on its `6.x` line rather than jumping to the `7.x` native rewrite.

## Usage

```bash theme={null}
schematics @nanoforge-dev/schematics:workspace --name=my-game
```

## Options

| Option | Type | Default | Description |
| - | - | - | - |
| `name` | `string` | `nanoforge-workspace` | The name of the workspace (Used as the workspace folder name and package.json name field.) |
| `directory` | `string` | `name` | Destination directory for the generated files (Defaults to the workspace name when not provided.) |
| `language` | `"ts" \| "js"` | `ts` | Language to use for generated source files |
| `strict` | `boolean` | `true` | Enable strict mode (Enables strict mode in tsconfig.json for TypeScript, or strict JSDoc checking in compatible editors for JavaScript.) |
| `packageManager` | `"npm" \| "yarn" \| "pnpm" \| "bun"` | `npm` | Package manager to target (pnpm gets a pnpm-workspace.yaml and workspace:\* dependency ranges; npm, yarn and bun get a package.json 'workspaces' field and pinned ranges.) |
| `allowBuilds` | `string[]` | `[]` | Packages allowed to run install/build scripts, in addition to `bun` (`bun` is always included (@nanoforge-dev/cli depends on it and it has its own install script). Written to pnpm-workspace.yaml's allowBuilds map (pnpm), package.json's allowScripts (npm) or trustedDependencies (bun). Ignored for yarn.) |

## Generated structure

```
my-game/
├── package.json
├── tsconfig.json          # TypeScript only
├── tsconfig.spec.json     # TypeScript only
├── jsconfig.json          # JavaScript only
├── pnpm-workspace.yaml    # if packageManager: pnpm — allowBuilds map
├── nanoforge.config.ts    # (or .js)
├── .gitignore
├── README.md
└── apps/                  # generated with the `project` schematic
```

## Examples

**Minimal TypeScript workspace:**

```bash theme={null}
schematics @nanoforge-dev/schematics:workspace --name=my-game
```

**pnpm workspace:**

```bash theme={null}
schematics @nanoforge-dev/schematics:workspace \
  --name=my-game \
  --packageManager=pnpm
```

**pnpm workspace allowing an extra dependency's build scripts (bun is always allowed):**

```bash theme={null}
schematics @nanoforge-dev/schematics:workspace \
  --name=my-game \
  --packageManager=pnpm \
  --allowBuilds=esbuild
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.