Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.
Ruby b2b-commercee-commerceecommerceecommerce-apiecommerce-frameworkecommerce-platformheadlessheadless-commerceheadless-ecommercemarketplacemulti-tenantmulti-vendormulti-vendor-ecommerceopen-sourcespree-commerce
Deliver worktree mail to Mailpit, and point seller invitations at their panel
Damian Legawiecea51e8b5d277
diff --git a/CLAUDE.md b/CLAUDE.mdindex c7ec56f3e4..ad276664a9 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -123,7 +123,7 @@ wt remove # abandon instead of shippingAdmin login: `[email protected]` / `spree123`. Both dev scripts run in the foreground and stream logs; `server/log/development.log` has the Rails log if the server runs detached. Start servers only in worktrees you're actively looking at — rspec/vitest/tsc need no servers.-One-time machine setup: Homebrew `postgresql@18` running on :5432 (with a `postgres` superuser role), Ruby per `server/.ruby-version` (mise or rbenv), Node ≥ 24 with `npm i -g portless` (start the proxy once with `portless proxy start`, accepting sudo for :443), worktrunk, then `pnpm wt:template`.+One-time machine setup: Homebrew `postgresql@18` running on :5432 (with a `postgres` superuser role), `mailpit` (`brew services start mailpit` — one instance serves every worktree), Ruby per `server/.ruby-version` (mise or rbenv), Node ≥ 24 with `npm i -g portless` (start the proxy once with `portless proxy start`, accepting sudo for :443), worktrunk, then `pnpm wt:template`.| What changed | What to run (inside the worktree) ||---|---|@@ -133,6 +133,7 @@ One-time machine setup: Homebrew `postgresql@18` running on :5432 (with a `postg| Need sample data (products + images) | `cd server && bin/rails spree:load_sample_data` — per worktree, on demand; takes minutes and hits the network || Rails console / database | `cd server && bin/rails console`; the DB is `spree_dev_<branch>` on `localhost:5432` || E2E prerequisites | Once per worktree: `cd spree/api && bundle install && bundle exec rake test_app` (then `pnpm wt:e2e`) |+| Read an email the app sent | Mailpit catches everything: <http://localhost:8025>. `brew install mailpit && brew services start mailpit` if it is not running — without it the starter falls back to a delivery method that does not exist and every send raises || Meilisearch search provider | Optional: `brew install meilisearch`, run it, set `MEILISEARCH_URL` in `server/.env`, `bin/rails spree:search:reindex` || Hosted dashboard at `/dashboard` (single-node test) | `pnpm server:dashboard` to build `packages/dashboard-starter/dist`, set `SPREE_DASHBOARD_DIST_PATH=<monorepo>/packages/dashboard-starter/dist` in `server/.env` || Hosted seller panel at `/sellers` (single-node test) | `pnpm server:seller` to build `packages/seller-dashboard-starter/dist`, set `SPREE_SELLER_PANEL_DIST_PATH=<monorepo>/packages/seller-dashboard-starter/dist` in `server/.env` |diff --git a/scripts/worktree/lib.sh b/scripts/worktree/lib.shindex 9202ca5445..676dd90466 100755--- a/scripts/worktree/lib.sh+++ b/scripts/worktree/lib.sh@@ -107,3 +107,18 @@ require_portless() {exit 1}}++# Mailpit catches every email the dev server sends, the same way it does in the+# starter's Docker stack. One instance serves every worktree, like Postgres.+MAILPIT_HOST="${MAILPIT_HOST:-localhost}"+MAILPIT_SMTP_PORT="${MAILPIT_SMTP_PORT:-1025}"+MAILPIT_UI_PORT="${MAILPIT_UI_PORT:-8025}"+mailpit_url() { echo "http://localhost:$MAILPIT_UI_PORT"; }++# A warning rather than a hard failure: a worktree is still usable without it,+# and only the screens that send mail are affected.+warn_unless_mailpit() {+ port_free "$MAILPIT_SMTP_PORT" || return 0+ echo " ! Mailpit is not running — email will fail to deliver."+ echo " brew install mailpit && brew services start mailpit"+}diff --git a/scripts/worktree/setup.sh b/scripts/worktree/setup.shindex 9e5accc6e7..7d6fb1002a 100755--- a/scripts/worktree/setup.sh+++ b/scripts/worktree/setup.sh@@ -24,8 +24,11 @@ SECRET_KEY_BASE=$(openssl rand -hex 64)DATABASE_NAME=$(db_name)DATABASE_NAME_TEST=$(test_db_name)SPREE_DASHBOARD_URL=$(dashboard_url)+SPREE_SELLER_PANEL_URL=$(seller_url)RAILS_HOST=$(rails_host)RAILS_PROTOCOL=https+SMTP_HOST=$MAILPIT_HOST+SMTP_PORT=$MAILPIT_SMTP_PORTEOFfi@@ -47,6 +50,19 @@ if ! grep -q '^RAILS_PROTOCOL=' server/.env; thenprintf 'RAILS_PROTOCOL=%s\n' 'https' >> server/.envfi+# Mail goes to Mailpit, as it does in the starter's Docker stack. Without+# SMTP_HOST the starter falls back to a delivery method that does not exist,+# so every email raises rather than being delivered anywhere.+if ! grep -q '^SMTP_HOST=' server/.env; then+ printf 'SMTP_HOST=%s\nSMTP_PORT=%s\n' "$MAILPIT_HOST" "$MAILPIT_SMTP_PORT" >> server/.env+fi++# Backfill likewise: without it a seller's invitation links to the operator's+# dashboard, where accepting issues an admin session rather than a seller one.+if ! grep -q '^SPREE_SELLER_PANEL_URL=' server/.env; then+ printf 'SPREE_SELLER_PANEL_URL=%s\n' "$(seller_url)" >> server/.env+fi+require_current_starterif ! db_exists "$(db_name)"; then@@ -77,3 +93,6 @@ printf 'VITE_API_PROXY_TARGET=%s\n' "$(rails_url)" > packages/dashboard-starter/echo "✓ Worktree ready"echo " rails: $(rails_url) (pnpm wt:dev)"echo " dashboard: $(dashboard_url) (pnpm wt:dashboard)"+echo " seller: $(seller_url) (pnpm wt:seller)"+echo " mail: $(mailpit_url)"+warn_unless_mailpit