IRPCIsomorphic Remote Procedure Call
Write once, run anywhere. Truly isomorphic, zero-boilerplate remote procedure calls.
Write once, run anywhere. Truly isomorphic, zero-boilerplate remote procedure calls.
import { irpc } from './irpc';
type ReadFile = (path: string) => Promise<string>;
export const readFile = irpc<ReadFile>({
name: 'readFile',
});import { fs } from 'node:fs/promises';
import { irpc } from '../irpc/irpc';
import { readFile } from '../irpc/fs';
irpc.construct(readFile, async (path) => {
return await fs.readFile(path, 'utf8');
});import { readFile } from '../irpc/fs';
export default function App() {
const [content, setContent] = useState('');
useEffect(() => {
readFile('file.txt').then(setContent);
}, []);
return (
<div>
<h1>File Content</h1>
<pre>{content}</pre>
</div>
);
}Call functions identically on client and server. IRPC abstracts network boundaries so you can focus on logic.
No REST endpoints, no GraphQL schemas, no complex serialization. Just write functions and call them.
Switch between HTTP, WebSockets, and other transports without changing a single line of your business logic.
A single mental model for local and remote functions. No more context switching between your business logic and the transport domain.
Compile-time validation from client to server, with IDE support for cross-boundary refactoring and self-documenting APIs.
Intelligent batching, connection reuse, and tree-shakable imports for optimal network efficiency and minimal bundle size.