TBBN.Merchant Platform docs
Architecturedocs/architecture/service-catalog.md

Service Catalog

Single source of truth for every folder's purpose, dependencies, phase, and status. Keep this in sync when a STUB graduates to WORKING (update the row here in the same PR).

apps/

All six apps have their full page inventory built and visually designed per docs/design/design-system.md. merchant-dashboard, Landing-page, and ops-console are wired to real backend APIs via @tbbn/sdk-js (browser-side, imported from the /client subpath — see each app's lib/tbbn.ts) and, where relevant, @tbbn/sdk-next (server components) — no more hand-authored placeholder data. Every fetch that can fail (no live backend, expired session, etc.) degrades gracefully to an inline error message rather than a stuck loading state or a crash. docs-site and status-page remain static/content-only by design — see their own rows below.

FolderPurposeDepends onPhaseStatus
docs-sitedeveloper.tbbnetwork.com (Phase 33) — splits into /merchant/docs (Overview, Getting started, 21 guides, full non-Space API reference, SDKs, Changelog — all rendered live) and /space/docs (Space API guide, Getting started, the Space-tagged API reference: global search, API keys, headless booking)packages/openapi-spec14WORKING (content is live/sourced, not hand-duplicated)
merchant-dashboarddashboard.tbbnetwork.com — a marketing home at / (Phase 39, the merchant/developer platform's own pitch), OTP login (unchanged — a legitimate merchant-rep principal, verified not a sign-in-rule violation), Overview (analytics/billing, moved to /dashboard), Sellers, API Keys (create/revoke), Webhooks (create/disable), Billing (live usage), Team (invite), Sandbox (provision)auth-service, merchant-service, analytics-service, billing-service, webhook-service, seller-identity-service, sandbox-service18WORKING (real API calls, no placeholder data)
Landing-pagetbbnetwork.com root domain (Phase 29, renamed from exchange-web in Phase 37) — a landing page (a 2-slide hero carousel, Trade then Space, no text between the nav and it — Phase 38) into /marketplace (full browse directory search/category/sort), plus listing detail, sign up/sign in (only ever here — see item 23), individual listing creation, inbox (accept/reject), trade detail, account. Folded-in marketing sections (audience split, TBBN Space explainer + a single-row, no-filter SpaceListingsTeaser, safety tips) live on the home page below the "Top trading items" teaser. Phase 36 (item 29) added real /how-it-works, /solutions, /pricing, /company routes (migrated from the now-deleted marketing-site, restyled to this app's own local design system).directory-service, auth-service, listing-service, offer-service, trade-session-service, reputation-service, space-service20WORKING (real API calls; browse/detail fall back to demo data only if the API is unreachable)
ops-consoleadmin.tbbnetwork.com (Phase 39) — real TBBN_OPS staff login (email OTP, StaffRole-gated), Overview, Merchant approvals, Business verification (/businesses, Phase 34), Moderation queue, Fraud review, Feature flags. Every ops-only backend route is now guarded by OpsRolesGuard/@OpsRoles(...) — see docs/security/rbac-strategy.md.auth-service, merchant-service, business-service, moderation-service, fraud-service, feature-service, space-service19WORKING (real API calls, real staff auth)
status-pagestatus.tbbnetwork.com — live service list (hand-maintained until status-service exists)14DESIGNED (static, matches actual Phase 0-3 status)
business-dashboardbusiness.tbbnetwork.com — a marketing home at / (Phase 39), private management dashboard (moved to /dashboard) for Business/Branch/Merchant-link CRUD; not a public profile site. No login of its own as of Phase 39 (previously a duplicate local registration/login wrongly calling the same marketplace-member endpoints Landing-page uses — a real sign-in-rule violation, fixed via the same cross-subdomain cookie pattern as account-dashboard/space-dashboard; see item 32).auth-service, business-service22WORKING (real API calls, no placeholder data)
space-dashboardspace.tbbnetwork.com — a Space-only marketing home (/, Phase 38 — no barter/trade wording, a hero carousel plus a single-row Spaces teaser) with a /get-started resolver routing a visitor to tbbnetwork.com login, business setup, a Space-enabling Branch page, the existing Space-onboarding form, or their own dashboard (moved to /dashboard, Phase 38), whichever actually applies; the host portal itself (/dashboard): per-Branch Space roster + payout onboarding, per-Space profile/pricing/bookings including category/checkInMethod (Phase 34/36 — a Branch lists multiple Spaces, each independently bookable); plus public global /listings (renamed from /browse in Phase 36 — Space-grained, visibility-aware search/book with a category filter, deep-linkable via query params, no account required), /pay/:bookingId (hosted payment link, session- or token-authorized, Phase 32/34), and /consent/:bookingId (hosted headless-booking consent link, Phase 34). No login of its own as of Phase 38 (previously a duplicate local login — fixed to use the same cross-subdomain cookie pattern as account-dashboard; see item 31).auth-service, business-service, space-service23WORKING (real API calls, no placeholder data)
account-dashboardaccount.tbbnetwork.com (Phase 29) — payments, subscription management, the OAuth account-linking consent screen (/link/authorize, Phase 28), Space API key/config management (/space-api-keys, Phase 32, config gains consentMode in Phase 34), and Business team/role management (/team, Phase 34). No login of its own — reads a cross-subdomain httpOnly cookie Landing-page sets; see item 23.auth-service, business-service, billing-service, seller-identity-service, space-service29WORKING (real API calls, no placeholder data)

services/

FolderPurposeDepends onPhaseStatus
api-gatewayRouting, rate limiting, auth validation, tenant isolationall Phase 0-3 services1WORKING
auth-serviceJWT/refresh/API-keys/OTP; email OTP/magic-link real via AWS SES (SesNotificationAdapter, Phase 39) once SES_FROM_EMAIL is set — SMS OTP still logs, no SNS/SMS provider configureddb-schema, core-auth1WORKING
merchant-serviceMerchant org, onboarding, RBAC, API keys (folds in api-key-service/rbac-service logic)db-schema, auth-service2WORKING
seller-identity-serviceFederation, headless-Seller creation (Phase 27), OAuth account-linking handshake (Phase 28, replacing the original sequential email/phone OTP flow — see docs/business/conflict-resolution-log.md item 22)db-schema, auth-service, core-auth, core-identity3WORKING
event-serviceEvent bus abstraction (Redis dev transport)event-contracts1WORKING
audit-serviceAudit/security/compliance logsevent-service2WORKING
webhook-serviceMerchant webhook subscriptions, delivery, retry, DLQ; Phase 34 adds a Business-rooted counterpart (business-webhooks/) firing on Space booking events, sharing the same HMAC signing/retry kernel (delivery-kernel.ts)event-service2WORKING
listing-serviceListing CRUD, visibility, merchant syncdb-schema, event-service4WORKING
catalog-serviceCategory/subcategory/brand taxonomy reference data4WORKING
media-serviceListing image ingestion/validation; real AWS S3 (S3StorageAdapter, Phase 39) once S3_BUCKET_NAME is set — no resize/re-encode step yet, width/height stay nulllisting-service4WORKING (behind StoragePort)
directory-serviceRead-surface aggregator for the global directorylisting-service, search-service5WORKING
search-serviceOpenSearch-backed listing/seller searchlisting-service5WORKING (Postgres now, documented OpenSearch swap-in)
trade-engineTradeValue formula, settlement calc, currency normalizationlisting-service6WORKING
currency-serviceCurrency reference/normalization (display/estimation only)6WORKING
localization-serviceLanguages, phone formats, address formats reference data6WORKING
matching-engineTrade Compatibility Scorecore-matching, trade-engine7WORKING
recommendation-serviceRelated trades / suggestions, plus (Phase 39) POST /v1/recommendations/events behavior-event ingestion and GET /v1/recommendations/{listings,spaces}/for-visitor — cold-start-safe personalization for both the trade marketplace and Space listings, built from a first-party BehaviorEvent log, falling back to a plain recency feed with no view historymatching-engine, db-schema7WORKING
offer-serviceOffer create/accept/reject/cancel/expire/countermatching-engine, listing-service8WORKING
reservation-serviceItem-availability locking during a trade sessionlisting-service9WORKING
trade-session-serviceCanonical trade-session state machine (through RESERVED)offer-service, reservation-service9WORKING
checkout-serviceMerchant-checkout redirect orchestration, merchant adapters (drives RESERVED -> COMPLETED); folds in payment-status-servicetrade-session-service10WORKING
payment-status-serviceTracks merchant payment.completed/payment.failed webhookscheckout-service10MERGED into checkout-service
billing-serviceMerchant SaaS subscription + usage overage via Stripe Billing — the only TBBN-owned payment flow; TBBN does not currently charge an individual seller, see docs/business/conflict-resolution-log.md items 14 and 17db-schema, Stripe2WORKING (behind StripePort)
notification-serviceEmail/SMS/push/webhook/in-app dispatch; trade-lifecycle email real via AWS SES (SesGeneralNotificationAdapter, Phase 39) once SES_FROM_EMAIL is set — SMS/push still log, no provider configured for eitherevent-service11WORKING (behind GeneralNotificationPort)
fraud-serviceFraud signal scoringevent-service12WORKING (2 rules; see README for the attribution gap on the rest)
moderation-serviceListing-note PII/contact-info scanninglisting-service12WORKING (ops review surface — the scan itself runs in listing-service)
reputation-serviceSeller trust score, plus post-trade 1-5 star Reviews of Merchants/Space branches (Phase 24)trade-session-service, business-service, space-service12WORKING
analytics-serviceGMV, trade volume, match rate, completion rateall above13WORKING
feature-serviceFeature flags2WORKING
sandbox-serviceSandbox environment keys/fixtures for docs+dashboardauth-service14WORKING
business-serviceBusiness/Branch profiles, Business<->Merchant linking, Space-enablement flag; Phase 34 adds Business.verificationStatus (gates Space creation), BusinessUser/BusinessUserRole team management, and a Space-grained/visibility-aware nearbySpaces; Phase 39 adds real Google Maps Geocoding (GoogleGeoAdapter) — a new Branch's address is geocoded to lat/lng automatically once GOOGLE_MAPS_SERVER_API_KEY is set and the client didn't already supply coordinatesdb-schema, auth-service, core-space22WORKING
space-serviceTBBN Space — Space (the bookable room within a Branch, Phase 34) CRUD, pricing/bookings (Space-rooted since Phase 34), Stripe Connect payout/commission (Branch-rooted); TradeSession wired via TradeSpaceProposal (Phase 31); global visibility-aware Space search + Business-rooted API keys/config (consentMode, Phase 34) + headless booking with optional consent step (Phase 32/34, "calendly for space" — see docs/business/conflict-resolution-log.md items 26/28)db-schema, business-service, core-auth, core-geo, core-space23WORKING

packages/

FolderPurposePhaseStatus
typesShared TS domain types/enums0WORKING
utilsUUIDv7, currency math, date/tz helpers0WORKING
configZod-validated env config loader0WORKING
openapi-specOpenAPI 3.1 source of truth0WORKING (Phase 0-13 resources)
db-schemaPrisma schema, migrations, seed0WORKING
event-contractsTyped event names/payloads0WORKING (Phase 0-3 events)
core-authShared auth client/RBAC guards, API-key/OAuth-client/Space-API-key credential generation1WORKING
uiShared React component library — design tokens, Tailwind preset, chrome primitives (SiteNav, SiteFooter, Container, Button, Badge, SectionHeading, Wordmark)14WORKING (consumed independently by all six apps/*; Landing-page additionally pins its own local design brief on top — see that app's own docs)
core-listingsShared listing domain logic (validation, PII moderation, computeTradeValue)4WORKING
core-offersShared offer/trade-session domain logic9STUB (offer/trade-session logic ended up needed by exactly one service each, offer-service/trade-session-service — no second consumer to justify extracting yet; revisit if that changes)
core-checkoutShared checkout orchestration domain logic10STUB (same reasoning as core-offers — logic lives directly in checkout-service)
core-searchShared OpenSearch query builders5STUB (search-service is Postgres-backed for now, see its README)
core-matchingTrade Compatibility Score calculator (pure function)7WORKING
core-notificationsNotification templating/dispatch interfaces11STUB
core-identityHeadless-Seller tier-gate validation (validateHeadlessSellerCreation) — shared by seller-identity-service and sandbox-service (Phase 27)27WORKING
core-geoHaversine great-circle distance (distanceMiles, boundingBoxDegrees) — backs business-service's 200-mile nearby-Space search (Phase 31) and space-service's unbounded global search (Phase 32)31WORKING
core-spaceShared Space-visibility resolution (resolveSpaceViewer, visibleSpaceWhereClause) — implemented once, reused byte-for-byte by space-service's global search and business-service's nearbySpaces so a RESTRICTED_EMAIL Space can't leak through one path but not the other (Phase 34)34WORKING
sdk-jsVanilla JS client15WORKING (Phase 0-13 resources)
sdk-typescriptTyped TS client15WORKING (Phase 0-13 resources — full generics on Auth/Merchants/ApiKeys/Sellers/Listings/Offers/TradeSessions, passthrough on the rest; Phase 36 fixed a real gap — the space resource group and branches.nearbySpaces were missing from this facade entirely, silently blocking any @tbbn/sdk-next Server Component consumer from reaching Space endpoints)
sdk-reactReact hooks wrapper15WORKING
sdk-nextNext.js server/client helpers15WORKING
sdk-dotnet, sdk-python, sdk-php, sdk-flutter, sdk-ios, sdk-android, sdk-javaNon-JS language SDKs15WORKING (idiomatic source, all 27 resource groups, explicitly flagged untested — no toolchain for these 7 languages in this environment; two background-agent attempts at these hit a session usage limit mid-run, finished by hand afterward)
sdk-vue, sdk-rnVue/React Native SDKs15STUB (out of the explicit non-JS SDK scope this pass covered; sdk-rn in particular could likely just re-export sdk-react since RN uses the same React APIs — not done yet)
widget-coreShared base custom-element class + design tokens for every widget-*16WORKING
widget-trade-button, widget-offer-modal, widget-trade-inbox, widget-trade-card, widget-trade-directory, widget-trade-status, widget-checkout-redirectEmbeddable widgets (real Custom Elements + Shadow DOM, esbuild-bundled)16WORKING
plugin-shopifyShopify app skeleton17WORKING (real Remix app source — not run in this environment, needs a Shopify Merchant account)

infra/, tools/

FolderPurposeStatus
infra/dockerLocal dev infra containers (Postgres/Redis/OpenSearch/MinIO)WORKING
infra/terraformCloud IaCSTUB (empty scaffold, no provider chosen)
infra/env.env.example per service, env matrixWORKING
infra/scriptsDB create/migrate/seed/wait-for-itWORKING
tools/codegenOpenAPI → SDK codegenWORKING
tools/seedCross-service demo seed dataWORKING (Phase 0-3 tables)
tools/scriptsnew-service scaffolder, health-check-allWORKING

Note: infra/k8s does not exist in this repo, intentionally — see docs/phase-plan/phase-0-3-build-plan.md, no container orchestration until it's actually justified by scale.