spiceflow
type safe API and React Server Components framework for Node, Bun, and Cloudflare
Spiceflow is a type-safe API framework and full-stack React RSC framework focused on absolute simplicity. It works across all JavaScript runtimes: Node.js, Bun, and Cloudflare Workers. Read the source code on [GitHub](https://github.com/remorses/spiceflow).
## Features
- Full-stack React framework with React Server Components (RSC), server actions, layouts, and automatic client code splitting
- Works everywhere: Node.js, Bun, and Cloudflare Workers with the same code
- Type safe schema based validation via Zod
- Type safe fetch client with full inference on path params, query, body, and response
- Simple and intuitive API using web standard Request and Response
- Can easily generate OpenAPI spec based on your routes
- Support for [Model Context Protocol](https://modelcontextprotocol.io/) to easily wire your app with LLMs
- Supports async generators for streaming via server sent events
- Modular design with `.use()` for mounting sub-apps
- Built-in [OpenTelemetry](https://opentelemetry.io/) tracing with zero overhead when disabled
## Installation
```bash
npm install spiceflow@rsc
```
> [!IMPORTANT]
> Spiceflow is still in pre-release. Install with `spiceflow@rsc`, not `spiceflow@latest`.
## AI Agents
To let your AI coding agent know how to use spiceflow, run:
```bash
npx -y skills add remorses/spiceflow
```
## Basic Usage
API routes return JSON automatically. React pages use `.page()` and `.layout()` for server-rendered UI with client interactivity:
```tsx
import { Spiceflow } from 'spiceflow'
import { Counter } from './counter'
export const app = new Spiceflow()
.get('/api/hello', () => {
return { message: 'Hello, World!' }
})
.layout('/*', async ({ children }) => {
return (
{children}
)
})
.page('/', async () => {
return (