{"id":22394,"library":"spiceflow","title":"Spiceflow","description":"Spiceflow is a TypeScript-first API framework for building type-safe RPC web applications. Version 1.18.0 is the current stable release. It provides a simple, composable API for defining routes, middleware, and error handling with full end-to-end type safety via inferred request and response schemas. Key differentiators include automatic OpenTelemetry integration, server timing headers, type-safe form data parsing, and support for Cloudflare Workers, Vercel, and Node.js environments. It is compatible with the Model Context Protocol SDK and ships its own TypeScript definitions. Release cadence is frequent, with multiple pre-release versions.","status":"active","version":"1.18.0","language":"javascript","source_language":"en","source_url":"https://github.com/remorses/spiceflow","tags":["javascript","typescript"],"install":[{"cmd":"npm install spiceflow","lang":"bash","label":"npm"},{"cmd":"yarn add spiceflow","lang":"bash","label":"yarn"},{"cmd":"pnpm add spiceflow","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency for MCP integration","package":"@modelcontextprotocol/sdk","optional":true}],"imports":[{"note":"Spiceflow is a named export, not a default export. Always use named import syntax.","wrong":"import Spiceflow from 'spiceflow'","symbol":"Spiceflow","correct":"import { Spiceflow } from 'spiceflow'"},{"note":"The json helper is exported from the main package, not a subpath.","wrong":"import { json } from 'spiceflow/json'","symbol":"json","correct":"import { json } from 'spiceflow'"},{"note":"Spiceflow is ESM-only; using require() will fail. Use import instead.","wrong":"const { parseFormData } = require('spiceflow')","symbol":"parseFormData","correct":"import { parseFormData } from 'spiceflow'"}],"quickstart":{"code":"import { Spiceflow, json } from 'spiceflow';\nimport { z } from 'zod';\n\nconst app = new Spiceflow()\n  .get('/hello', () => {\n    return json({ message: 'Hello, world!' })\n  })\n  .post('/echo', async ({ request }) => {\n    const body = await request.json();\n    return json(body, { status: 201 });\n  });\n\n// Start the server (assumes Node.js or Bun)\napp.listen(3000, () => {\n  console.log('Server running on http://localhost:3000');\n});","lang":"typescript","description":"Shows how to create a basic Spiceflow app with two routes, using the json helper for typed responses and Zod for optional schema validation."},"warnings":[{"fix":"Pin to v1.18.0 for production stability until v1.19.0 is released as stable.","message":"Spiceflow v1.19.0-rsc.x is a pre-release and may contain breaking changes compared to v1.18.0 stable.","severity":"breaking","affected_versions":">=1.19.0-rsc.0 <2.0.0"},{"fix":"Update to v1.19.0-rsc.7 or later, or avoid using require() in worker environments.","message":"On Cloudflare Workers, using require() will throw 'require is not defined'. This was fixed in v1.19.0-rsc.7.","severity":"gotcha","affected_versions":">=1.18.0 <1.19.0-rsc.7"},{"fix":"Ensure all routes using json() return data that matches the response schema, or handle validation errors.","message":"The json() helper throws a schema validation error if the returned data does not match the route's inferred response schema.","severity":"gotcha","affected_versions":">=1.19.0-rsc.1"},{"fix":"Register the app type with SpiceflowRegister to enable full type safety on client helpers.","message":"Using Spiceflow without registering the app type via SpiceflowRegister will cause Link and other typed helpers to fall back to string parameters.","severity":"deprecated","affected_versions":">=1.19.0-rsc.3"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Replace require() with import statements. For Cloudflare Workers, ensure your build process outputs ESM.","cause":"Using CommonJS require() in an ESM-only package (e.g., Cloudflare Workers).","error":"require is not defined"},{"fix":"Change 'import Spiceflow from \"spiceflow\"' to 'import { Spiceflow } from \"spiceflow\"'.","cause":"Default import used instead of named import.","error":"TypeError: Cannot destructure property 'Spiceflow' of ..."},{"fix":"Install spiceflow: 'npm install spiceflow'. Ensure you import from 'spiceflow' not 'spiceflow/subpath' unless the subpath is documented.","cause":"Missing dependency or incorrect import path when using subpath exports that don't exist.","error":"Module not found: Can't resolve 'spiceflow' in ..."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}