Skip to main content

Local setup

Follow these steps after the prerequisites are in place:

  1. Clone the repository

    git clone https://github.com/open-mercato/open-mercato.git
    cd open-mercato
  2. Start Docker services

    docker compose up -d

    This starts PostgreSQL 15 with pgvector and Redis 7. The pgvector extension is automatically installed, enabling vector search features.

  3. Install workspace dependencies

    yarn install
  4. Bootstrap everything with one command

    yarn mercato init

    This script prepares module registries, generates/applies migrations, seeds default roles, provisions an admin user, and loads demo CRM data (companies, people, deals, activities, todos). Add --no-examples if you prefer to skip the demo content while keeping core identities, --stresstest (optionally with -n <count>) to preload thousands of synthetic contacts, companies, deals, activities, and notes, or combine --stresstest --lite for high-volume contacts without the heavier extras when you need raw throughput.

  5. Launch the app

    yarn dev

    Navigate to http://localhost:3000/backend and sign in with the credentials printed by yarn mercato init. If you plan to use the email-enabled onboarding flow, opt-in by setting the following environment variables in your .env (the toggle defaults to false):

    RESEND_API_KEY=your_resend_api_key
    APP_URL=http://localhost:3000
    EMAIL_FROM=no-reply@your-domain.com
    SELF_SERVICE_ONBOARDING_ENABLED=true
    ADMIN_EMAIL=ops@your-domain.com

    Vector search relies on OpenAI embeddings. Add the API key to .env to activate the command palette and Data Designer page:

    OPENAI_API_KEY=sk-your-key

    When the variable is omitted the UI keeps the feature visible but displays a reminder banner instead of search results.

    For a full catalogue of backend flags (including profiler, cache, and query index switches) see the System status variables reference—each entry links back to the admin System status page for quick adjustments.

Open Mercato admin home

💡 Need a clean slate? Run yarn mercato init --reinstall. It wipes module migrations and drops the database, so only use it when you intentionally want to reset everything. Prefer yarn mercato init --no-examples if you just want an empty CRM without resetting the database.

Docker Management​

Stop services:

docker compose down

View logs:

docker compose logs -f

Complete reset (deletes all data):

docker compose down -v
docker compose up -d
yarn mercato init

Verify pgvector installation:

docker exec mercato-postgres psql -U postgres -d open-mercato -c "SELECT extname, extversion FROM pg_extension WHERE extname = 'vector';"

For advanced/manual flows (custom migration control, selective seeding, etc.) see the CLI reference in the repository README. If you want to deploy the application together with the redis and postgresql you can run:

docker compose -f docker-compose.fullapp.yml up --build