open-index/open-npm huggingface dataset:
npm package: @routes-gen/remix
Description: This package is a [**routes-gen**](https://github.com/sandulat/routes-gen) driver for [Remix](https://github.com/remix-run/remix).
Latest version: 0.3.7

# @routes-gen/remix

This package is a [**routes-gen**](https://github.com/sandulat/routes-gen) driver for [Remix](https://github.com/remix-run/remix).

## Installation

```
yarn add routes-gen @routes-gen/remix
```

## Usage

```
yarn routes-gen -d @routes-gen/remix
```

By default, it exports the routes to: `${appDirectory}/routes.d.ts`.
npm package: @routes-gen/solid-start
Description: This package is a [**routes-gen**](https://github.com/sandulat/routes-gen) driver for [SolidStart](https://github.com/solidjs/solid-start).
Latest version: 0.1.1

# @routes-gen/solid-start

This package is a [**routes-gen**](https://github.com/sandulat/routes-gen) driver for [SolidStart](https://github.com/solidjs/solid-start).

## Installation

```
yarn add routes-gen @routes-gen/solid-start
```

## Usage

```
yarn routes-gen -d @routes-gen/solid-start
```

By default, it exports the routes to: `${appDirectory}/routes.d.ts`.
npm package: @routes/client
Description: 💁‍♂️ Display information about the request and service
Author: omrilotan
Latest version: 0.0.0

# @routes/client <a href="https://www.npmjs.com/package/@routes/client"><img src="https://img.shields.io/npm/v/@routes/client.svg"></a> [![](https://img.shields.io/badge/source--000000.svg?logo=github&style=social)](https://github.com/omrilotan/routes/tree/master/packages/client)

## 💁‍♂️ Display information about the client making the request

Use the query string to request for specific keys

| GET /info?hostname&url&query&headers.accept&headers.user-agent
| -
| ![](https://user-images.githubusercontent.com/516342/57586025-22703080-74f8-11e9-9be6-28d7e22a2f9e.png)

Available keys to get are
- `body`
- `cookies`
- `signedCookies`
- `params`
- `query`
- `originalUrl`
- `baseUrl`
- `url`
- `protocol`
- `secure`
- `ip`
- `ips`
- `subdomains`
- `path`
- `hostname`
- `fresh`
- `stale`
- `xhr`
- `headers.*`

The `headers` sub keys have been fattened (`headers.x`) and may be acquired by asking for `headers`, `headers.*` or specifically: `headers.user-agent` and so forth.
npm package: @routes/health
Description: 💪 health check route
Author: omrilotan
Latest version: 2.0.0

# @routes/health <a href="https://www.npmjs.com/package/@routes/health"><img src="https://img.shields.io/npm/v/@routes/health.svg"></a> [![](https://img.shields.io/badge/source--000000.svg?logo=github&style=social)](https://github.com/omrilotan/routes/tree/master/packages/health)

## 💪 health check route

Pass in a method checking application and/or machine health. If any error occur - the function should throw an error if anything is wrong.

If anything is wrong - the route will return error code (503) and calls the process to fire `SIGTERM`

#### Expose a health route with health check
```js
const health = require('@routes/health');

function healthCheck() {
	if (!db.serverConfig.isConnected()) {
		throw new Error('Database not connected');
	}
}

app.get('/ping', ...);
app.get('/health', health(healthCheck));
...

```

### Arguments

- 1st argument is a function of health check. Should throw an error if anything is wrong. This function can be asynchronous.
- 2nd argument is an options object:

| Name | Type | Default | Meaning
| - | - | - | -
| timeout | Number | 10,000 | The number of milliseconds to wait between test fail and process.exit action
| logger | Object | console | A logger object containing `error` function that can accept an Error object

#### Example with all options
```js
app.get(
	'/health',
	health(
		healthCheck,
		{
			timeout: 4000,
			logger: { error: (error) => send(error) },
		}
	)
);
```
npm package: @routes/index
Description: 📇 An index of routes exposed by Express app
Author: omrilotan
Latest version: 1.2.1

# @routes/index <a href="https://www.npmjs.com/package/@routes/index"><img src="https://img.shields.io/npm/v/@routes/index.svg"></a> [![](https://img.shields.io/badge/source--000000.svg?logo=github&style=social)](https://github.com/omrilotan/routes/tree/master/packages/index)

## 📇 An index of routes exposed by Express app

![](https://user-images.githubusercontent.com/516342/56301442-bafcd600-612f-11e9-9676-6b46cdb610d7.png)

```
const app = express();
const index = require('@routes/index');

...

const filter = (method, path) => {
	if (/patch/i.test(method)) { return false; }
	if (path.endsWith('ping')) { return false; }
	return true;
};
index(app, filter);
```

## Arguments and options

- First argument is an Expressjs app instance.
- Second, optional, argument is a named options object. All options are optional

| Name | Type | Meaning
| - | - | -
| filter | {Function} | Filter routes by method or path
| should | {Function} | For 'route' method, should it display the 404 list page or simply call next middleware

`filter` method accepts two arguments: method (lowercase), and path - respectfully (e.g. :`'get', '/users/:user_id'`)
```js
const filter = (method, path) => path.starsWith('/api');
```

`should` method accepts two arguments: request and response - the express middleware arguments
```js
const should = (request, response) => request.path.startsWith('/api');
```

## Usage

#### Example express app setup
> ```
> const express = require('express');
>
> const app = express();
> app.get('/ping', ...);
> app.get('/users/:user_id', ...);
> app.patch('/users/:user_id', ...);
> app.delete('/users/:user_id', ...);
> app.get('/users', ...);
> app.post('/users', ...);
> ```

#### Get an index of all available routes
```js
const index = require('@routes/index');

index(app);
```

| Example
| -
| ![](https://user-images.githubusercontent.com/516342/56299759-93583e80-612c-11e9-8136-7f6bf66c4cac.png)

#### Get a flat list of routes (no methods) (* de-duped)
```js
const {flat} = index(app);

flat // ['/users', '/users/:user_id']
```

#### Show API consumers an index for 404 message
```js
const {route} = index(
	app,

	// filter paths from the list
	{
		filter: (method, path) => !['/ping', '*'].includes(path),
		should: (request, response) => !request.is('html'),
	}
);
app.all('*', route);
```

| Example
| -
| ![](https://user-images.githubusercontent.com/516342/56300498-fc8c8180-612d-11e9-96e5-51eb3fa1d7a8.png)

Result
```sh
< HTTP/1.1 404 Not Found
< Content-Type: text/plain; charset=utf-8
< Content-Length: 290
< Date: Wed, 17 Apr 2019 21:19:32 GMT
< Connection: keep-alive
<
{ [290 bytes data]
404 error - Could not find route [GET] /missing
Here is a index of available routes:
- [GET] /users
- [POST] /users
- [GET] /users/:user_id
- [PATCH] /users/:user_id
- [DELETE] /users/:user_id
```
npm package: @routes/isbot
Description: 🕷 Express middleware to detect crawler requests: request.isbot
Author: omrilotan
Latest version: 2.0.2

# [@routes/isbot](https://www.npmjs.com/package/@routes/isbot)

## 🕷 Express middleware to detect crawler requests: request.isbot

The middleware adds a getter to the request: `isbot`.

- ✅ Lazy processing: performs the check only if it's actually used
- ✅ Memoisation: Operation result is cached
- ✅ Quick and Simple: Only check if it's a known crawler, does not parse the user agent string to a complex object
- ✅ Customisable bot list

```js
const isbot = require('@routes/isbot');

app.use(isbot);

app.get('/api', (request, response) => {
	if (request.isbot) {
		// do things
	}
	...

	response.sendStatus(200);
});
```

## Customisation
All customisation options from [isbot](https://www.npmjs.com/package/isbot) package are also available here

```js
isbot.exclude(['bot']);
isbot.extend(['(?<! cu)bot']);
```
npm package: @routes/ping
Description: 🏓 out-of-the-box expressjs ping route
Author: omrilotan
Latest version: 1.0.0

# [@routes/ping](https://www.npmjs.com/package/@routes/ping)

## 🏓 out-of-the-box expressjs ping route

```js
const ping = require('@routes/ping');

app.get('/ping', ping);
```

Returns
 - status code: `200`
 - content type: `plain/text`
 - response body: `pong`
npm package: @routeslk/react-native-picker-weekday
Description:  Simple, Customizable Weekday Picker for react native and Expo.
Author: Salik Sayyed
Latest version: 1.1.3

# WeekDay Picker
[checkOutNpmPackageHere](https://www.npmjs.com/package/react-native-picker-weekday)

## Simple Customizable Weekday Picker for react native and Expo.

- _Steps to use_
  - npm i react-native-picker-weekday

```js
import * as React from 'react'
import { DayPicker } from 'react-native-picker-weekday'
const SampleApp = () => {
  const [weekdays, setWeekdays] = React.useState([-1])
  return (
    <DayPicker
      weekdays={weekdays}
      setWeekdays={setWeekdays}
      activeColor='violet'
      textColor='white'
      inactiveColor='grey'
      dayTextStyle = {{/*All styles applicable to text component*/}}  //(optional for high styling flexiblity)
      itemStyles ={{/*All Styles applicable to View component*/}}     //(optional for high styling flexiblity)
      wrapperStyles ={{/*All Styles applicable to View component*/}}  // (optional for high styling flexiblity)  
    />
  )
}
```

- Uses a number[] type React State.
- Simple created by setting initial state to [-1] _dont pick 1-7_
- Pass the state and StateSetter to see the selected components.
- State list intially will have [-1] then state change will contain numbers 1-7 (sunday-saturday) as per selection.

![package](https://user-images.githubusercontent.com/51844798/131120040-f4dde12b-5714-450f-ba41-38f052e5167a.PNG)
npm package: @routex/body-parser
Description: Body parsing for Routex
Author: Charles Crete
Latest version: 0.1.1

# Routex Body Parser [![npm](https://img.shields.io/npm/v/@routex/body-parser.svg)](https://www.npmjs.com/package/@routex/body-parser) [![Travis CI](https://img.shields.io/travis/com/routexjs/routex-body-parser.svg)](https://travis-ci.com/routexjs/routex-body-parser) [![Codecov](https://img.shields.io/codecov/c/github/routexjs/routex-body-parser.svg)](https://codecov.io/gh/routexjs/routex-body-parser)

Body parsing for [Routex](https://www.npmjs.com/package/routex).

[Documentation](https://routex.js.org/docs/packages/body-parser) - [GitHub](https://github.com/routexjs/routex-body-parser)

## Example

Install:

```bash
yarn add @routex/body-parser
# or
npm add @routex/body-parser
```

Setup your app:

```js
const { Routex, JsonBody } = require("routex");
const bodyParser = require("@routex/body-parser");

const port = process.env.PORT || 3000;
const app = new Routex();

app.use(bodyParser.json());

app.get("/", (ctx) => {
  ctx.body = new JsonBody(ctx.req.body);
});

app.listen(port).then(() => console.log(`Listening on ${port}`));
```

The parsed body is available under `ctx.req.body`.

## Support

We support all currently active and maintained [Node LTS versions](https://github.com/nodejs/Release), include current Node versions.

Please file feature requests and bugs at the [issue tracker](https://github.com/routexjs/routex-body-parser/issues).
npm package: @routex/cookies
Description: Cookies for Routex
Author: Charles Crete
Latest version: 0.1.0

# Routex Cookies [![npm](https://img.shields.io/npm/v/@routex/cookies.svg)](https://www.npmjs.com/package/@routex/cookies) [![Travis CI](https://img.shields.io/travis/com/routexjs/routex-cookies.svg)](https://travis-ci.com/routexjs/routex-cookies) [![Codecov](https://img.shields.io/codecov/c/github/routexjs/routex-cookies.svg)](https://codecov.io/gh/routexjs/routex-cookies) [![Greenkeeper badge](https://badges.greenkeeper.io/routexjs/routex-cookies.svg)](https://greenkeeper.io/)

Cookies for [Routex](https://routex.js.org).

[Documentation](https://routex.js.org/docs/packages/cookies) - [GitHub](https://github.com/routexjs/routex-cookies)

## Example

Install:

```bash
yarn add @routex/cookies
# or
npm add @routex/cookies
```

Setup your app:

```js
const { Routex, TextBody } = require("routex");
const cookies = require("@routex/cookies");

const port = process.env.PORT || 3000;
const app = new Routex();

app.use(cookies());

app.get("/", (ctx) => {
  // Get cookie
  const name = ctx.cookies.get("name");

  if (!name) {
    // Set cookie
    ctx.cookies.set("name", "john");
  }

  // Remove cookie
  ctx.cookies.remove("name");

  ctx.body = new TextBody("Set name cookie");
});

app.listen(port).then(() => console.log(`Listening on ${port}`));
```

## Support

We support all currently active and maintained [Node LTS versions](https://github.com/nodejs/Release), include current Node versions.

Please file feature requests and bugs at the [issue tracker](https://github.com/routexjs/routex-cookies/issues).
npm package: @routex/hooks
Description: Hooks for Routex
Author: Charles Crete
Latest version: 0.0.2

# Routex Hooks [![npm](https://img.shields.io/npm/v/@routex/hooks.svg)](https://www.npmjs.com/package/@routex/hooks) [![Travis CI](https://img.shields.io/travis/com/routexjs/routex-hooks.svg)](https://travis-ci.com/routexjs/routex-hooks) [![Codecov](https://img.shields.io/codecov/c/github/routexjs/routex-hooks.svg)](https://codecov.io/gh/routexjs/routex-hooks) [![Greenkeeper badge](https://badges.greenkeeper.io/routexjs/routex-hooks.svg)](https://greenkeeper.io/)

Hooks for [Routex](https://www.npmjs.com/package/routex).

[Documentation](https://routex.js.org/docs/packages/hooks) - [GitHub](https://github.com/routexjs/routex-hooks)

## Example

Install:

```bash
yarn add @routex/hooks
# or
npm add @routex/hooks
```

Setup your app:

```js
const { Routex, TextBody } = require("routex");
const { hooksHandler, useGetParam, useSetBody } = require("@routex/hooks");

const port = process.env.PORT || 3000;
const app = new Routex();

app.get(
  "/:name",
  hooksHandler(() => {
    const name = useGetParam("name");

    useSetBody(new TextBody(name));
  })
);

app.listen(port).then(() => console.log(`Listening on ${port}`));
```

## Support

We support all currently active and maintained [Node LTS versions](https://github.com/nodejs/Release),
include current Node versions.

Please file feature requests and bugs at the [issue tracker](https://github.com/routexjs/routex-hooks/issues).
npm package: @routex/inversify
Description: Inversify decorators for Routex
Author: Charles Crete
Latest version: 0.1.1

# Routex Inversify [![npm](https://img.shields.io/npm/v/@routex/inversify.svg)](https://www.npmjs.com/package/@routex/inversify) [![Travis CI](https://img.shields.io/travis/com/routexjs/routex-inversify.svg)](https://travis-ci.com/routexjs/routex-inversify) [![Codecov](https://img.shields.io/codecov/c/github/routexjs/routex-inversify.svg)](https://codecov.io/gh/routexjs/routex-inversify)

Inversify decorator for [Routex](https://www.npmjs.com/package/routex).

[Documentation](https://routex.js.org/docs/packages/inversify) - [GitHub](https://github.com/routexjs/routex-inversify)

## Example

Install:

```bash
yarn add @routex/inversify
# or
npm add @routex/inversify
```

Setup your app:

```js
import "reflect-metadata";
import { ICtx, TextBody } from "routex";
import {
  RoutexInversifyServer,
  TYPE,
  Get,
  Controller,
} from "@routex/inversify";
import { injectable } from "inversify";

@injectable()
@Controller("/test")
class TestController {
  @Get("/name/:name")
  getName(ctx: ICtx) {
    return new TextBody(ctx.params.name);
  }
}

const container = new Container();

container
  .bind(TYPE.Controller)
  .to(TestController)
  .whenTargetNamed("TestController");

const server = new RoutexInversifyServer(container);

const port = process.env.PORT || 3000;

server
  .build()
  .listen(port)
  .then(() => console.log(`Listening on ${port}`));
```

## Support

We support all currently active and maintained [Node LTS versions](https://github.com/nodejs/Release),
include current Node versions.

Please file feature requests and bugs at the [issue tracker](https://github.com/routexjs/routex-inversify/issues).
npm package: @routex/websocket
Description: WebSockets for Routex
Author: Charles Crete
Latest version: 0.1.0

# Routex WebSocket [![npm](https://img.shields.io/npm/v/@routex/websocket.svg)](https://www.npmjs.com/package/@routex/websocket) [![Travis CI](https://img.shields.io/travis/com/routexjs/routex-websocket.svg)](https://travis-ci.com/routexjs/routex-websocket) [![Codecov](https://img.shields.io/codecov/c/github/routexjs/routex-websocket.svg)](https://codecov.io/gh/routexjs/routex-websocket) [![Greenkeeper badge](https://badges.greenkeeper.io/routexjs/routex-websocket.svg)](https://greenkeeper.io/)

WebSockets for [Routex](https://www.npmjs.com/package/routex).

[Documentation](https://routex.js.org/docs/packages/websocket) - [GitHub](https://github.com/routexjs/routex-websocket)

## Example

Install:

```bash
yarn add @routex/websocket
# or
npm add @routex/websocket
```

Setup your app:

```js
const { Routex, TextBody } = require("routex");
const websocket = require("@routex/websocket");

const port = process.env.PORT || 3000;
const app = new Routex();

app.appMiddleware(websocket());

// Must be a GET request.
app.get(
  "/",
  websocket.socketHandler((socket) => {
    // Echo server
    socket.on("message", (data) => {
      socket.send("You said: " + data);
    });
  })
);

app.listen(port).then(() => console.log(`Listening on ${port}`));
```

## Support

We support all currently active and maintained [Node LTS versions](https://github.com/nodejs/Release),
include current Node versions.

Please file feature requests and bugs at the [issue tracker](https://github.com/routexjs/routex-websocket/issues).
npm package: @routexcc/chain-base
Description: Base chain adapter for Routex
Author: Thalaxis
Latest version: 1.0.4

# @routexcc/chain-base

Base (L2) chain adapter for [Routex](https://github.com/routexcc/routex) — the multi-chain settlement cost router for the x402 payment protocol.

## Install

```bash
npm install @routexcc/core @routexcc/chain-base
```

## Usage

```typescript
import { createBaseAdapter } from '@routexcc/chain-base';
import { createPublicClient, http } from 'viem';
import { base } from 'viem/chains';

const client = createPublicClient({
  chain: base,
  transport: http('https://base-mainnet.g.alchemy.com/v2/YOUR_KEY'),
});

const adapter = createBaseAdapter(client);
// Testnet: createBaseAdapter(client, { testnet: true })
```

## Details

- **Technology**: viem (EVM)
- **Finality**: ~2000ms (L2 block time)
- **Chain IDs**: 8453 (mainnet), 84532 (Sepolia testnet)
- **Signing**: EIP-712 typed data with chain-specific domain separator
- **RPC methods**: `eth_call`, `eth_gasPrice`, `eth_estimateGas`

## Exports

- `createBaseAdapter(client, options?)` — factory function
- `EvmAdapter` — shared EVM base class (also used by `@routexcc/chain-polygon`)

## Non-Custodial

The adapter calls `signer.sign()` or `signer.signTypedData()` to construct payment payloads. It never accesses `.privateKey`, `.secretKey`, or `.mnemonic`.

## Documentation

See the [full documentation](https://github.com/routexcc/routex) for routing strategies, configuration, and security model.

## License

MIT
npm package: @routexcc/chain-polygon
Description: Polygon chain adapter for Routex
Author: Thalaxis
Latest version: 1.0.4

# @routexcc/chain-polygon

Polygon chain adapter for [Routex](https://github.com/routexcc/routex) — the multi-chain settlement cost router for the x402 payment protocol.

## Install

```bash
npm install @routexcc/core @routexcc/chain-polygon
```

## Usage

```typescript
import { createPolygonAdapter } from '@routexcc/chain-polygon';
import { createPublicClient, http } from 'viem';
import { polygon } from 'viem/chains';

const client = createPublicClient({
  chain: polygon,
  transport: http('https://polygon-mainnet.g.alchemy.com/v2/YOUR_KEY'),
});

const adapter = createPolygonAdapter(client);
```

## Details

- **Technology**: viem (EVM), shares `EvmAdapter` base class with `@routexcc/chain-base`
- **Finality**: ~2000ms
- **Chain IDs**: 137 (mainnet), 80002 (Amoy testnet)
- **Signing**: EIP-712 typed data with chain-specific domain separator

## Exports

- `createPolygonAdapter(client, options?)` — factory function
- Re-exports `EvmAdapter` from `@routexcc/chain-base`

## Non-Custodial

The adapter calls `signer.sign()` or `signer.signTypedData()` to construct payment payloads. It never accesses `.privateKey`, `.secretKey`, or `.mnemonic`.

## Documentation

See the [full documentation](https://github.com/routexcc/routex) for routing strategies, configuration, and security model.

## License

MIT
npm package: @routexcc/chain-solana
Description: Solana chain adapter for Routex
Author: Thalaxis
Latest version: 1.0.4

# @routexcc/chain-solana

Solana chain adapter for [Routex](https://github.com/routexcc/routex) — the multi-chain settlement cost router for the x402 payment protocol.

## Install

```bash
npm install @routexcc/core @routexcc/chain-solana
```

## Usage

```typescript
import { createSolanaAdapter } from '@routexcc/chain-solana';

const adapter = createSolanaAdapter(solanaRpcClient, {
  usdcMint: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
});
```

## Details

- **Technology**: @solana/web3.js
- **Finality**: ~400ms (slot time)
- **Token**: USDC as SPL token
- **RPC methods**: `getTokenAccountBalance`, `getTokenAccountsByOwner`, `getRecentPrioritizationFees`

Fee estimation uses base fee (5000 lamports) plus median prioritization fee.

## Exports

- `createSolanaAdapter(rpcClient, options)` — factory function
- `SolanaAdapter` — adapter class

## Non-Custodial

The adapter calls `signer.sign()` to construct payment payloads. It never accesses `.privateKey`, `.secretKey`, or `.mnemonic`.

## Documentation

See the [full documentation](https://github.com/routexcc/routex) for routing strategies, configuration, and security model.

## License

MIT
npm package: @routexcc/chain-stellar
Description: Stellar chain adapter for Routex
Author: Thalaxis
Latest version: 1.0.4

# @routexcc/chain-stellar

Stellar chain adapter for [Routex](https://github.com/routexcc/routex) — the multi-chain settlement cost router for the x402 payment protocol.

## Install

```bash
npm install @routexcc/core @routexcc/chain-stellar
```

## Usage

```typescript
import { createStellarAdapter } from '@routexcc/chain-stellar';

const adapter = createStellarAdapter(stellarRpcClient, {
  usdcIssuer: 'GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN',
});
```

## Details

- **Technology**: @stellar/stellar-sdk
- **Finality**: ~5000ms (consensus round)
- **Token**: USDC via trustline
- **RPC**: Horizon API (account balances, fee stats) + Stellar RPC (transaction submission)

Stellar uses 7-decimal precision internally; the adapter converts to 6-decimal USDC precision.

## Exports

- `createStellarAdapter(rpcClient, options)` — factory function
- `StellarAdapter` — adapter class

## Non-Custodial

The adapter calls `signer.sign()` to construct payment payloads. It never accesses `.privateKey`, `.secretKey`, or `.mnemonic`.

## Documentation

See the [full documentation](https://github.com/routexcc/routex) for routing strategies, configuration, and security model.

## License

MIT
npm package: @routexcc/x402
Description: x402 middleware wrapper for Routex
Author: Thalaxis
Latest version: 1.0.4

# @routexcc/x402

x402 payment protocol middleware for [Routex](https://github.com/routexcc/routex) — the multi-chain settlement cost router.

## Install

```bash
npm install @routexcc/core @routexcc/x402
```

## Usage

Intercept `402 Payment Required` responses and route payments automatically:

```typescript
import { routexMiddleware } from '@routexcc/x402';

const middleware = routexMiddleware({
  routeConfig: {
    adapters,
    feeOracle,
    strategy: 'cheapest',
    maxFeeAgeMs: 60_000,
  },
  signer: mySigner,
  onRouteSelected: (result) => console.log(`Paying via ${result.chainId}`),
  onRouteFailed: (error) => console.error('Routing failed:', error),
});

// When you get a 402 response:
const parsed = middleware.parseResponse(402, responseBody);
if (parsed) {
  const { payload, chainId } = await middleware.handlePaymentRequired(parsed);
  // payload is ready to submit to the facilitator
}
```

## Exports

- `routexMiddleware(config)` — create a middleware instance
- `RoutexMiddleware` — middleware interface with `handlePaymentRequired()` and `parseResponse()`
- `RoutexMiddlewareConfig`, `ParsedX402Response`, `MiddlewareResult` — types

## Documentation

See the [full documentation](https://github.com/routexcc/routex) for routing strategies, configuration, and security model.

## License

MIT
npm package: @routier/core
Description: Core functionality for routier
Author: James DeMeuse
Latest version: 0.2.1

# Routier

<p align="center">
  <img src="docs/assets/routier.svg" alt="Routier" width="140" height="140" />
</p>

> **⚠️ Release Candidate** - This project is currently a release candidate. APIs may change between versions. Use with caution in production.

A reactive data toolkit for building fast, local-first apps. Define schemas, create collections, use live queries, and make optimistic mutations with a plugin model for any storage.

**[📖 View Full Documentation](https://routier.dev/)** - Complete guides, API reference, and tutorials

## Features

- **Schema-first**: Type-safe entity definitions with indexes and modifiers
- **Live queries**: Reactive queries across one or more collections
- **Optimistic mutations**: Instant UI updates with automatic rollback
- **Pluggable storage**: Memory, Local Storage, Dexie, SQLite, PouchDB, File System, and more
- **Change tracking**: Automatic tracking of entity modifications
- **Performance**: Database-backed filters when possible, in-memory for computed properties

## Quick Start

```bash
npm install @routier/core @routier/datastore @routier/memory-plugin
```

```ts
import { DataStore } from "@routier/datastore";
import { MemoryPlugin } from "@routier/memory-plugin";
import { s } from "@routier/core/schema";

// Define a schema
const userSchema = s
  .define("users", {
    id: s.string().key().identity(),
    name: s.string(),
    email: s.string().distinct(),
  })
  .compile();

// Create a datastore with a plugin
class AppContext extends DataStore {
  constructor() {
    super(new MemoryPlugin("routier-app"));
  }
  users = this.collection(userSchema).create();
}

const ctx = new AppContext();

// Add data
await ctx.users.addAsync({ name: "Ada", email: "ada@example.com" });
await ctx.saveChangesAsync();

// Query with live updates
ctx.users
  .subscribe()
  .where((u) => u.name.startsWith("A"))
  .toArray((result) => {
    console.log("Live query result:", result);
  });
```

## Why Routier?

Choosing storage for local-first apps is hard—and the landscape moves fast. Routier separates your domain model from persistence through a small plugin interface:

- **Swap storage backends** without changing schemas, queries, or UI
- **Use any framework/ORM/data store** you want via plugins
- **Experiment safely**: try a new store by writing a plugin
- **Fill ORM gaps**: feature-rich and easily extended

## Built-in Plugins

- **Memory**: In-memory storage for development and testing
- **Local Storage**: Browser localStorage/sessionStorage
- **Dexie**: IndexedDB with Dexie.js
- **PouchDB**: CouchDB sync and replication
- **SQLite**: Node.js SQLite integration
- **File System**: Node.js file-based storage

## Contributing

Issues and PRs welcome! Please see our [Contributing Guide](docs/CONTRIBUTING.md) or open an issue to discuss changes.

## License

MIT
npm package: @routier/datastore
Description: Data abstraction layer that routes all database operations to any ORM or data store
Author: James DeMeuse
Latest version: 0.2.1

# Routier

<p align="center">
  <img src="docs/assets/routier.svg" alt="Routier" width="140" height="140" />
</p>

> **⚠️ Release Candidate** - This project is currently a release candidate. APIs may change between versions. Use with caution in production.

A reactive data toolkit for building fast, local-first apps. Define schemas, create collections, use live queries, and make optimistic mutations with a plugin model for any storage.

**[📖 View Full Documentation](https://routier.dev/)** - Complete guides, API reference, and tutorials

## Features

- **Schema-first**: Type-safe entity definitions with indexes and modifiers
- **Live queries**: Reactive queries across one or more collections
- **Optimistic mutations**: Instant UI updates with automatic rollback
- **Pluggable storage**: Memory, Local Storage, Dexie, SQLite, PouchDB, File System, and more
- **Change tracking**: Automatic tracking of entity modifications
- **Performance**: Database-backed filters when possible, in-memory for computed properties

## Quick Start

```bash
npm install @routier/core @routier/datastore @routier/memory-plugin
```

```ts
import { DataStore } from "@routier/datastore";
import { MemoryPlugin } from "@routier/memory-plugin";
import { s } from "@routier/core/schema";

// Define a schema
const userSchema = s
  .define("users", {
    id: s.string().key().identity(),
    name: s.string(),
    email: s.string().distinct(),
  })
  .compile();

// Create a datastore with a plugin
class AppContext extends DataStore {
  constructor() {
    super(new MemoryPlugin("routier-app"));
  }
  users = this.collection(userSchema).create();
}

const ctx = new AppContext();

// Add data
await ctx.users.addAsync({ name: "Ada", email: "ada@example.com" });
await ctx.saveChangesAsync();

// Query with live updates
ctx.users
  .subscribe()
  .where((u) => u.name.startsWith("A"))
  .toArray((result) => {
    console.log("Live query result:", result);
  });
```

## Why Routier?

Choosing storage for local-first apps is hard—and the landscape moves fast. Routier separates your domain model from persistence through a small plugin interface:

- **Swap storage backends** without changing schemas, queries, or UI
- **Use any framework/ORM/data store** you want via plugins
- **Experiment safely**: try a new store by writing a plugin
- **Fill ORM gaps**: feature-rich and easily extended

## Built-in Plugins

- **Memory**: In-memory storage for development and testing
- **Local Storage**: Browser localStorage/sessionStorage
- **Dexie**: IndexedDB with Dexie.js
- **PouchDB**: CouchDB sync and replication
- **SQLite**: Node.js SQLite integration
- **File System**: Node.js file-based storage

## Contributing

Issues and PRs welcome! Please see our [Contributing Guide](docs/CONTRIBUTING.md) or open an issue to discuss changes.

## License

MIT