# API

> Programmatic API for @npm-factory/init.

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

# API

The init package exports its core functions for programmatic use.

```ts
import { runInit, type InitConfig, type ResolvedConfig } from "@npm-factory/init";
```

## `runInit(config: InitConfig): Promise<ResolvedConfig>`

Runs the full scaffolding process. Creates all files, patches root configs.

## InitConfig

```ts
type InitConfig = {
  projectId: string;        // kebab-case project name
  scope: string;            // npm scope (e.g. "@my-org")
  modules: ModuleInput[];   // at least one module
  playgroundMode: "none" | "single" | "per-module";
  cwd: string;              // working directory
};
```

## ModuleInput

```ts
type ModuleInput = {
  moduleId: string;            // e.g. "core", "react"
  packageNameSuffix: string;   // appended to project name
  title: string;
  description: string;
  kind: "core" | "integration" | "plugin" | "sdk" | "cli";
  platforms: ModulePlatform[];
  stability: "experimental" | "beta" | "stable" | "deprecated";
};
```

See the [JSDoc reference](/docs/init/jsdoc) for the full API surface.
