server-functions

Develop typed server-side functions in pocopine with Rust proc-macros.

Updated Jun 1, 2026
One-click install
npx skills add https://github.com/mambisi/pocopine-skills --skill server-functions-mambisi
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: server-functions
Source: https://github.com/mambisi/pocopine-skills/tree/main/server-functions
Command: npx skills add https://github.com/mambisi/pocopine-skills --skill server-functions-mambisi

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires pocopine-server, pocopine-auth, and includes scripts (resource) components.

What problem does it solve?

This Skill provides a robust way to define and manage server-side functions in pocopine using Rust's proc-macros, ensuring secure access policies and efficient asynchronous communication with the client.

Core Features & Use Cases

  • Typed Server Functions: Create and manage server-side functions using Rust syntax with support for typed JSON communication.
  • Access Policies: Implement access policies with guards to secure endpoints and enforce access control.
  • Asynchronous Calls: Facilitate asynchronous state updates in the wasm client using the dispatch! macro.
  • Use Case: Ideal for developing pocopine applications that require server-side processing, such as handling user authentication, performing database queries, or calling external APIs.

Quick Start

Define a server function using the #[server] macro and specify your access policy, then call it with dispatch!(function().await, |s, result| { /* update state */ }).

Frequently Asked Questions about server-functions

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create typed server-side functions in Rust for the pocopine framework?

You can create typed server-side functions in Rust for the pocopine framework by using the #[server] proc-macro to define endpoints with typed JSON communication. This approach ensures type safety and structured data exchange between the server and client.

How do I secure endpoint access control in a pocopine application?

To secure endpoint access control in a pocopine application, you implement access policies using guards within your server function definitions. Guards enforce access restrictions directly on the endpoints, ensuring only authorized requests are processed.

How do I dispatch asynchronous calls to update state in a wasm client?

You dispatch asynchronous calls to update state in a wasm client by using the dispatch! macro with the await keyword. This macro handles the server function execution and applies a closure to update the client state with the result.

What dependencies do I need to run server functions with pocopine?

To run server functions with pocopine, you need the pocopine-server and pocopine-auth dependencies installed in your Rust project. These packages provide the core server execution environment and the necessary authentication guard infrastructure.

What is the best way to handle database queries or external API calls in a wasm application?

The best way to handle database queries or external API calls in a wasm application is defining pocopine server-side functions. This offloads heavy processing to the server, returning typed JSON results asynchronously to the wasm client.

When should I use Rust proc-macros for server-side function dispatching?

You should use Rust proc-macros for server-side function dispatching when you need typed JSON communication and secure access policies in a pocopine application. It is ideal for tasks like user authentication, database queries, or external API integrations.