feat: Initialize wRPC project structure and implement core features - #1
Merged
Merged
Conversation
Set up the initial project structure for @alexify/wrpc, a WebSocket-based RPC library. Adds package.json with dependencies, pnpm workspace config, editor config, and tooling configuration for oxlint and oxfmt.
Set up the initial project foundation with Node/browser entry points, placeholder src/types exports, smoke and tsd tests, coverage/lint/format/size/bench scripts, and GitHub Actions CI (lint, test matrix, docs build). Added baseline docs and project metadata (README expansion, VitePress site skeleton, changelog, security policy, and Vercel config) while clearly marking the protocol implementation as not yet landed.
Add a full Metacom runtime with client/server RPC over HTTP and WebSocket, stream transport with chunk encoding/decoding, and a Service Worker proxy transport. Introduce a native WebSocket implementation (handshake, frames, parser, connection lifecycle, close/error handling) plus transport helpers and public exports. Include TypeScript declarations, encoder benchmark tooling, and broad test coverage across chunks, streams, client/server integration, proxy behavior, and WebSocket protocol compliance.
Ship the actual wRPC implementation and public surface: client/server, transports, stream/chunk handling, and the in-repo WebSocket stack, then wire it through `src/index.js` with a browser-safe `src/index.browser.js` entry. Rename the old Metacom naming to Wrpc (`Metacom`→`WrpcClient`, stream classes, proxy/events), add full hand-maintained `index.d.ts` types, and update package exports/imports plus docs/changelog to reflect the real API. Remove runtime dependency coupling by inlining required utilities (`Emitter`, JSON parsing, helpers) and splitting UUID runtime for node/browser, with broad test expansion and test file normalization to `*.test.js`.
Add a `bench/run-all.js` runner that executes every benchmark file in `bench/` sequentially and propagates failures. Update the `bench` package script and repository guidance so `pnpm bench` covers the whole benchmark directory instead of only `bench.js`.
Replace the module-load placeholder with real WrpcClient/Server round-trip benchmarks, mirroring the setup in tests/integration.test.js: WS call round-trip (small + 10KB payload), HTTP call round-trip, and WS call + server event round-trip throughput.
Add bench/rpc-comparison.js, comparing wrpc's full client/server RPC
round-trip against an equivalent minimal echo RPC (same {id, method, args}
envelope) built on ws, uWebSockets.js, @fastify/websocket, and fastify-uws,
isolating transport overhead from protocol design. Each stack runs in its
own child process since raw uWebSockets.js and fastify-uws's bundled copy
of it segfault when loaded together. Extract the shared bench() harness and
wrpc echo-server setup out of bench/bench.js into bench/support/ so both
scripts reuse them. Adds ws, fastify, @fastify/websocket, fastify-uws, and
uWebSockets.js as devDependencies (benchmark-only; wrpc's runtime stays
zero-dependency).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request sets up the initial scaffolding for the
@alexify/wrpcproject, establishing its configuration, development tooling, documentation, and core guidelines. It introduces a zero-dependency, WebSocket-based RPC protocol for Node.js and browsers, complete with CI, linting/formatting, and a benchmarking harness. The most important changes are summarized below.Project configuration and documentation:
README.md(project overview, installation, usage, API reference),CHANGELOG.md(notable changes),SECURITY.md(security policy), andCLAUDE.md(guidance for Claude Code and repository conventions). [1] [2] [3] [4]Development tooling and CI:
.editorconfigfor consistent editor settings (2-space indent, single quotes, 120-char lines, etc.), and configuration for oxlint (.oxlintrc.json) and oxfmt (.oxfmtrc.json) to enforce code style and linting rules. [1] [2] [3].github/workflows/ci.yml) that runs linting, formatting, bundle-size checks, tests (on Node 22 and 24), and documentation builds.Benchmarking:
bench/bench.js) to measure protocol hot path throughput, spinning up a real server and clients for round-trip performance tests.These changes provide a strong foundation for the project, ensuring code quality, documentation, and performance measurement from the outset.