Skip to main content

yarn init

The yarn init script wraps the Open Mercato CLI mercato init command and delivers a ready-to-run workspace. It installs dependencies, prepares generated module artifacts, applies database migrations, seeds baseline RBAC data, and populates demo CRM content (companies, people, deals, activities, todos) unless you disable it with --no-examples. Enable --stresstest to tack on a synthetic, high-volume dataset that includes additional companies, pipeline deals, activities, and notes — all wired with realistic custom field values and a live progress bar.

Usage

yarn init [--org=<name>] [--email=<address>] [--password=<value>] [--roles=<csv>] [--no-examples] [--stresstest] [--lite] [-n <count>] [--count=<count>] [--reinstall|-r]

Ensure DATABASE_URL points to the Postgres instance you want to initialize before running the command.

Options

OptionDescriptionDefault
--org, --orgNameName of the organization that will be created.Acme Corp
--emailSuperadmin login email. If the local part is superadmin, companion admin@… and employee@… accounts are also provisioned.superadmin@acme.com
--passwordPassword applied to all seeded accounts.secret
--rolesComma-separated list of roles ensured before user creation.superadmin,admin,employee
--no-examplesSkip demo CRM seeders (companies, people, deals, activities, todos). Alias: --no-exampls.off
--stresstestGenerate a high-volume synthetic CRM dataset (contacts, companies, deals, activities, notes) in addition to the curated examples.off
--liteWhen paired with --stresstest, skips deals, activities, notes, and custom fields for faster high-volume contact generation.off
-n, --count, --stress-count, --stresstest-countNumber of synthetic contacts to create when --stresstest is enabled.6000
--reinstall, -rDrops every table in the target database before bootstrapping. Requires a valid DATABASE_URL.off

What the Command Does

  1. Installs workspace dependencies with yarn install.
  2. Regenerates module registries and dependency-injection metadata via yarn modules:prepare.
  3. Applies all per-module migrations through yarn db:migrate.
  4. Seeds baseline roles (mercato auth seed-roles).
  5. Runs mercato auth setup to create the tenant, organization, and user accounts specified.
  6. If organization and tenant IDs are detected:
    • Seeds customer dictionaries (mercato customers seed-dictionaries).
    • Unless --no-examples is present, seeds demo CRM data (mercato customers seed-examples) and example Todos (mercato example seed-todos).
    • When --stresstest is present, seeds synthetic contacts, companies, deals, activities, and notes with custom fields (and a progress bar) via mercato customers seed-stresstest. Add --lite to focus on raw contacts without the heavier extras.
    • Enables default dashboard widgets (mercato dashboards seed-defaults).

On success, the command prints a boxed summary with created accounts and their passwords.

Reinstall Mode

When --reinstall is present the command:

  • Loads env variables via dotenv/config.
  • Connects to the configured database and drops all tables in the public schema using CASCADE.
  • Continues with a clean bootstrap and reseeds example data (unless you add --no-examples).

Use this mode for destructive resets in development. Never run it against production databases.

Troubleshooting

  • Missing DATABASE_URL — the command aborts before performing database work. Export the variable or place it in .env.
  • Dependency install fails — run yarn install manually to inspect the error, then re-run yarn init.
  • Migrations fail — confirm the database credentials and ensure the target user can create tables. The CLI stops on the first failure so you can address the issue before re-running.