effect-http-api

Build schema-first typed HTTP APIs with Effect v4 HttpApi endpoints, middleware, and clients.

1|Updated Aug 24, 2026
One-click install
npx skills add https://github.com/lambdasolver2/opencode-effect-harness --skill effect-http-api-lambdasolver2
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: effect-http-api
Source: https://github.com/lambdasolver2/opencode-effect-harness/tree/main/packages/module-typescript/assets/skills/effect-http-api
Command: npx skills add https://github.com/lambdasolver2/opencode-effect-harness --skill effect-http-api-lambdasolver2

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires effect, @effect/platform-node.

What problem does it solve? Building HTTP APIs in TypeScript often means duplicating route definitions, validation logic, OpenAPI docs, and client code that drift out of sync. This Skill guides the creation of a single typed API definition with Effect v4's HttpApi module so the server, documentation, and derived client all stay consistent. ## Core Features & Use Cases - Schema-First Endpoint Definitions: Define endpoints with typed params, query strings, headers, payloads, success responses, and tagged errors, including content negotiation and multipart file uploads. - Middleware and Security: Implement bearer, basic, API key, and custom security schemes as typed middleware layers, plus schema-error transforms for validation responses. - Derived Clients, Docs, and Tests: Generate OpenAPI specifications, Swagger/Scalar docs, fully typed HTTP clients, and handler unit tests from the same definition. - Use Case: Define a Users API group with CRUD endpoints and bearer authentication once, then serve it on Node.js, expose OpenAPI docs at /docs, and hand frontend teams a type-safe client without writing any client code. ## Quick Start Use the effect-http-api skill to scaffold a typed Effect v4 HTTP API with a users endpoint group, bearer auth middleware, and OpenAPI docs.

Frequently Asked Questions about effect-http-api

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

FAQPage Schema
How do I build a typed REST API with Effect v4?

Define endpoints with HttpApiEndpoint using schemas for params, query, payload, success, and errors, group them with HttpApiGroup, and combine into an HttpApi. Implement handlers via HttpApiBuilder.group and serve with HttpApiBuilder.layer plus NodeHttpServer.

How do I add bearer token authentication to an Effect HttpApi?

Create middleware with HttpApiMiddleware.Service declaring security: { bearer: HttpApiSecurity.bearer } and an error schema. Implement it as a Layer that validates the credential from options.credential and provides services like CurrentUser to the handler.

Does Effect HttpApi generate OpenAPI documentation automatically?

Yes. Annotate the API with OpenApi.annotations for title and version, then expose the spec via HttpApiBuilder.layer with openapiPath, or serve interactive docs using HttpApiScalar.layer or HttpApiSwagger at a chosen path.

How do I handle file uploads in an Effect HttpApi endpoint?

Use Multipart.FilesSchema or Multipart.SingleFileSchema in the payload schema piped through HttpApiSchema.asMultipart for buffered uploads, or asMultipartStream for streaming. Multipart is payload-only and supports limits like maxFileSize.

Why do my Effect HttpApi headers fail to decode?

HTTP headers are normalized to lowercase, so header schema keys must be lowercase like 'x-api-key', never 'X-API-Key'. Also note that group middleware only applies to endpoints added before the .middleware call.

Can I derive a typed HTTP client from an Effect API definition?

Yes. HttpApiClient generates a fully typed client from the same API definition, which is why definitions should live in their own package separate from server implementations. Middleware marked requiredForClient needs a matching client layer.