SO

solidstart-request-events

Provides access to SolidStart request events, event.locals, and nativeEvent for server-side processing.

Install

mkdir -p .claude/skills/solidstart-request-events && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/14512" && unzip -o skill.zip -d .claude/skills/solidstart-request-events && rm skill.zip

Installs to .claude/skills/solidstart-request-events

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

SolidStart request events: getRequestEvent for server context, event.locals for typed data, nativeEvent for Vinxi access, request handling.
139 charsno explicit “when” trigger
Intermediate

Key capabilities

  • Access the current request event on the server
  • Pass typed data around the request using event.locals
  • Access the underlying Vinxi/H3 event
  • Implement authentication patterns
  • Manage session data

How it works

The skill uses `getRequestEvent` to access the server request context, allowing manipulation of `event.locals` for typed data and `event.nativeEvent` for direct Vinxi/H3 access. It also demonstrates patterns for authentication and session management.

Inputs & outputs

You give it
An incoming HTTP request in a SolidStart server function
You get back
Access to request details, typed local data, or modified response headers

When to use solidstart-request-events

  • Accessing typed data in server-side requests
  • Handling native events in Vinxi
  • Managing server context state

About this skill

SolidStart Request Events

Complete guide to accessing request events and context in SolidStart server functions. Type-safe locals and native event handling.

getRequestEvent

Access the current request event anywhere on the server.

import { getRequestEvent } from "solid-js/web";

"use server";

export async function getData() {
  const event = getRequestEvent();
  const url = event.request.url;
  const headers = event.request.headers;
  
  // Access request data
  return { url, headers };
}

event.locals - Typed Context

Use event.locals to pass typed data around the request.

Type Definition

// global.d.ts
/// <reference types="@solidjs/start/env" />
declare module App {
  interface RequestEventLocals {
    userId: string;
    session: Session;
    nonce: string;
  }
}

Setting Locals

// middleware/index.ts
import { createMiddleware } from "@solidjs/start/middleware";

export default createMiddleware({
  onRequest: (event) => {
    // Set typed locals
    event.locals.userId = "123";
    event.locals.session = getSession(event);
    event.locals.nonce = generateNonce();
  },
});

Accessing Locals

"use server";

export async function getUser() {
  const event = getRequestEvent();
  const userId = event.locals.userId; // Typed!
  const session = event.locals.session; // Typed!
  
  return fetchUser(userId);
}

nativeEvent - Vinxi Access

Access the underlying Vinxi/H3 event for advanced use cases.

import { getRequestEvent } from "solid-js/web";

"use server";

export async function advancedHandler() {
  const event = getRequestEvent();
  const nativeEvent = event.nativeEvent; // H3Event
  
  // Use H3 helpers
  // Note: Only import in server-only files
}

Important: Vinxi HTTP helpers don't treeshake. Only import in server-only files.

Common Patterns

Authentication

// middleware/auth.ts
export default createMiddleware({
  onRequest: (event) => {
    const token = event.request.headers.get("Authorization");
    const user = verifyToken(token);
    event.locals.user = user;
  },
});

// routes/protected.tsx
"use server";

export async function getProtectedData() {
  const event = getRequestEvent();
  const user = event.locals.user; // Typed!
  
  if (!user) {
    throw new Error("Unauthorized");
  }
  
  return fetchUserData(user.id);
}

Request Metadata

"use server";

export async function logRequest() {
  const event = getRequestEvent();
  const url = new URL(event.request.url);
  const ip = event.request.headers.get("x-forwarded-for");
  const userAgent = event.request.headers.get("user-agent");
  
  console.log({ url: url.pathname, ip, userAgent });
}

Response Manipulation

"use server";

export async function setCustomHeader() {
  const event = getRequestEvent();
  
  event.response.headers.set("X-Custom-Header", "value");
  
  return { data: "..." };
}

Session Management

// middleware/session.ts
export default createMiddleware({
  onRequest: (event) => {
    const sessionId = getSessionId(event);
    event.locals.session = getSession(sessionId);
  },
});

// routes/api.tsx
"use server";

export async function updateSession(data: any) {
  const event = getRequestEvent();
  const session = event.locals.session;
  
  session.data = data;
  await saveSession(session);
}

Best Practices

  1. Type your locals:

    • Define in global.d.ts
    • Get autocomplete and type safety
  2. Set locals in middleware:

    • Centralized setup
    • Available to all routes
  3. Use getRequestEvent:

    • Access anywhere on server
    • Type-safe locals
  4. Avoid nativeEvent unless needed:

    • Prefer SolidStart APIs
    • Only for advanced cases
  5. Server-only imports:

    • Vinxi helpers in server files only
    • Avoid treeshake issues

Summary

  • getRequestEvent: Access current request
  • event.locals: Typed request context
  • nativeEvent: Underlying H3 event
  • Type safety: Define locals in global.d.ts
  • Middleware: Set locals centrally

When not to use it

  • The application is not a SolidStart server application
  • The task does not involve server-side request handling

Limitations

  • Requires a SolidStart server environment
  • Vinxi HTTP helpers should only be imported in server-only files to avoid treeshake issues

How it compares

This skill provides a type-safe and structured way to handle server-side request context and data in SolidStart, offering more control and clarity than direct manipulation of raw request objects.

Compared to similar skills

solidstart-request-events side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
solidstart-request-events (this skill)06moNo flagsIntermediate
telegram-bot-builder1066moReviewIntermediate
telegram-mini-app626moReviewAdvanced
stripe-integration482moNo flagsAdvanced

Try saying

Example prompts that trigger this skill in your AI assistant.

You might also like

telegram-bot-builder

davila7

Expert in building Telegram bots that solve real problems - from simple automation to complex AI-powered bots. Covers bot architecture, the Telegram Bot API, user experience, monetization strategies, and scaling bots to thousands of users. Use when: telegram bot, bot api, telegram automation, chat bot telegram, tg bot.

106130

telegram-mini-app

davila7

Expert in building Telegram Mini Apps (TWA) - web apps that run inside Telegram with native-like experience. Covers the TON ecosystem, Telegram Web App API, payments, user authentication, and building viral mini apps that monetize. Use when: telegram mini app, TWA, telegram web app, TON app, mini app.

62163

stripe-integration

wshobson

Implement Stripe payment processing for robust, PCI-compliant payment flows including checkout, subscriptions, and webhooks. Use when integrating Stripe payments, building subscription systems, or implementing secure checkout flows.

48165

nodejs-backend-patterns

wshobson

Build production-ready Node.js backend services with Express/Fastify, implementing middleware patterns, error handling, authentication, database integration, and API design best practices. Use when creating Node.js servers, REST APIs, GraphQL backends, or microservices architectures.

1246

hubspot-integration

davila7

Expert patterns for HubSpot CRM integration including OAuth authentication, CRM objects, associations, batch operations, webhooks, and custom objects. Covers Node.js and Python SDKs. Use when: hubspot, hubspot api, hubspot crm, hubspot integration, contacts api.

540

backend-architect

sickn33

Expert backend architect specializing in scalable API design, microservices architecture, and distributed systems. Masters REST/GraphQL/gRPC APIs, event-driven architectures, service mesh patterns, and modern backend frameworks. Handles service boundary definition, inter-service communication, resilience patterns, and observability. Use PROACTIVELY when creating new backend services or APIs.

1014

Search skills

Search the agent skills registry