@loafmarkets/shared-types

v1.0.30

Published

Shared contracts for Loaf Markets frontend, backend, and matching engine.

Readme

Shared Types

Shared contracts (TypeScript interfaces + protobuf schemas) used by the Loaf Markets backend, frontend, and matching engine.

Repository layout

Shared-Types/
├── proto/             # trading.proto (matching engine contracts)
├── src/
│   └── index.ts       # TypeScript schemas and interfaces shared across services
├── dist/              # Build output (generated via `pnpm run build`)
├── package.json       # npm package settings
└── tsconfig.json

Getting started

# Install dependencies
pnpm install

# Build once to emit dist/
pnpm run build

Consuming the package

In any Loaf service repo:

pnpm add @loafmarkets/shared-types@<version>

Then import types from TypeScript:

import type { OrderApiRequestBody, propertySchema } from '@loafmarkets/shared-types';

To use the protobuf definition (for gRPC or codegen):

node_modules/@loafmarkets/shared-types/proto/trading.proto

Making changes

  1. Modify contracts in src/index.ts (TypeScript) or proto/trading.proto.
  2. Run tests/build locally:
    pnpm run build

Release process

Assuming you have not added, committed, pushed, tagged, published anything yet:

# Login to npm
pnpm login

# Ensure working tree is clean
git status

# Build artifacts
pnpm run build

# Add and commit
git commit -am "feat: add XYZ contract"

# Bump version (automatically creates new tag in package.json and commits)
pnpm version patch

# Push tag
git push origin main --follow-tags

# Publish to registry
pnpm publish --access public

Once published, update each consumer repository:

pnpm add @loafmarkets/shared-types@<version>
rm -rf node_modules 
pnpm install

Notes

  • Use Renovate/Dependabot later to automate dependency bump PRs in downstream repos.