@togatherlabs/shared-protos

v2.1.93

Published

Generated TypeScript gRPC definitions for Togather shared protos

Readme

ToGather Shared Protos

This repository contains the common .proto definitions used across all ToGather microservices.

It serves as the single source of truth for shared gRPC and ConnectRPC message schemas, ensuring consistency and type safety between backend services and clients.

Overview

The ToGather Shared Protos package centralizes all protocol buffer (.proto) files.

Each microservice can import the generated TypeScript or Python code directly from this package to avoid duplication and version drift.

Installation

pnpm add @togatherlabs/shared-protos

Usage

Import the generated types in your service:

import { AdminService } from "@togatherlabs/shared-protos/authservice/admin/v1";
import { UserService } from "@togatherlabs/shared-protos/userservice/user/v1";

Development Workflow

For detailed workflow instructions, see WORKFLOW.md

Quick Start

  1. Update proto definitions in the proto/ folder
  2. Generate TypeScript files:
    pnpm build
  3. Commit your changes:
    git add .
    pnpm commit
  4. Publish to npm:
    pnpm run publish

Important Notes

  • Use pnpm run publish to publish (not pnpm publish directly)
  • The script automatically bumps the version and publishes
  • No need to manually run npm version patch

Updating Dependencies

After a new version is published, update in dependent services:

pnpm update @togatherlabs/shared-protos

Technology Stack

  • Buf – Proto management and linting
  • ConnectRPC – RPC code generation
  • TypeScript – Generated bindings
  • pnpm – Package management
  • Commitizen – Commit message consistency

Best Practices

  • Always update .proto files before generating new code
  • Use pnpm for all dependency management
  • Do not manually modify generated files – regenerate instead
  • Ensure consistent naming and versioning for services (see Best Practices)

Project Structure

togather-shared-protos/
├── proto/                    # Proto definitions
│   ├── authservice/
│   └── userservice/
├── packages/
│   └── typescript/          # Generated TypeScript package (published to npm)
│       ├── dist/            # Compiled JavaScript
│       └── package.json     # Version gets bumped here
├── scripts/
│   ├── generate_and_prepare.js  # Generates TypeScript code
│   └── publish_typescript.js    # Publishes to npm
└── package.json             # Root package (NOT published)

What Gets Published

Only the TypeScript package (packages/typescript/) gets published to npm as @togatherlabs/shared-protos.

The root package is NOT published to npm.

Contributing

All services depending on this package should use the same version to ensure consistent proto definitions.


Made with ❤️ by the ToGather Team