
Security News
Socket Security Analysis Is Now One Click Away on npm
npm now links to Socket's security analysis on every package page. Here's what you'll find when you click through.
Effortless realtime data management for React + Feathers applications. Used in Humaans.
$ npm install figbird
import React from 'react'
import feathers from '@feathersjs/client'
import io from 'socket.io-client'
import {
FigbirdProvider,
Figbird,
FeathersAdapter,
createSchema,
service,
createHooks,
} from 'figbird'
// 1) Define domain types and services
interface Note { id: string; content: string; tag?: string }
interface Task { id: string; title: string; completed: boolean }
interface NoteService { item: Note }
interface TaskService { item: Task; query?: { completed?: boolean } }
const schema = createSchema({
services: {
notes: service<NoteService>(),
tasks: service<TaskService>(),
},
})
// 2) Create Feathers client + Figbird
const client = feathers()
client.configure(feathers.socketio(io('http://localhost:3030')))
const adapter = new FeathersAdapter(client)
const figbird = new Figbird({ adapter, schema })
const { useFind, useGet, useMutation, useFeathers } = createHooks(figbird)
// 3) Use typed hooks
function Notes() {
const { data, meta, status } = useFind('notes', { query: { tag: 'ideas', $limit: 10 } })
if (status === 'loading') return <>Loading…</>
return <div>Showing {data?.length ?? 0} notes (total {meta.total})</div>
}
function TaskDetails({ id }: { id: string }) {
// useGet returns only the item (no meta by default)
const { data } = useGet('tasks', id)
return <div>{data?.title}</div>
}
function NewTaskButton() {
const { create } = useMutation('tasks')
return (
<button onClick={() => create({ title: 'New task', completed: false })}>
Add Task
</button>
)
}
export default function App() {
return (
<FigbirdProvider figbird={figbird}>
<Notes />
<TaskDetails id="123" />
<NewTaskButton />
</FigbirdProvider>
)
}
Fetch some data with const { data } = useFind('notes') and your components will re-render in realtime as the data changes upstream. Modify the data using const { patch } = useMutation('notes') and the updates will be instantly propagated to all components referencing the same objects.
useGetuseFinduseMutationWorks with Feathers realtime events and with local data mutations. Once a record is created/modified/removed, all queries referencing this record get updated. For example, if your data is fetched using useFind('notes', { query: { tag: 'ideas' } }) and you then patch some note with patch({ tag: 'ideas' }), the query will update immediately and re-render all components referencing that query. Adjust behavior per query:
merge - merge realtime events into cached queries as they come (default)refetch - refetch data for this query from the server when a realtime event is receiveddisabled - ignore realtime events for this queryFetch policies allow you to fine tune Figbird to your requirements. With the default swr (stale-while-revalidate) Figbird uses cached data when possible for maximum responsiveness, but refetches in the background on mount to make sure data is up to date. Other policies include cache-first, which will use cache and not refresh from the server (compatible with realtime), and network-only, which always fetches from the network.
swr - show cached data if possible and refetch in the background (default)cache-first - show cached data if possible and avoid fetching if data is therenetwork-only - always refetch data on mountVisit the documentation site for full API reference.
FAQs
Effortless realtime data management for React + Feathers applications.
The npm package figbird receives a total of 254 weekly downloads. As such, figbird popularity was classified as not popular.
We found that figbird demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
npm now links to Socket's security analysis on every package page. Here's what you'll find when you click through.

Security News
A compromised npm publish token was used to push a malicious postinstall script in cline@2.3.0, affecting the popular AI coding agent CLI with 90k weekly downloads.

Product
Socket is now scanning AI agent skills across multiple languages and ecosystems, detecting malicious behavior before developers install, starting with skills.sh's 60,000+ skills.