Metadata-Version: 2.4
Name: keeps-learn-nexus-proto
Version: 0.40.0
Summary: Shared Protocol Buffer definitions for Nexus microservices
Author-email: Keeps <tecnologia@keeps.com.br>
License: MIT
Project-URL: Homepage, https://github.com/Keeps-Learn/nexus-proto
Project-URL: Repository, https://github.com/Keeps-Learn/nexus-proto.git
Project-URL: Issues, https://github.com/Keeps-Learn/nexus-proto/issues
Keywords: grpc,protobuf,proto,microservices
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Communications
Requires-Python: >=3.7
Description-Content-Type: text/markdown
Requires-Dist: protobuf>=6.31.1
Requires-Dist: grpcio>=1.80.0

# Nexus Proto

Shared Protocol Buffer definitions for Nexus microservices.

## Why "Nexus"?

The name **Nexus** was chosen to represent the **central connection** between microservices. In many languages, "nexus" refers to a point of intersection or link, which is exactly what this project provides: an efficient hub for communication between distributed services built in different technologies. The idea is to create a convergence point that makes it easier to integrate systems, ensuring consistent and scalable communication, no matter the language or framework used. **Nexus** is the solution that connects and unites services in a simple and effective way.

## Features

- **Centralized Protocol Definitions**: All communication contracts are defined in a shared repository of `.proto` files.
- **Pre-Generated Python Stubs**: Python stubs (`*_pb2.py` and `*_pb2_grpc.py`) are automatically generated and included in the package, eliminating the need for consumers to generate them.
- **Multi-Language Support**: Easily integrate microservices written in different programming languages (e.g., Python, Node.js, Java, etc.).
- **Scalable Communication**: Easily extend the system as new microservices are added to the architecture.
- **gRPC-powered**: Leveraging gRPC for high-performance communication with built-in support for multiple programming languages.
- **Industry Standard**: Follows best practices from projects like `googleapis-common-protos`, ensuring consistency and reliability.

## Installation

### Node.js / npm

```bash
npm install @keeps-learn/nexus-proto
```

📦 **npm Package**: https://www.npmjs.com/package/@keeps-learn/nexus-proto

### Python / pip

```bash
pip install keeps-learn-nexus-proto
```

📦 **PyPI Package**: https://pypi.org/project/keeps-learn-nexus-proto/

## Quick Start - Python

### Using Pre-Generated Stubs (Recommended)

```python
# Import stubs directly - no compilation needed!
from nexus_proto.generated.myaccount import users_pb2, users_pb2_grpc
from nexus_proto.generated.konquest import mission_pb2, mission_pb2_grpc
from nexus_proto.generated.billing import billing_pb2, billing_pb2_grpc

# Use message types
user = users_pb2.User(id="123", name="John Doe")

# Use service stubs with gRPC
import grpc
channel = grpc.aio.secure_channel('localhost:50051', grpc.ssl_channel_credentials())
stub = users_pb2_grpc.UserServiceStub(channel)
```

See [USAGE.md](./USAGE.md) for more detailed examples and options.

## Services

| Proto | Package | Service | Server |
|---|---|---|---|
| `kontent/survey.proto` | `kontent_survey` | `SurveyService` (independent surveys), `SurveyTemplateService` (survey templates) | keeps-kontent-server |
| `kontent/learn_content.proto` | `kontent_learn_content` | `LearnContentService` (learn contents: read, copy, duration, analyzed check) | keeps-kontent-server |

See [USAGE.md](./USAGE.md#kontent-surveyservice) for the Kontent survey contract (error mapping included).

## Publishing

Bump the version in `pyproject.toml`, `package.json` and `nexus_proto/__init__.py` in your PR (the PR
check requires it when protos change). When the PR is merged, the `Release` workflow publishes the new
version to **pypi.org** and **npmjs.com**, then creates the `vX.Y.Z` tag and GitHub release.

See [PUBLISH.md](./PUBLISH.md) for detailed publishing instructions.
