decor-castle-protos
v0.1.0
Published
Protocol Buffer definitions for the Decor Castle application
Maintainers
Readme
Decor Castle Protocol Buffers
This repository contains the Protocol Buffer definitions for the Decor Castle application. These definitions serve as the single source of truth for data structures shared between the frontend and backend.
Structure
stock.proto: Definitions for stock-related data structures
Usage
For Frontend (TypeScript)
- Install the required packages:
npm install --save-dev ts-proto protobufjs- Generate TypeScript types:
protoc --plugin=./node_modules/.bin/protoc-gen-ts_proto --ts_proto_out=./src/types/ ./stock.protoFor Backend (Python)
- Install the required packages:
pip install protobuf- Generate Python classes:
protoc --python_out=./schemas/ ./stock.protoBenefits
- Type Safety: Strong typing across frontend and backend
- Validation: Automatic validation of data structures
- Documentation: Self-documenting data structures
- Versioning: Explicit versioning of data structures
- Performance: Efficient binary serialization (when needed)
Updating Protos
When updating protocol buffer definitions:
- Update the
.protofiles in this repository - Regenerate the TypeScript and Python code
- Update the version number if there are breaking changes
- Commit and push changes
- Update dependencies in both frontend and backend projects
