
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.
tanstack-setup
Advanced tools
A CLI tool to scaffold API call setups for React projects using Axios and Tanstack Query. It generates a modular src/ directory structure with API configurations, an Axios instance, React Query hooks, and utility functions for local storage and query string building.
npx tanstack-setup init
Enter your API base URL, handle existing directories/files, and the CLI sets up everything automatically.
src/ with subdirectories (config/, hooks/, utils/).buildQueryString, getItem, setItem, and more.axios, @tanstack/react-query, sonner, and js-cookie.npx tanstack-setup init
No global install needed. Works in any Node.js project (Node 16+ recommended).
Run CLI:
npx tanstack-setup init
Enter API Base URL:
Example: https://api.example.com/v1.
Handle Existing Files/Directories:
Review Output: CLI creates the src/ structure and installs dependencies.
src/
├── config/
│ ├── api/
│ │ └── api.ts
│ └── instance/
│ └── instance.ts
├── hooks/
│ ├── useFetchData.ts
│ ├── usePostData.ts
│ ├── usePutData.ts
│ ├── usePatchData.ts
│ └── useDeleteData.ts
├── utils/
│ └── storage.ts
import useFetchData from '@/hooks/useFetchData';
import API from '@/config/api';
const UserList = () => {
const { data, isLoading, error } = useFetchData({
url: API.auth.login,
params: { role: 'admin' },
});
if (isLoading) return <div>Loading...</div>;
if (error) return <div>Error: {error.message}</div>;
return (
<ul>
{data?.map((user) => (
<li key={user.id}>{user.name}</li>
))}
</ul>
);
};
export default UserList;
src/types/index.tsexport enum StorageEnum {
Token = 'token',
}
export interface Result {
statusCode: number;
error: boolean;
message?: string;
data?: any;
}
useToast (Example with react-toastify)import { toast as toastify } from 'react-toastify';
export const useToast = () => ({
toast: ({ title, description, variant }) => {
toastify(description, { type: variant === 'destructive' ? 'error' : 'success' });
},
});
src/constants/data.tsexport const BASIC_AUTH_CREDENTIALS = {
username: 'your-username',
password: 'your-password',
};
Installed automatically:
axios@tanstack/react-querysonnerjs-cookieIf not, run:
npm install axios @tanstack/react-query sonner js-cookie
v is not defined: Fixed in v1.0.4.StorageEnum, Result, useToast, BASIC_AUTH_CREDENTIALS.Contributions welcome!
git clone https://github.com/pavandeepkumar/api-setup
cd api-setup
git checkout -b feature/my-feature
Push and open a pull request.
MIT License
Author: Pavandeep
Email: pavandeepkumarmlk@gmail.com
GitHub: pavandeepkumar
npm: tanstack-setup
FAQs
CLI tool to scaffold API call setup with Axios and Tanstack Query
We found that tanstack-setup 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.