
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
A tiny factory function to create a Zustand store with Feathers.js integration for API calls.
A tiny factory function to create a Zustand store with Feathers.js integration for API calls.
npm install zustand feathers axios zfstore
//lib/stores.js
import { storeFactory } from 'zfstore';
// Create store with default Feathers app and URL
export const useApiStore = storeFactory();
// Or with custom configuration
import app from './app.js'
export const useCustomStore = storeFactory(app, 'https://api.example.com'); //make sure CORS is enabled for third party APIs.
In your react component:
// components/MyComponent.jsx
import { useApiStore } from './lib/stores.js';
export default function MyComponent() {
//service name variable is automatically added.
const { loading, error, api, todos } = useApiStore();
const fetchData = () => {
//service name, service method, optional args as required by your feathers service API.
api('todos', 'find', { query: { completed: false } });
//or
//let id = 1;
//api('todos', 'get', 1);
//let data = { title: "some todo" }
//api('todos', 'create', data);
//api('todos', 'update', id, {completed: true});
//api('todos', 'patch', id, {completed: true});
//api('todos', 'remove', id);
};
useEffect(() => {
//no need to add async :')
api('todos', 'find', { query: { completed: false } });
}, [])
if (loading) return <div>Loading...</div>;
if (error) return <div>Error: {error}</div>;
return (
<div>
<button onClick={fetchData}>Reload Todos</button>
<ul>
{todos?.data.map(todo => (
<li key={todo.id}>{todo.text}</li>
))}
</ul>
</div>
);
}
The store's state will contain a variable with the name of the service that you called. So here, todos will be available, and updated when new calls are made from the client.
interface StoreState {
loading: boolean;
error: string | null;
[service: string]: any; // Service data
}
const store = useMyStore();
// Example API call
store.api('todos', 'find', { query: { completed: false } });
FAQs
A tiny factory function to create a Zustand store with Feathers.js integration for API calls.
We found that zfstore 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.