Skip to content

MetaPointTech/metapoint

Repository files navigation

MetaPoint

Meta first and low-code.
Peer-to-Peer typesafe APIs or Channels made easy.

Apache-2.0 License Discord Version Downloads Total Downloads
Demo

MetaPoint lets you focus on what you want to do

Intro

More information at https://metapointtech.github.io/metapoint/

Quickstart

import { h, MetaType, peer, z } from "metapoint";

// router group
const g = h();

// node1(nodejs/browser)
const node1 = await peer({
  endpoint: {
    numberAdd: g.handler({
      func: async ({ data, send, done }) => {
        await send(data + 1);
        await done();
      },
      input: z.number(),
      output: z.number(),
    }),
  },
});
export type meta = MetaType<typeof node1>;

// node2(nodejs/browser)
const node2 = await peer();
const channel = await node2.connect<meta>(node1.meta().addrs);
const add = await channel("numberAdd");
console.log(await add(1)); // [2]

Releases

No releases published

Packages

No packages published