flue-eve

Frontend only

If the Eve-compatible HTTP server already exists, install only the browser-side package and point it at that origin. You do not need the Vite plugin unless you want import aliases or local proxying.

Client SDK

npm install flue-eve
import { Client } from 'flue-eve/client'

const client = new Client({
  host: 'https://your-server.com',
})

const session = client.session()
const response = await session.send('Hello!')

for await (const event of response) {
  console.log(event.type)
}

host is the origin that serves /eve/v1/*. Do not include /eve/v1 in the host; the client appends the Eve route paths itself.

React hook

import { useEveAgent } from 'flue-eve/react'

const agent = useEveAgent({
  host: 'https://your-server.com',
})

Persist the session cursor when you want reload recovery:

import { createEveSessionPersistence, useEveAgent } from 'flue-eve/react'

const persistence = createEveSessionPersistence({ storage: localStorage })

const agent = useEveAgent({
  ...persistence,
  host: 'https://your-server.com',
})

Authentication

For production, pass bearer or basic auth. Function values are resolved before each request and reconnect:

const client = new Client({
  host: 'https://your-server.com',
  auth: {
    bearer: async () => await getAccessToken(),
  },
})

The React hook accepts the same auth and headers options.

Vite alias

The Vite plugin can alias eve/client to flue-eve/client and eve/react to flue-eve/react for migration projects. Without the plugin, import the flue-eve/* entrypoints explicitly.

See deployment for production setup.