This specification is maintained by the AgentRules Working Group. Have enhancements or want to claim maintainership?Submit Specification →
frontendcritical PriorityID: solidstart-server-rpc-async-boundary-standard

Enforcing SolidStart 1.0 server$ RPC Isolation and createAsync Boundaries

SolidStart server functions (`server$`) create isolated RPC endpoints that execute strictly on the server and must not capture client-side reactive scope closures. Reactive client signals consumed by server functions must be explicitly passed as serialized arguments, and all resulting async promises must resolve through `createAsync` or action utilities within `<Suspense>` boundaries to preserve fine-grained reactivity and prevent hydration mismatches.

Prohibited Anti-Pattern: Capturing Client Signals in server$ Closures or Calling server$ Unwrapped in Reactive Tracking Scopes

Export Ready-to-Drop Configuration

Select format below to copy code or download file directly.

---
description: Enforcing SolidStart 1.0 server$ RPC Isolation and createAsync Boundaries - SolidStart server functions (`server$`) create isolated RPC endpoints that execute strictly on the server and must not capture client-side reactive scope closures. Reactive client signals consumed by server functions must be explicitly passed as serialized arguments, and all resulting async promises must resolve through `createAsync` or action utilities within `<Suspense>` boundaries to preserve fine-grained reactivity and prevent hydration mismatches.
globs: src/**/*.{ts,tsx}
alwaysApply: true
verified_by: "agentrules.org"
license: "CC-BY-4.0"
source: "https://agentrules.org/rules/solidstart-server-rpc-async-boundary-standard"
---

# Enforcing SolidStart 1.0 server$ RPC Isolation and createAsync Boundaries

> **Severity**: CRITICAL | **Category**: frontend
> **Anti-Pattern Warning**: Capturing Client Signals in server$ Closures or Calling server$ Unwrapped in Reactive Tracking Scopes

## System Constraints
You are a Principal Engineer enforcing SolidStart 1.0 Server Functions & Async Boundaries. Mandate strict isolation between client reactive signal scopes and server-side RPC functions. Enforce pure argument passing to `server$`, mandatory consumption of server data via `createAsync` or `cache` wrapped handlers, and full encapsulation within `<Suspense>` boundaries. Prevent reactive tracking leaks, closure serialization bugs, and untracked network waterfalls across SSR/client transitions.

## Strict Guidelines
- Engineers MUST ALWAYS pass client-side signal values as explicit, serializable parameters into `server$` functions rather than referencing client variables directly in the server closure.
- Engineers MUST wrap all async data queries powered by `server$` in `createAsync()` from `@solidjs/router` to properly register promises with Solid's Suspense and SSR streaming lifecycle.
- Engineers MUST NOT invoke `server$` functions directly inside `createEffect`, `createMemo`, or inline JSX templates without wrapping them in `action()`, `createAsync()`, or transition handlers.
- Code SHOULD pair queries with cached access via `cache(async (...) => server$(...), 'cache-key')` to allow deduplicated fetching during SSR and client navigation.
- Services MUST ensure return values from `server$` are strictly serializable JSON primitives (no functions, Symbol, circular structures, or unhandled Error instances).
- Components NEVER trigger mutations via raw `server$` calls; mutations MUST use `action(async (...) => server$(...))` or `createAction` to ensure cache revalidation hooks trigger reliably.

## Bad vs Good Implementations
### Data Fetching with server$ and createAsync Boundary

#### Bad Antipattern (AI Common Hallucination)
> **Why it fails**: Referencing the client signal `userId()` within the `server$` body attempts to serialize a reactive tracking context over the network boundary, which fails at runtime. Calling raw RPCs inside `createEffect` bypasses SolidStart SSR streaming and `<Suspense>` coordination, causing layout thrashing and client-side waterfalls.
```typescript
import { createSignal, createEffect } from 'solid-js';
import { server$ } from '@solidjs/start/server';

export default function UserProfile() {
  const [userId, setUserId] = createSignal('usr_123');
  const [user, setUser] = createSignal<any>(null);

  // BAD: Accessing reactive signal inside server$ closure, triggering side effects via createEffect
  const fetchUser = server$(async () => {
    // userId() reference breaks: client signal does not exist in server execution context
    return await db.users.findUnique({ where: { id: userId() } });
  });

  createEffect(() => {
    fetchUser().then((data) => setUser(data));
  });

  return <div>{user()?.name}</div>;
}
```

#### Production Standard (Correct)
> **Standard**: The server function accepts `userId` as an explicit serializable parameter. Reactive reactivity is tracked on the client via `createAsync(() => getUser(userId()))`. The call integrates with `cache()` and `<Suspense>`, providing automatic SSR streaming and safe client-side refetching.
```typescript
import { createSignal, Suspense } from 'solid-js';
import { createAsync, cache } from '@solidjs/router';
import { server$ } from '@solidjs/start/server';

// GOOD: server$ receives explicit serializable arguments; query is wrapped in cache()
const getUser = cache(async (id: string) => {
  'use server';
  return server$(async (userId: string) => {
    return await db.users.findUnique({ where: { id: userId } });
  })(id);
}, 'users.getById');

export default function UserProfile() {
  const [userId, setUserId] = createSignal('usr_123');
  
  // GOOD: Signal getter passed into createAsync tracks reactive dependencies cleanly
  const user = createAsync(() => getUser(userId()));

  return (
    <Suspense fallback={<p>Loading user profile...</p>}>
      <div>{user()?.name}</div>
    </Suspense>
  );
}
```

### Server Mutation Using action() for Cache Invalidation

#### Bad Antipattern (AI Common Hallucination)
> **Why it fails**: Invoking a bare `server$` function for state mutations bypasses SolidStart's action pipeline, preventing automated router cache revalidation and leaving client data out of sync.
```typescript
import { createSignal } from 'solid-js';
import { server$ } from '@solidjs/start/server';

const updateBio = server$(async (bio: string) => {
  return await db.user.updateBio(bio);
});

export function EditProfile() {
  const [bio, setBio] = createSignal('');

  const handleSubmit = async (e: Event) => {
    e.preventDefault();
    // BAD: Unmanaged server mutation leaves router cache stale
    await updateBio(bio());
  };

  return (
    <form onSubmit={handleSubmit}>
      <input value={bio()} onInput={(e) => setBio(e.currentTarget.value)} />
      <button type="submit">Save</button>
    </form>
  );
}
```

#### Production Standard (Correct)
> **Standard**: Encapsulating the mutation in `action()` automatically ties into progressive enhancement, handles submission state, and executes `revalidate()` to synchronize all active `cache()` subscribers across the app.
```typescript
import { action, revalidate } from '@solidjs/router';
import { server$ } from '@solidjs/start/server';

const updateBioAction = action(async (formData: FormData) => {
  'use server';
  const bio = formData.get('bio') as string;
  await server$(async (newBio: string) => {
    return await db.user.updateBio(newBio);
  })(bio);
  
  return revalidate('users.getById');
}, 'update-bio');

export function EditProfile() {
  return (
    <form action={updateBioAction} method="post">
      <input name="bio" type="text" />
      <button type="submit">Save</button>
    </form>
  );
}
```

Recommended MCP Servers (mcp-serverlist.com)

Equip agent with system tools to verify code for this stack.

Recommended Agent Skills (askills.dev)

Ready-to-use executable skill functions tailored to this stack.

Architectural Specification & Invariant Rationale

Architectural Invariant Design: Enforcing SolidStart 1.0 server$ RPC Isolation and createAsync Boundaries

Enforcing SolidStart 1.0 server$ RPC Isolation and createAsync Boundaries defines an industrial-grade behavioral standard for frontend engineering. SolidStart server functions (`server$`) create isolated RPC endpoints that execute strictly on the server and must not capture client-side reactive scope closures. Reactive client signals consumed by server functions must be explicitly passed as serialized arguments, and all resulting async promises must resolve through `createAsync` or action utilities within `<Suspense>` boundaries to preserve fine-grained reactivity and prevent hydration mismatches. Modern software architectures require strict adherence to deterministic patterns to guarantee high availability, maintainability, and zero security vulnerabilities.

Framework Paradigm Shift & Drift MechanicsLLMs are trained on millions of open-source repositories containing outdated code, legacy idioms, and unpatched antipatterns. When coding assistants generate implementations for this stack, they default to common statistical tokens: Capturing Client Signals in server$ Closures or Calling server$ Unwrapped in Reactive Tracking Scopes Without an explicit system instruction file, developers spend hours debugging silent failures.
Failure Modes & Production Blast Radius

Hazard Analysis: What Breaks Without This Rule

The following failure modes have been cataloged from hundreds of hours of production code reviews where AI assistants produced non-compliant implementations:

Failure ModeAI Symptom (The Anti-Pattern)SeverityProduction Impact & Remedy
AI Hallucination & Deprecation DriftCapturing Client Signals in server$ Closures or Calling server$ Unwrapped in Reactive Tracking ScopesCritical
Violating this industrial standard introduces regression bugs, security risks, and unexpected runtime failures in production.
Enforce explicit behavioral system directives across all AI coding assistants in your repository.
Silent Architecture InconsistencyAI assistants produce mixed paradigms across files, creating fragmented codebase conventions.Medium
Increases cognitive load during code reviews and leads to maintenance debt across engineering teams.
Pin project conventions in .cursor/rules, CLAUDE.md, and AGENTS.md so all team agents follow identical guardrails.
Architectural Directives in Detail

Step-by-Step Production Directives

Each rule constraint below is injected into the AI agent's system prompt to establish deterministic boundaries:

1

Engineers MUST ALWAYS pass client-side signal values as explicit, serializable parameters into `server$` functions rather than referencing client variables directly in the server closure.

Engineers MUST ALWAYS pass client-side signal values as explicit, serializable parameters into `server$` functions rather than referencing client variables directly in the server closure.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
2

Engineers MUST wrap all async data queries powered by `server$` in `createAsync()` from `@solidjs/router` to properly register promises with Solid's Suspense and SSR streaming lifecycle.

Engineers MUST wrap all async data queries powered by `server$` in `createAsync()` from `@solidjs/router` to properly register promises with Solid's Suspense and SSR streaming lifecycle.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
3

Engineers MUST NOT invoke `server$` functions directly inside `createEffect`, `createMemo`, or inline JSX templates without wrapping them in `action()`, `createAsync()`, or transition handlers.

Engineers MUST NOT invoke `server$` functions directly inside `createEffect`, `createMemo`, or inline JSX templates without wrapping them in `action()`, `createAsync()`, or transition handlers.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
4

Code SHOULD pair queries with cached access via `cache(async (...) => server$(...), 'cache-key')` to allow deduplicated fetching during SSR and client navigation.

Code SHOULD pair queries with cached access via `cache(async (...) => server$(...), 'cache-key')` to allow deduplicated fetching during SSR and client navigation.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
5

Services MUST ensure return values from `server$` are strictly serializable JSON primitives (no functions, Symbol, circular structures, or unhandled Error instances).

Services MUST ensure return values from `server$` are strictly serializable JSON primitives (no functions, Symbol, circular structures, or unhandled Error instances).

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
6

Components NEVER trigger mutations via raw `server$` calls

Components NEVER trigger mutations via raw `server$` calls; mutations MUST use `action(async (...) => server$(...))` or `createAction` to ensure cache revalidation hooks trigger reliably.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
Technical Questions & Answers

Frequently Asked Technical Questions

Common questions developers face when configuring AI coding assistants for this stack:

Q:Why is Enforcing SolidStart 1.0 server$ RPC Isolation and createAsync Boundaries critical for AI coding assistants?

SolidStart server functions (`server$`) create isolated RPC endpoints that execute strictly on the server and must not capture client-side reactive scope closures. Reactive client signals consumed by server functions must be explicitly passed as serialized arguments, and all resulting async promises must resolve through `createAsync` or action utilities within `<Suspense>` boundaries to preserve fine-grained reactivity and prevent hydration mismatches. Without explicit behavioral boundaries, AI coding assistants (Cursor, Claude Code, Windsurf, Codex) rely on training data averages, which frequently produce deprecated, inefficient, or vulnerable code patterns.

Q:How does adopting this rule prevent AI hallucinations?

This rule explicitly declares what the AI must avoid (Capturing Client Signals in server$ Closures or Calling server$ Unwrapped in Reactive Tracking Scopes) and prescribes verified positive examples. Grounding the LLM with negative and positive pairs eliminates guesswork.

Q:Which AI coding environments are supported?

This specification is multi-platform compatible: Cursor (.cursor/rules/*.mdc & .cursorrules), Anthropic Claude Code (CLAUDE.md), Windsurf (.windsurfrules), Codex / Cline (AGENTS.md), and GitHub Copilot (.github/copilot-instructions.md).

Q:Can I combine this rule with other technology stacks?

Yes. Use the Interactive Stack Builder or download an Agent Pack to merge this rule with other frontend, backend, database, security, and DevOps rules without syntax collision.

Open Specification · CC BY 4.0·Free for Personal, Team & Commercial In-Repo Use

Citation & Open Source Attribution Guidelines

This specification is licensed under Creative Commons Attribution 4.0 International (CC BY 4.0). You are completely free to adapt and share this rule in your workspace. If citing, including in public AI benchmark datasets, or redistributing, attribution to AgentRules.org is required.

Related FRONTEND Rules

View all rules →
frontend
119

SolidStart 1.0 Server Functions & Async Boundaries Production Standard

SolidStart 1.0 relies on the Vinxi bundler to split `server$` closures into independent HTTP POST RPC endpoints. Direct lexical closure over client signals within `server$` scopes or failure to demarcate async boundaries with `<Suspense>` causes silent serialization failures, client-bundle secret leaks, and SSR hydration mismatches. Enforcing strict parameter passing, runtime input validation, and Solid async primitives maintains security and fine-grained reactivity across network boundaries.

frontend
119

Astro 5 Actions & Content Layer Production Standard

Enforces strict type safety and architectural correctness for Astro 5 Server Actions and the zero-waterfall Content Layer API. Prevents runtime contract mismatches, hydration mismatches, and unhandled mutation exceptions across dynamic and prerendered boundaries. Failure to follow these patterns leads to silent data fetching waterfalls, build-time cache corruptions, and unhandled server action exceptions.

frontend
51

Nuxt 4 Nitro Server Engine & Shared Directory Production Standard

Nuxt 4 enforces strict boundary segregation between client UI in the app/ directory, backend endpoints in server/, and universal contracts in shared/. Violating cross-boundary isolation or maintaining module-scoped state in Nitro server handlers causes catastrophic cross-request data corruption and hydration mismatches under concurrent production traffic. Architects must enforce request-isolated H3 event contexts, universal serialization schemas, and strict path-alias boundaries.

1 Rule in Stack

Enforcing