@explita/actyx-rpc
v0.7.0
Published
Actyx RPC — type-safe RPC for composable server actions in TypeScript
Maintainers
Readme
Actyx RPC
Type-safe RPC for composable server actions in TypeScript.
Actyx RPC lets you build server-side procedures with full type safety, minimal boilerplate, and a clean, composable API. It bridges client-side queries and server-side execution seamlessly.
📖 Complete Documentation
Visit our documentation portal for the complete guide, API references, execution policies, and integration adapters:
Installation
npm install @explita/actyx-rpcInstall your schema validation library of choice (such as Zod, Valibot, ArkType, Joi, or Yup) as a peer dependency.
Quick Start
Define a reusable procedure builder with context injection (e.g. database, authentication context):
// server/procedures.ts
import { createProcedure } from "@explita/actyx-rpc";
import { z } from "zod";
import { zodResolver } from "@explita/actyx-rpc/resolvers/zod";
const procedure = createProcedure({
async createContext() {
return {
ok: true,
ctx: { userId: "user_123" }
};
}
});
// Build a validated query procedure
export const getUserProfile = procedure
.input(zodResolver(z.object({ id: z.string() })))
.query(async ({ ctx, input }) => {
return {
id: input.id,
userId: ctx.userId,
name: "Ade Explita"
};
});Execute the procedure on the client (or in Server Actions) returning a safe [data, error] tuple:
import { getUserProfile } from "./server/procedures";
const [profile, error] = await getUserProfile({ id: "user_456" });
if (error) {
console.error("Failed to load profile:", error.message);
} else {
console.log("Loaded profile:", profile.name);
}💖 Support the Mission
Actyx RPC is built to simplify building type-safe, distributed systems with minimal boilerplate. If it has helped you build better APIs faster, please consider supporting the project to ensure its continued growth and maintenance!
🚀 Ways to Contribute
- Give us a ⭐: It helps others discover the project.
- Join the Discussion: Report bugs or suggest new features.
- Spread the Word: Share your experience with Actyx RPC on social media.
🙏 Our Amazing Supporters
A huge thank you to everyone helping us build the future of type-safe server actions!
License
MIT © Explita
