# Start a packages-only workspace

Create a shared toolkit without applications and choose which libraries are distributable.


A Megamono repository does not need an application. Start with packages when the repository's product is a toolkit, SDK, or reusable library, and add apps later if you need a demo or documentation site.

## Plan the workspace

Use npm to run the workspace-creation CLI:

```sh
npx create-megamono toolkit --apps= --packages=core,client --package-scope=acme --package-access=restricted --database-adapter=none --package-manager=npm --interactive=false --dry-run
```

The empty `--apps=` explicitly selects no applications. The named packages go under `packages/`; no database is needed for this example. Review the plan, then repeat without `--dry-run`. For a local Yalc publication, add `--local-packages=yalc` and follow [local package development](/docs/workflows/local-packages).

In the interactive flow, finish the application picker without adding an app. The next step offers published-package setup, suggested by default when no apps are selected. This prepares packages; it does not publish them.

## Separate internal and distributable code

Inside the new workspace, preview an internal library:

```sh
megamono add library formatting --platform=neutral --dry-run
```

After review, repeat with `--yes` instead of `--dry-run`. Internal libraries default to `libs/` and remain private. Choose `web`, `node`, `mobile`, or `worker` when the library has a platform boundary; `neutral` is portable TypeScript, not proof that every dependency is portable.

To add another distributable package:

```sh
megamono add library adapters --scope=acme --publishable --access=restricted --dry-run
```

Publishable libraries are buildable and default to `packages/`. Restricted access is the default; select `--access=public` only when that is your intended distribution policy. A compatible workspace-local `@nx/js` is required. These libraries start without a test runner; add relevant tests.

`private: true` means **do not publish**, not **publish privately**. Private-registry distribution still needs package exports, published files, registry routing, access controls, and credentials outside source control.

## Control installation

For `megamono add library`, `--skipInstall` writes declarations but skips deferred installation callbacks. Afterwards run your workspace's normal install command with its established store and configuration. This option does not bypass earlier environment checks or choose a new package-manager store.

## Build and qualify before release

```sh
npm exec -- nx show projects
npm exec -- nx show project <package-project>
npm exec -- nx run <package-project>:build
```

Replace `<package-project>` with the resolved Nx name. Follow the generated README for the build-output location. Inspect exports, declarations, runtime dependencies, and archive contents, then test the packed package from a clean consumer without root-workspace hoisting.

Creating a publishable library does not enroll it in release groups, replace CI, or configure registry credentials. Review those separately. Yalc supports development; deployment and release need a reproducible artifact source available to their own environments.

See [library options](/docs/generators/library) and [repository structure](/docs/workflows/repository-structure). Moving an existing library between `libs/` and `packages/` remains a reviewed migration, not an automatic conversion.
