> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mercurjs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Add a feature with a block

> Install the reviews block end-to-end and see it live across the admin, vendor, and storefront surfaces.

Blocks are complete features — backend module, workflows, API routes, and panel UI — installed as **source code** into your project. This tutorial installs the `reviews` block and follows it across every surface it touches.

<Info>
  **Blocks are copied, not installed as dependencies.** `add` writes the block's source files into your project via the aliases in `blocks.json` — you own and can edit every file afterwards. Updates are opt-in through `diff` and `add --overwrite`. When you outgrow the catalog, [build your own block](/rc/resources/tutorials/build-a-block).
</Info>

## Goal

Install reviews as a block and see it running everywhere it appears.

## Install the block

<Steps>
  <Step title="Discover the block">
    Search the registry and inspect what the block ships before installing:

    ```bash theme={null}
    bunx @mercurjs/cli@rc search --query reviews
    bunx @mercurjs/cli@rc view reviews
    ```

    `view` lists the block's files by target (API, admin, vendor) and its dependencies.
  </Step>

  <Step title="Install it">
    ```bash theme={null}
    bunx @mercurjs/cli@rc add reviews
    ```

    The CLI copies the source into the directories mapped by your `blocks.json` aliases and prints the block's post-install instructions — module registration, middlewares, migrations.
  </Step>

  <Step title="Run migrations and codegen">
    The block introduced a reviews module, so generate and run its migrations, then refresh the typed route map:

    ```bash theme={null}
    cd packages/api
    bunx medusa db:generate reviews
    bunx medusa db:migrate
    bunx @mercurjs/cli@rc codegen
    ```
  </Step>

  <Step title="See it live">
    Start the project — reviews now appear in the admin panel (moderation), the vendor portal (per-seller reviews), and the Store API (customer-facing review routes).
  </Step>
</Steps>

## Verify

1. The block's files exist in your repo under the alias-mapped paths.
2. Migrations ran cleanly and the API boots.
3. The admin and vendor panels show their reviews pages; the store review endpoints respond.
4. `bunx @mercurjs/cli@rc diff reviews` reports no drift from the registry.

## FAQ

<AccordionGroup>
  <Accordion title="What if I've already modified files the block wants to write?">
    The CLI asks before overwriting existing files (or force it with `--overwrite`). If you've customized a page the block also ships, merge by hand — you're merging source, not resolving package versions.
  </Accordion>

  <Accordion title="How do I update a block later?">
    `bunx @mercurjs/cli@rc diff reviews` shows what changed in the registry since you installed. Take updates with `add reviews --overwrite`, re-applying any local edits afterwards.
  </Accordion>
</AccordionGroup>

## Next steps

<CardGroup cols={2}>
  <Card title="Add a custom panel page" href="/rc/resources/tutorials/custom-panel-page" />

  <Card title="Build your own block" href="/rc/resources/tutorials/build-a-block" />
</CardGroup>
