Skip to content
ContractSpec
Start here

Package manual · examples

·Examples and implementation patterns

example.minimal

Minimal reference project demonstrating a complete ContractSpec workflow.

examplesexamplev4.0.4stableservernode
@lssm-tech/example.minimal
bun add @lssm-tech/example.minimal
Package source ↗Manifest ↗

Manifest declarations describe the current workspace; they do not verify registry publication or runtime execution.

Package guide

Minimal ContractSpec example showing the simplest possible contract definition and build.

What This Demonstrates

  • Bare-minimum contract definition (user contract).
  • contractspec build and contractspec validate CLI usage.
  • Maintained example package included in the ContractSpec example registry.
  • src/contracts/ contains contract specs, operations, entities, and registry exports.
  • src/docs/ contains docblocks and documentation-facing exports.
  • src/handlers/ contains handlers or demo adapters wired to contract surfaces.

Running Locally

From examples/minimal:

  • bun run build
  • bun run test
  • bun run typecheck
  • bun run smoke
  • bun run preflight

Usage

Use @lssm-tech/example.minimal as a reference implementation, or import its exported surfaces into a workspace that composes ContractSpec examples and bundles.

Architecture

  • src/contracts/ contains contract specs, operations, entities, and registry exports.
  • src/docs/ contains docblocks and documentation-facing exports.
  • src/example.ts is the runnable example entrypoint.
  • src/handlers/ contains handlers or demo adapters wired to contract surfaces.
  • src/index.ts is the root public barrel and package entrypoint.
  • src/minimal.feature.ts defines a feature entrypoint.

Public Entry Points

  • Export . resolves through ./src/index.ts.
  • Export ./docs resolves through ./src/docs/index.ts.
  • Export ./docs/minimal.docblock is an alias of ./docs and resolves through ./src/docs/index.ts.
  • Export ./example resolves through ./src/example.ts.
  • Export ./minimal.feature resolves through ./src/minimal.feature.ts.
  • Export ./contracts/user resolves through ./src/contracts/user.ts.

Local Commands

  • bun run build — bun ../../packages/apps/cli-contractspec/src/cli.ts build src/contracts/user.ts
  • bun run validate — bun ../../packages/apps/cli-contractspec/src/cli.ts validate src/contracts/user.ts
  • bun run typecheck — tsgo --noEmit
  • bun run test — bun test
  • bun run smoke — bun test src/example.smoke.test.ts
  • bun run preflight — bun run build && bun run typecheck && bun run test && bun run validate && bun run smoke

Recent Updates

  • Replace eslint+prettier by biomejs to optimize speed.
  • Stability.
  • Missing contract layers.

Notes

  • Works alongside @lssm-tech/lib.contracts-spec, @lssm-tech/lib.schema.

Relationships

THIS PACKAGEexample.minimal6 import paths

Arrows point from a package to its direct dependency. Counts are derived from captured workspace manifests.

2 declarations

Declared capabilities

This manifest does not declare a capability catalogue. Use the guide, import map and source to assess the package.

Scripts

  • buildbun x --bun tsc --project tsconfig.json
  • scaffoldbun ../../packages/apps/cli-contractspec/src/cli.ts build src/contracts/user.ts
  • validatebun ../../packages/apps/cli-contractspec/src/cli.ts validate src/contracts/user.ts
  • typechecktsgo --noEmit
  • testbun test
  • smokebun test src/example.smoke.test.ts
  • preflightbun run build && bun run typecheck && bun run test && bun run validate && bun run smoke