MCPcopy Index your code
hub / github.com/doseofted/prim-rpc

github.com/doseofted/prim-rpc @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
332 symbols 792 edges 104 files 17 documented · 5%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Prim+RPC. Pictured are two very short JavaScript files: a simple function on the server-side and a call to that function on the client-side. Tagline: "Backend, meet Frontend"

npm npm license npm bundle size [^1]

Prim+RPC is a bridge between JavaScript environments. Call functions on the server as if they exist on the client, without the wrappers. It's just JavaScript. You could bridge:

  • Web server and client
  • Two browser tabs
  • Main thread and Web Worker
  • Two separate processes
  • Any other separated JavaScript environments

Prim+RPC is framework-agnostic (bring your own server and client tools), fully-typed, lightweight, doesn't require a compile-step, and is loaded with features:

  • File handling
  • Callback support
  • Custom serialization
  • Error handling
  • Request batching
  • HTML form handling
  • Documentation generation
  • Access control

If you know JavaScript, you know how to use Prim+RPC. If you want access to a function, just call it: less setup, easier access, quicker development of your API.

📖 Read the Docs💡 Examples⚙️ Setup🔌 Plugins🧑‍💻 Follow Author

Contributions

[!NOTE]

Prim+RPC is in early stages and is marching towards a stable release. Support Prim+RPC by starring the repository, sharing with others, and following for updates.

Happy to have you! Please see the Contribution Guide to learn more. If you're only looking for how to use the library, please see the Documentation.

Issues & Security

  • If you have any questions or are having trouble, feel free to open a new discussion.
  • For security-related issues, please refer to the Security Policy.
  • If you discover a non-security issue with Prim+RPC, please file a new issue so I can take a look!

Release Plan

[!WARNING]

Prim+RPC is in alpha and it may be unstable. Keep up-to-date with the latest releases, report any found security issues, and participate in discussions to help shape the future of the project!

Prim+RPC is planned to become stable by the end of 2025, prior to the release of Ted's portfolio website that will make use of it. See the in-progress pull request for details regarding the next version of Prim+RPC.

Prim+RPC Core, the framework-agnostic core of the project, will become stable first and will be released once the default plugins are stable. Lastly, Prim+RPC's optional tooling (such as documentation generation) will become stable. At this point, the alpha tag is planned to be removed. Once I am using Prim+RPC in production, a v1.0 will be released.

Licenses

This project consists of three parts: Code, Documentation, and Assets:

Code: The Prim+RPC code libraries (RPC core, plugins, and tooling) are licensed under the Apache 2.0 license. You may find library source code in the /libs folder of this project. Assets, which may appear alongside Code, are excluded from this license.

Documentation: The documentation website and text are proprietary. You may find documentation in the /apps folder of this project. Unauthorized usage of Documentation outside of fair use is strictly prohibited.

Assets: The "Prim+RPC" name and logo as well as the "Dose of Ted" name and logo are proprietary. Assets are excluded from all licenses, regardless of where they are located in the project. Unauthorized usage of Assets outside of fair use is strictly prohibited.

[^1]: These badges report stats for @doseofted/prim-rpc on the npm registry.

Extension points exported contracts — how you extend this code

LightProperties (Interface)
(no doc) [1 implementers]
apps/documentation/src/utils/lights/Light.ts
ThingInstance (Interface)
(no doc)
libs/example/src/things.ts
RpcBase (Interface)
(no doc)
libs/rpc/src/interfaces.ts
MethodFetchOptions (Interface)
(no doc)
libs/plugins/src/client/browser-fetch.ts
PrimType (Interface)
(no doc)
libs/tooling/src/docs/interfaces.ts
IntroTextProps (Interface)
(no doc)
apps/documentation/src/components/IntroText.react.tsx
Greeting (Interface)
(no doc)
libs/example/src/index.ts
RpcCall (Interface)
(no doc)
libs/rpc/src/interfaces.ts

Core symbols most depended-on inside this repo

createPrimServer
called by 87
libs/rpc/src/server.ts
createPrimClient
called by 50
libs/rpc/src/client.ts
createPrimTestingPlugins
called by 27
libs/rpc/src/testing.ts
delete
called by 7
apps/documentation/src/utils/lights/ElementSet.ts
clear
called by 7
apps/documentation/src/utils/lights/ElementSet.ts
primFetch
called by 7
libs/plugins/src/server/server-fetch.ts
createMethodHandler
called by 7
libs/plugins/src/server/hono.ts
expressPrimRpc
called by 7
libs/plugins/src/server/express.ts

Shape

Function 190
Interface 65
Method 60
Class 12
Enum 5

Languages

TypeScript100%

Modules by API surface

libs/example/src/index.ts28 symbols
libs/plugins/src/ipc/web-worker.ts21 symbols
apps/documentation/src/utils/lights/LightElements.ts19 symbols
libs/rpc/src/interfaces.ts18 symbols
apps/documentation/src/utils/lights/Light.ts18 symbols
libs/rpc/src/testing.ts15 symbols
apps/documentation/src/utils/lights/LightGroup.ts15 symbols
libs/rpc/src/server.ts13 symbols
libs/rpc/src/client.ts11 symbols
libs/plugins/src/server/fastify.ts11 symbols
apps/documentation/src/utils/lights/ElementSet.ts11 symbols
libs/tooling/src/docs/interfaces.ts10 symbols

For agents

$ claude mcp add prim-rpc \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact