open-index/open-npm huggingface dataset:
npm package: @redux-ai/express
Description: Express.js adapter for Redux AI toolkit, providing minimal and focused request handling functionality.
Latest version: 2.4.0

# @redux-ai/express

Express.js adapter for Redux AI toolkit, providing minimal and focused request handling functionality.

## Features

- Lightweight Express.js adapter implementation
- Core request handler creation
- Framework-agnostic AI query processing
- Clean separation of concerns

## Installation

```bash
# Using pnpm (recommended)
pnpm add @redux-ai/express

# Or using npm
npm install @redux-ai/express
```

## Usage

The Express adapter provides a minimal interface for integrating Redux AI with Express.js applications:

```typescript
import { ExpressAdapter } from '@redux-ai/express';
import { createRuntime } from '@redux-ai/runtime';

// Create runtime instance
const runtime = createRuntime({
  provider: yourProvider,
});

// Create adapter and handler
const adapter = new ExpressAdapter();
const handler = adapter.createHandler({ runtime });

// Basic route setup
app.post('/api/query', handler);
```

### Error Handling

The adapter provides standardized error handling through the runtime:

```typescript
try {
  await handler(req, res);
} catch (error) {
  // Error response will be handled by the adapter
  console.error('Error:', error);
}
```

## Application-level Concerns

The adapter focuses solely on request handling. For application-specific concerns like:

- Request validation
- API key verification
- Request/response logging
- Rate limiting
- Authentication

These should be implemented at the application level using standard Express middleware. See the server demo in the repository for reference implementations.

## API Reference

### `ExpressAdapter`

Extends the base adapter from `@redux-ai/runtime`:

```typescript
class ExpressAdapter extends BaseAdapter {
  createHandler(config: RuntimeAdapterConfig): RequestHandler;
}
```

## Testing

```bash
# Run tests
pnpm test

# Run tests with coverage
pnpm test:coverage
```

## Contributing

Please read our [Contributing Guide](../../CONTRIBUTING.md) for details on our code of conduct and development process.

## License

MIT
npm package: @redux-ai/nextjs
Description: Next.js adapter for Redux AI toolkit, providing server-side rendering support and optimized integration.
Latest version: 2.4.0

# @redux-ai/nextjs

Next.js adapter for Redux AI toolkit, providing server-side rendering support and optimized integration.

## Features

- Next.js adapter implementation
- Server-side rendering (SSR) support
- API route handlers
- Edge runtime compatibility
- Streaming SSR support
- Type-safe page props

## Installation

```bash
# Using pnpm (recommended)
pnpm add @redux-ai/nextjs

# Or using npm
npm install @redux-ai/nextjs
```

## Usage

### API Routes

```typescript
import { NextjsAdapter } from '@redux-ai/nextjs';
import type { NextApiRequest, NextApiResponse } from 'next';

export default function handler(req: NextApiRequest, res: NextApiResponse) {
  const adapter = new NextjsAdapter();
  const handler = adapter.createHandler({
    runtime,
    endpoint: '/api/query',
  });

  return handler(req, res);
}
```

### Edge Runtime

```typescript
import { NextjsAdapter } from '@redux-ai/nextjs';

export const config = {
  runtime: 'edge',
};

export default function handler(req) {
  const adapter = new NextjsAdapter();
  const handler = adapter.createHandler({ runtime });

  return handler(req);
}
```

## API Reference

### `NextjsAdapter`

Extends the base adapter from `@redux-ai/runtime`:

```typescript
class NextjsAdapter extends BaseAdapter {
  createHandler(config: RuntimeAdapterConfig): NextApiHandler;
}
```

### Configuration

```typescript
interface RuntimeAdapterConfig {
  runtime: Runtime;
  endpoint?: string;
}
```

## Error Handling

The adapter provides standardized error handling:

```typescript
try {
  await handler(req, res);
} catch (error) {
  // Error response will be handled by the adapter
  console.error('Error:', error);
}
```

## Testing

```bash
# Run tests
pnpm test

# Run tests with coverage
pnpm test:coverage
```

## Contributing

Please read our [Contributing Guide](../../CONTRIBUTING.md) for details on our code of conduct and development process.

## License

MIT