@artmuseo/topimaton
v0.1.8
Published
The Artmuseo Web Primitives design package.
Downloads
160
Readme
topimaton
Topimaton is an opinionated framework for designing RPCs. Developed at Artmuseo to promote a specific set of RPC design patterns and the automatic generation of their clients, it is NOT an alternative to IDL-based cross-language frameworks such as gRPC and Thrift.
STOP 🛑
Before using this software, consider the following.
Topimaton is...
:white_check_mark: An opinionated framework for RPC development.
:white_check_mark: An experimental solution to the last mile problem in RPC development.
:white_check_mark: A tool for extending the patterns of @artmuseo/makette to services.
:white_check_mark: A semantically empowered service definition framework.
Topimaton is NOT...
:x: An alternative to Interface Definition Language frameworks such as gRPC and Thrifty. In fact, Artmuseo uses gRPC internally for the layers immediately below our Topimaton target.
:x: A production-ready tool for RPC development. Though Artmuseo uses Topimaton for its application, we do not endorse its usage in production externally.
:x: A sure fire means to improve RPC performance.
You should consider using Topimaton if...
:white_check_mark: You do not want to use gRPC and Envoy to provide the last mile connection between your RPC services and your web application.
:white_check_mark: You want to write service definitions in the language in which they are implemented. (Or, not write them at all!)
:white_check_mark: You like the RPC design principles Topimaton enshrines.
:white_check_mark: You have been using @artmuseo/makette.
:white_check_mark: You want to experiment with the benefits of Topimaton's semantic system.
Quick Start
In version 0.x.x
, Topimaton only supports Typescript.
Install
yarn add @artmuseo/topimaton
Implement
import { makette } from @artmuseo/makette;
import { topimaton } from @artmuseo/topimaton;
// create the add body
const add = async (args : {a : number, b : number}, c : any)=>{
return args.a + args.b;
};
// create a model around the add body
const addModel =makette.method.models.Model({
body : add,
defaultContext : {}
});
// create a controller around the add model
const addController = topimaton.methods.controllers.ServerController({
model : addModel
});
// create the view
const addView = topimaton.methods.views.ServerView({
controller : addController
});
const arithTopic = topimaton.topics.Topic({
views : {
add : addView
}
});
const mathGenre = topimaton.genres.Genre({
topics : {
arith : arithTopic
}
});
const mathMachine = topimaton.topimata.Topimaton({
genres : {
math : mathGenre
}
});
Serve
const app = topimaton.methods.views.TopimatonServer(mathMachine);
await new Promise((resolve)=>app.listen(8080, ()=>resolve(true)));
Generate
const mathMachineClient = topimaton.clients.Client(mathMachine);
const res = await mathMachineClient.math.arith.add({ a : 2, b : 2 }); // 4
Translate
import { topimatonStone } from "@artmuseo/topimaton-stone";
// write a Swift package
topimatonStone.swift.packageSwift(mathMachine);
v1.x.x
Roadmap
Support ProtoBuf
Protocol Buffers are used by gRPC to reduce message size and increase serialization and deserialization speed. Topimaton will seek to add ProtoBuf tranfers as an additional optional way to get objects from the server.
Support CapnProto
CapnProto can outperform Protocol Buffers due to removing encoding and decoding steps in the data interchange process. Topimaton will seek to add CapnProto as its preferred high-performance binary communication protocol.
Support Python Topimata
Topimaton services currently can only be defined in Typescript. We will seek to add support for building them in Python as well.
Additional Translation for @artmuseo/topimaton-stone
Currently, @artmuseo/topimaton-stone supports translation from TypeScript
to...
- Swift
- Kotlin
We will additional seek to add translation from TypeScript
to...
- Python
And, tranlsation from Python
to...
- TypeScript
- Swift
- Kotlin
Smart RPC and SDK Generation
Topimaton Stone's semantic engine will enable the experimental automatic generation of SDKs from Topimata. These SDKs will be layered on top of the generated clients provided suggested optimal means to perform common tasks which are predicted from the structure of the RPC.