jac-sv-microservices

Splits Jac backends into microservices using sv import compile-time HTTP clients.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Splitting a Jac backend into independently deployed services normally requires rewriting imports as manual HTTP calls. This Skill explains how sv import generates compile-time HTTP client stubs so the same source code runs as a monolith, a local cluster, or Kubernetes deployments without modification. ## Core Features & Use Cases - Compile-time HTTP stubs: Call remote def:pub functions and spawn remote walker:pub walkers through ordinary import syntax, with synchronous sv-to-sv calls. - Provider discovery chain: Resolve providers via test clients, registered URLs, JAC_SV_<MODULE>_URL environment variables, or automatic sibling auto-spawn at jac start. - Gateway mode: Use jac setup microservice to run many services behind one API gateway with unified docs, metrics, trace IDs, and per-service RPC timeouts. - Use Case: A calculator service calls add() from a separate math service over HTTP per iteration, then later the whole stack is deployed to Kubernetes with --scale where peer URLs are auto-injected. ## Quick Start Show me how to split my Jac server into two services where one calls a public function on the other using sv import.

Frequently Asked Questions about jac-sv-microservices

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

FAQPage Schema
How do I split a Jac backend into microservices?▼

Use `sv import from <module> { ... }` between two server modules. The compiler generates HTTP client stubs, so calling a remote function looks like a normal import while the call executes as a POST against the provider's URL.

How does Jac discover the URL of a remote service?▼

Discovery follows a chain: registered test clients, programmatically registered URLs, the JAC_SV_<UPPERCASED_MODULE>_URL environment variable, then auto-spawn of the provider as a sibling process at jac start time.

Why does my cross-service call fail with Unauthorized?▼

The provider symbol is not declared pub. Only def:pub functions and walker:pub walkers are callable across the service boundary; plain or priv endpoints are JWT-gated and anonymous sv-to-sv hops carry no token.

Can a walker be called across Jac services?▼

Yes, importing a walker:pub via sv import spawns and executes it remotely on construction. The returned instance already has reports populated; there is no unexecuted remote walker, and browser clients cannot use this.

What types can cross the Jac service boundary?▼

obj types (recursively hydrated), enums by name, primitives, lists, dicts, None, and live streaming generators cross the wire. Node anchors, closures, and file handles do not; pass jid strings and re-resolve with jobj instead.

Why does auto-spawn fail to start my provider service?▼

Auto-spawn requires the provider .jac file and a jac.toml in the directory where jac start runs, binds siblings to 127.0.0.1 on ports 18000-18999, and fails fast after roughly 15 seconds of health-check waiting. Set JAC_SV_<MOD>_URL explicitly to bypass it.