@contractspec/example.marketplace
v3.8.25
Published
Marketplace example with orders, payouts, and reviews for ContractSpec
Downloads
1,061
Readme
@contractspec/example.marketplace
Website: https://contractspec.io
Marketplace example with orders, payouts, and reviews for ContractSpec.
What This Demonstrates
- Multi-entity domain modeling (order, payout, product, review, store).
- Per-entity schema/enum/event/operations/presentation pattern.
- Capability and feature definition patterns.
- React UI with hooks, renderers, and dashboard component.
- Contract-backed visualizations for order status, category value comparison, and recent order activity.
- Seeder pattern for demo data.
- Test-spec for operations validation.
Running Locally
From packages/examples/marketplace:
bun run devbun run buildbun run typecheck
Usage
Use @contractspec/example.marketplace as a reference implementation, or import its exported surfaces into a workspace that composes ContractSpec examples and bundles.
Architecture
src/docs/contains docblocks and documentation-facing exports.src/entities/contains domain entities and value objects.src/example.tsis the runnable example entrypoint.src/handlers/contains handlers or demo adapters wired to contract surfaces.src/index.tsis the root public barrel and package entrypoint.src/marketplace.capability.tsdefines a capability surface.src/marketplace.feature.tsdefines a feature entrypoint.
Public Entry Points
- Export
.resolves through./src/index.ts. - Export
./docsresolves through./src/docs/index.ts. - Export
./docs/marketplace.docblockresolves through./src/docs/marketplace.docblock.ts. - Export
./entitiesresolves through./src/entities/index.ts. - Export
./entities/orderresolves through./src/entities/order.ts. - Export
./entities/payoutresolves through./src/entities/payout.ts. - Export
./entities/productresolves through./src/entities/product.ts. - Export
./entities/reviewresolves through./src/entities/review.ts. - Export
./entities/storeresolves through./src/entities/store.ts. - Export
./exampleresolves through./src/example.ts. - The package publishes 52 total export subpaths; keep docs aligned with
package.json.
Local Commands
bun run dev— contractspec-bun-build devbun run build— bun run prebuild && bun run build:bundle && bun run build:typesbun run lint— bun lint:fixbun run lint:check— biome check .bun run lint:fix— biome check --write --unsafe --only=nursery/useSortedClasses . && biome check --write .bun run typecheck— tsc --noEmitbun run publish:pkg— bun publish --tolerate-republish --ignore-scripts --verbosebun run publish:pkg:canary— bun publish:pkg --tag canarybun run clean— rimraf dist .turbobun run build:bundle— contractspec-bun-build transpilebun run build:types— contractspec-bun-build typesbun run prebuild— contractspec-bun-build prebuild
Recent Updates
- Replace eslint+prettier by biomejs to optimize speed.
- Missing contract layers.
Notes
- Works alongside
@contractspec/lib.contracts-spec,@contractspec/lib.design-system,@contractspec/lib.example-shared-ui,@contractspec/lib.runtime-sandbox,@contractspec/lib.schema, ...
