Installing blocks
What’s inside a block
A block can contain any combination of:| Type | What it is | Example |
|---|---|---|
| Modules | Data models and business logic | Review model, wishlist service |
| Workflows | Multi-step business processes | Create review, export products |
| API Routes | HTTP endpoints | GET /store/reviews, POST /vendor/products/import |
| Links | Relationships between modules | Product-review link, customer-wishlist link |
| Vendor extensions | Vendor portal pages and components | Reviews list page, import drawer |
| Admin extensions | Admin panel pages and components | Reviews moderation page |
reviews block includes a module (data model + service), workflows (create/update/delete), API routes (store, vendor, admin), links (product-review, seller-review), and UI pages for both the vendor portal and admin panel.
Block structure
Blocks follow a consistent directory convention:blocks.json:
blocks.json
Post-installation
After adding a block, the CLI shows setup instructions. Typically you need to:- Register the module in
medusa-config.ts - Add middlewares to your
api/middlewares.ts - Run migrations with
bunx medusa db:generateandbunx medusa db:migrate - Regenerate types with
bunx @mercurjs/cli@latest codegen