jac-fullstack-patterns

Wire main.jac entry modules, endpoints, and client-server imports for fullstack Jac applications.

Updated Jul 26, 2026
One-click install
npx skills add https://github.com/nihalnihalani/jachacks-sf-2026 --skill jac-fullstack-patterns-nihalnihalani
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: jac-fullstack-patterns
Source: https://github.com/nihalnihalani/jachacks-sf-2026/tree/main/plugins/jac-codex/skills/jac-fullstack-patterns
Command: npx skills add https://github.com/nihalnihalani/jachacks-sf-2026 --skill jac-fullstack-patterns-nihalnihalani

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Fullstack Jac apps split code across server endpoints and client components, and wiring them together incorrectly causes silent failures: 405 errors from unregistered endpoints, unresolved Vite imports, un-awaited RPC promises, and stale cached reads. This Skill codifies the exact rules for connecting main.jac, server modules, and client modules so the pieces register and communicate correctly. ## Core Features & Use Cases - Entry module wiring: Register def:pub endpoints and walkers via plain imports in main.jac, and mount the client with def:pub app and [serve] base_route_app. - Two call styles: Choose between function RPC (await save_profile(...)) and walker spawn (root spawn add_task(title=t)), with the argument and return-value rules for each. - Boundary import rules: Apply sv import correctly in client modules, avoid it in main.jac, and understand the 60-second reader cache plus write-then-refetch mutation pattern. - Use Case: You add a new def:pub endpoint to a server module but the client gets 405 Method Not Allowed; this Skill tells you the name must join the entry module's import list and how to verify drift with jac check. ## Quick Start Ask the agent to scaffold the main.jac entry for a new fullstack Jac app with one server endpoint and a client component that calls it.

Frequently Asked Questions about jac-fullstack-patterns

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

FAQPage Schema
How do I call a Jac server endpoint from client code?▼

Use sv import in the client module to generate an RPC stub, then await the call, for example items = await fetch_items(). Alternatively spawn a walker with root spawn add_task(title=t) using kwargs that map to the walker's has fields, and read results from result.reports.

Why does my Jac endpoint return 405 Method Not Allowed?▼

A 405 on RPC calls means the endpoint name is missing from the entry module's import list in main.jac. Adding the new def:pub name to the existing import from statement registers it at /function/<name>; renaming or changing the return type does not help.

What is the difference between def:pub functions and walkers in Jac?▼

def:pub functions act as typed RPC endpoints with positional or keyword arguments and direct return values. Walkers are spawned with kwargs filling their has fields and return everything they report in result.reports; use walkers only when the endpoint actually traverses the graph with visit.

Why is my Jac client showing stale data after a server change?▼

The client runtime caches reader endpoint responses for 60 seconds with an LRU cache. Out-of-band changes like another tab or server-side mutation are invisible until the cache clears; calling any writer endpoint invalidates all cached reads.

Can I use sv import inside main.jac?▼

No. In main.jac use plain import from so endpoints register in-process; sv import there declares a server-to-server microservice boundary that spawns a separate process and breaks session cookies, causing 401 errors on def:priv endpoints.