# npm-factory

> Scaffold production-ready TypeScript npm package monorepos in seconds.

Source: https://npm-factory.n.yatsyk.com/docs

# npm-factory

Scaffolds a complete TypeScript monorepo with publishable ESM packages, a Fumadocs documentation site, and build tooling — all driven by a single config file (DOT).

## Quick start

```bash
mkdir my-project && cd my-project && git init
npx @npm-factory/init
```

The interactive wizard walks you through:

1. **Project id** — kebab-case name (e.g. `acme-sdk`). Used for folder names and site title.
2. **Scope** — npm scope for generated packages (e.g. `@acme`).
3. **Modules** — one or more packages to generate. Each module has an id (`core`, `react`, etc.), kind, platforms, and stability.
4. **Playgrounds** — none, one shared, or one per module.

After confirming, it creates the full monorepo structure and you're ready to go.

## Non-interactive mode

```bash
npx @npm-factory/init \
  --project acme-sdk \
  --scope @acme \
  --modules core,react \
  --playground single
```

| Flag           | Required | Description                       |
| -------------- | -------- | --------------------------------- |
| `--project`    | yes      | Project id (kebab-case)           |
| `--scope`      | yes      | npm scope (e.g. `@acme`)          |
| `--modules`    | yes      | Comma-separated module ids        |
| `--playground` | yes      | `none`, `single`, or `per-module` |

## What gets generated

```
my-project/
├── packages/<project>-config/   # DOT config + Zod schema
├── packages/<scope>-<module>/   # one per module (ESM, tsdown, TypeScript)
├── apps/<project>-site/         # Fumadocs documentation site (Next.js)
├── apps/<project>-playground/   # optional playground app
├── scripts/                     # dot-validate, docs-sync, pack-smoke, etc.
├── turbo.json
├── pnpm-workspace.yaml
└── .changeset/
```

## After scaffolding

```bash
pnpm install
pnpm build        # builds all packages + site
pnpm dev          # starts site + playground in parallel
```

Edit your DOT config at `packages/<project>-config/src/dot.ts` to add modules, change metadata, or configure docs. Re-running `npx @npm-factory/init` is safe — it skips existing files and patches root config.

## Modules

* [Init](./init) — the CLI scaffolder
* [Docs Preset](./docs-preset) — Fumadocs components and nav helpers
