Open MercatoDocsSearch docsAPI reference

Installation

Monorepo — Core Development

Clone the platform when you need to change framework code or test a contribution across packages. Use the instructions for the operating system that will run the development process.

Tip · Building your own app?

You do not need this repository. Use the Standalone App guide: npx create-mercato-app my-app gives you a project that pulls Open Mercato from npm and stays upgradeable.

macOS

Prerequisites

Install the following tools before continuing. Each step includes a verification command.

1. Git

macOS may already have Git via Xcode Command Line Tools. Check with git --version. If it is missing, install the CLT:

xcode-select --install

Or install Git via Homebrew (see next step).

2. Homebrew

If Homebrew is not already installed:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Follow the post-install instructions printed by the script to add Homebrew to your shell PATH.

3. Node.js 24

# Option A — Homebrew
brew install node@24
echo 'export PATH="/opt/homebrew/opt/node@24/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc

# Option B — nvm (manage multiple Node versions)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash
# Close and reopen your terminal, then:
nvm install 24
nvm use 24
nvm alias default 24

Verify: node --version → v24.x.x

4. Yarn 4.17.1

Corepack ships with Node.js. Enable it once per machine, then activate Yarn:

corepack enable
corepack prepare [email protected] --activate

Verify: yarn --version → 4.17.1

5. Docker Desktop

Download and install Docker Desktop for Mac. Start it after installation.

Verify:

docker --version
docker compose version

Infrastructure services

Docker Desktop runs PostgreSQL, Redis, and Meilisearch. Start them from the repository root after cloning (step below):

yarn infra:up

This starts:


Clone and configure

git clone https://github.com/open-mercato/open-mercato.git
cd open-mercato

Copy the environment template:

cp apps/mercato/.env.example apps/mercato/.env

Edit apps/mercato/.env and set at least these three variables:

DATABASE_URL=postgres://postgres:<url-encoded-password>@localhost:5432/open-mercato
JWT_SECRET="<jwt-secret>"
REDIS_URL=redis://localhost:6379

Generate a strong JWT_SECRET:

openssl rand -hex 32

Install dependencies and bootstrap

yarn install
yarn install-skills   # optional — only if you use an AI coding agent

yarn build:packages
yarn generate
yarn build:packages   # second run required — compiles generated scripts

yarn initialize

yarn initialize runs migrations, seeds roles, provisions an admin user, and loads demo CRM data. Add --no-examples to skip demo content. The admin credentials are printed at the end.

yarn install does not install agent skills – yarn install-skills is a separate, intentionally manual step that fetches the shared open-mercato/skills collection into the gitignored .agents/skills/ directory. Skip it if you do not use Codex, Claude Code, Cursor, or another supported coding agent; see Setup steps for the full explanation.


Start the app

yarn dev

Open http://localhost:3000/backend and sign in with the credentials printed by yarn initialize.

The compact runtime also serves a splash page at http://localhost:4000 with live startup progress. Press d while yarn dev is running to toggle raw log output.

On memory-constrained machines you can lower yarn dev's footprint by narrowing which workspace packages the watcher tracks with OM_WATCH_SCOPE (e.g. OM_WATCH_SCOPE=auto-optimized yarn dev). The active mode is printed with an emoji at startup. See Choosing which packages the watcher tracks for the full reference.


Upgrading an existing checkout

git pull
yarn install
yarn db:migrate
yarn generate
yarn dev

Linux

Prerequisites

1. Git

# Debian / Ubuntu
sudo apt update && sudo apt install -y git

# Fedora / RHEL
sudo dnf install -y git

Verify: git --version

2. Node.js 24

Use nvm to manage Node versions:

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash

Close and reopen your terminal, then:

nvm install 24
nvm use 24
nvm alias default 24

Verify: node --version → v24.x.x

3. Yarn 4.17.1

corepack enable
corepack prepare [email protected] --activate

Verify: yarn --version → 4.17.1

4. Docker

Option A – Docker Desktop for Linux (easiest, includes Compose): download here.

Option B – Docker Engine + Compose plugin:

# Debian / Ubuntu
sudo apt install -y docker.io docker-compose-v2
sudo usermod -aG docker $USER
newgrp docker   # or log out and back in

Verify:

docker --version
docker compose version

Infrastructure services

yarn infra:up

Starts PostgreSQL 17 (with pgvector), Redis 7, and Meilisearch.


Clone and configure

git clone https://github.com/open-mercato/open-mercato.git
cd open-mercato
cp apps/mercato/.env.example apps/mercato/.env

Edit apps/mercato/.env:

DATABASE_URL=postgres://postgres:<url-encoded-password>@localhost:5432/open-mercato
JWT_SECRET="<jwt-secret>"
REDIS_URL=redis://localhost:6379

Generate a strong JWT_SECRET:

openssl rand -hex 32

Install dependencies and bootstrap

yarn install
yarn install-skills   # optional — only if you use an AI coding agent

yarn build:packages
yarn generate
yarn build:packages

yarn initialize

yarn install does not install agent skills – yarn install-skills is a separate, intentionally manual step that fetches the shared open-mercato/skills collection into the gitignored .agents/skills/ directory. Skip it if you do not use an AI coding agent; see Setup steps for the full explanation.


Start the app

yarn dev

Open http://localhost:3000/backend and sign in with the credentials printed by yarn initialize.


Upgrading an existing checkout

git pull
yarn install
yarn db:migrate
yarn generate
yarn dev

Windows

Choose a Windows environment

From a checkout on Windows, open packages\starter\platform\start.cmd, or run npx @open-mercato/starter if Node.js is already installed. The starter checks the machine and offers the required setup steps. You can also use WSL2 with Ubuntu for a Linux toolchain or follow the native PowerShell prerequisites below. To run the full application in containers, use the Docker development setup.

Prerequisites

1. Git

Download the installer from git-scm.com/download/win. During setup choose "Git from the command line and also from 3rd-party software" when asked about PATH.

After installation, configure line endings to avoid CRLF issues in shell scripts:

git config --global core.autocrlf input

Verify: git --version

2. Node.js 24

Download the Windows Installer (.msi) for Node.js 24 from nodejs.org/en/download. Run the installer with default settings.

After installation, open a new PowerShell or Command Prompt window so the updated PATH takes effect.

Verify: node --version → v24.x.x

3. Yarn 4.17.1

corepack enable
corepack prepare [email protected] --activate

Warning · PowerShell execution policy error

If you see this error when running yarn:

yarn.ps1 cannot be loaded because running scripts is disabled on this system.

This is a Windows PowerShell execution policy restriction. Fix it with a one-time user-scoped change:

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

Then retry corepack prepare [email protected] --activate.

Alternative: use Git Bash or Command Prompt (cmd.exe) instead of PowerShell – the execution policy restriction does not apply in those shells. All subsequent yarn commands in this guide work identically in cmd.exe or Git Bash.

Verify: yarn --version → 4.17.1

4. Visual Studio 2022 Build Tools

Required for native Node.js add-ons. Open PowerShell as Administrator and run:

winget install Microsoft.VisualStudio.2022.BuildTools
winget install Microsoft.VCRedist.2015+.x64

If you prefer the graphical installer, make sure the "Desktop development with C++" workload is checked.

Infrastructure services

PostgreSQL is the most critical dependency – the app runs with a native PostgreSQL instance even without the rest of the Docker stack. Choose one option:

The official Windows installer from postgresql.org/download/windows bundles pgAdmin 4, a full-featured database GUI – no extra installation needed.

  1. Download and run the EDB installer. Note the port (default 5432) and the postgres superuser password you set.

  2. Open pgAdmin 4 from the Start menu to browse and manage your databases visually.

  3. Create the application database. In pgAdmin's Query Tool or PowerShell:

    psql -U postgres -c "CREATE DATABASE \"open-mercato\";"
    
  4. Set DATABASE_URL in apps\mercato\.env (after cloning):

    DATABASE_URL=postgres://postgres:<your-password>@localhost:5432/open-mercato
    

For Redis and Meilisearch, start only those two services via Docker (requires Docker Desktop):

docker compose --project-directory . -f starters/docker/compose.infra.yml up -d redis meilisearch

Most development features work without Meilisearch – you can skip it and add it later.

Option B – Docker Desktop (all infrastructure)

Install Docker Desktop for Windows with the WSL 2 backend enabled (Settings → General → "Use the WSL 2 based engine").

Start all infrastructure from the repository root:

yarn infra:up

Without a Defender exclusion, yarn install and file-watching can be significantly slower. Run once in an elevated PowerShell:

Start-Process powershell -Verb RunAs -ArgumentList "-NoProfile -ExecutionPolicy Bypass -Command `"Add-MpPreference -ExclusionPath '$((Get-Location).Path)'`""

Clone and configure

git clone https://github.com/open-mercato/open-mercato.git
cd open-mercato

Copy the environment template:

Copy-Item apps\mercato\.env.example apps\mercato\.env

Edit apps\mercato\.env and set at minimum:

DATABASE_URL=postgres://postgres:<password>@localhost:5432/open-mercato
JWT_SECRET="<jwt-secret>"
REDIS_URL=redis://localhost:6379

Install dependencies and bootstrap

yarn install
yarn install-skills   # optional — only if you use an AI coding agent

yarn build:packages
yarn generate
yarn build:packages

yarn initialize

yarn install does not install agent skills – yarn install-skills is a separate, intentionally manual step that fetches the shared open-mercato/skills collection into the gitignored .agents/skills/ directory. Skip it if you do not use an AI coding agent; see Setup steps for the full explanation.

Tip

yarn build:packages must run twice – once before yarn generate and once after – so the generated scripts are compiled before yarn initialize runs.

The admin credentials are printed at the end of yarn initialize.


Start the app

yarn dev

Open http://localhost:3000/backend and sign in with the credentials printed by yarn initialize.


Ephemeral environment (optional – requires Docker Desktop)

yarn dev:ephemeral spins up a throwaway database on a random free port and starts the app. Docker Desktop must be running:

yarn dev:ephemeral

Upgrading an existing checkout

git pull
yarn install
yarn db:migrate
yarn generate
yarn dev

Development runtime reference

CommandDescription
yarn devCompact runtime – splash at http://localhost:4000, app at http://localhost:3000/backend
yarn dev:verboseSame runtime with raw passthrough logs
yarn dev:greenfieldFull fresh boot: build → generate → reinstall → dev
yarn dev:ephemeralThrowaway database on a random port (requires Docker)
yarn dev:classicLegacy mode – disables splash, raw output

Press d while yarn dev is running to toggle raw log output. If a stage fails, the runner automatically expands and prints the raw error.

Run multiple persistent local instances against the same PostgreSQL server

yarn dev, yarn dev:greenfield, and yarn dev:app accept an optional --database-name[=<name>] flag that rewrites the database segment of DATABASE_URL in apps/mercato/.env. Without the flag, behavior is unchanged.

# explicit name; you'll be asked once whether to persist .env (default yes)
yarn dev:greenfield --database-name=pricing_v2

# bare flag derives the database name from the current working directory
yarn dev --database-name

# one-off review run that does not edit .env
yarn dev --database-name=review_1720 --no-update-env

The override only touches the pathname segment of DATABASE_URL, so credentials, host, port, schema (?schema=…), and other query parameters are preserved. CI / non-interactive runs default to updating .env; pass --no-update-env to opt out, or set OM_DEV_DATABASE_UPDATE_ENV=false.

Previous: Choose an installation path · Next: Prerequisites