Cromio Server
Project description
Cromio
Cross-platform JSON-RPC framework for microservice communication.
Cromio provides both a server and a client in multiple languages, so services written in different stacks can talk to each other using the same wire protocol. Currently supported:
Both implementations support:
- RPC and streaming triggers
- gzip-compressed JSON payloads
- Zod/Pydantic schema validation
- Built-in extensions: logger, Prometheus metrics, rate limiter, OpenTelemetry tracing
- Load balancing, retries, and timeouts on the client
- Mutual TLS (mTLS) between client and server
Installation
Python
pip install cromio
# or
pip install cromio[http2] # if you need HTTP/2 support
Node.js
npm install cromio
# or
yarn add cromio
Quick Start
Python Server
from cromio import Server
from pydantic import BaseModel
class GreetSchema(BaseModel):
name: str
server = Server(host="0.0.0.0", port=3000)
@server.on_trigger("greet", schema=GreetSchema)
def greet_handler(context):
return {"message": f"Hello, {context['body']['name']}!"}
server.start()(lambda url: print(f"Server listening on {url}"))
Python Client
from cromio import Client
client = Client(
servers=[{"url": "http://localhost:3000"}],
credentials={"secret_key": "my-secret"},
)
response = client.trigger("greet", {"name": "World"})
print(response["data"]) # {"message": "Hello, World!"}
Node.js Server
import { Server, Types } from "cromio";
import { z } from "zod";
const GreetSchema = z.object({
name: z.string(),
});
const server = new Server({
port: 3000,
host: "0.0.0.0",
});
server.schema(GreetSchema).onTrigger("greet", async (payload: Types.Server.OnTriggerType<z.infer<typeof GreetSchema>>) => {
return { message: `Hello, ${payload.body.name}!` };
});
server.start((url) => {
console.log(`Server listening on ${url}`);
});
Node.js Client
import { Client } from "cromio";
const client = new Client({
servers: [{ url: "http://localhost:3000" }],
credentials: { secretKey: "my-secret" },
});
const response = await client.trigger("greet", { name: "World" });
console.log(response.data); // { message: "Hello, World!" }
Mutual TLS (mTLS)
Both Python and Node.js clients/servers support mTLS by passing certificate buffers or file paths.
Python client with mTLS:
from cromio import Client
client = Client(
servers=[{
"url": "https://localhost:3443",
"tls": {
"ca": open("certs/ca.pem", "rb").read(),
"cert": open("certs/client-cert.pem", "rb").read(),
"key": open("certs/client-key.pem", "rb").read(),
},
}],
credentials={"secret_key": "my-secret"},
)
Node.js server with mTLS:
import { Server } from "cromio";
import fs from "fs";
const server = new Server({
port: 3443,
tls: {
key: fs.readFileSync("certs/server-key.pem"),
cert: fs.readFileSync("certs/server-cert.pem"),
ca: fs.readFileSync("certs/ca.pem"),
requestCert: true,
rejectUnauthorized: true,
},
});
Documentation
| Document | Description |
|---|---|
| 01-overview.md | Project overview, goals, and status |
| 02-architecture.md | System architecture and key concepts |
| 03-nodejs.md | Node.js package (Server, Client, Extensions) |
| 04-python.md | Python package (Server, Client, Extensions) |
| 05-protocol.md | Wire protocol specification |
| 06-extensions.md | Extension system and built-in extensions |
| 07-getting-started.md | Quick start guides |
| 08-production-checklist.md | Production readiness checklist (P0/P1/P2) |
Project Structure
apps/
├── nodejs/ # Node.js package (published as "cromio" on npm)
├── python/ # Python package (published as "cromio" on PyPI)
└── test/ # Integration tests for Node.js and Python
License
MIT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cromio-0.0.6.tar.gz.
File metadata
- Download URL: cromio-0.0.6.tar.gz
- Upload date:
- Size: 21.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ab9fc1aa48816a611094b98764b708dc5a1493af04011d79fed6d2cf02d4a3ad
|
|
| MD5 |
c5c57b0391f1b14ed2848c4f288f26af
|
|
| BLAKE2b-256 |
ff3711e75e36d0871f76c9cc32d593bb52821ccdd5189ba86fa132c9c4191351
|
File details
Details for the file cromio-0.0.6-py3-none-any.whl.
File metadata
- Download URL: cromio-0.0.6-py3-none-any.whl
- Upload date:
- Size: 27.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
13e05aba967096576c2e2ef7a217bcd7933f56971336f2c951f619f4b26ef089
|
|
| MD5 |
5708d24ef693e51c9e0aa9033e051d80
|
|
| BLAKE2b-256 |
08a556b42a8f28b9511964ebeb5cab93ca53634ec2cbf255f6f1381be0fd07ee
|