Registry / devops / chowbea-axios

chowbea-axios

JSON →
library2.1.2jsnpmunverified

Type-safe Axios client generator from OpenAPI specs, v2.1.2. Actively maintained with monthly releases. Distinguishes itself by providing a zero-config CLI with interactive TUI, result-based error handling (no try/catch), watch mode for auto-regeneration, and CI-friendly non-interactive mode. Generates fully typed API clients with autocomplete for endpoints, parameters, and responses. Requires Node >=20 and Vite >=5 as a peer dependency.

npm install chowbea-axios
INSTALL
IMPORT
SIG · CHOWBEA-AXIOS
C
chowbea-axios
devopsjavascriptv2.1.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

api
import { api } from './src/api/api.client'
import api from './src/api/api.client'
Default export does not exist; use named import 'api'
ApiClient
import { ApiClient } from './src/api/api.client'
import { apiClient } from './src/api/api.client'
Exported as PascalCase 'ApiClient', not camelCase
operations
import { operations } from './src/api/_generated/api.operations'
import { op } from './src/api/api.client'
Operations are in the generated file, not in api.client

Initializes chowbea-axios, generates client from OpenAPI spec, and demonstrates type-safe API calls with result-based error handling.

// Step 1: Initialize the project (interactive) // npx chowbea-axios init // Step 2: Fetch spec and generate client // npx chowbea-axios fetch // Step 3: Use the generated client import { api } from './src/api/api.client'; // GET /users/{id} const { data, error } = await api.op.getUserById({ id: '123' }); if (error) { console.error(error.message); return; } console.log(data.name); // Fully typed // POST /users (with body) const newUser = await api.op.createUser({ body: { name: 'Alice', email: 'alice@example.com' } });
Debug
Known issues
breakingGenerated files in src/api/_generated/ are overwritten on each generate/fetch. Do not edit them manually.
fix
Edits should be made to src/api/api.client.ts, api.instance.ts, api.error.ts, or api.helpers.ts only.
affects: >=1.0.0
deprecatedThe 'init' command with no flags will become interactive-only in v3. Use --non-interactive for CI.
fix
Add --non-interactive flag (e.g., npx chowbea-axios init --non-interactive)
affects: >=2.0.0 <3.0.0
gotchaOpenAPI spec must not exceed 10 MB in size, or fetch/generation may fail with memory errors.
fix
Split spec or use file reference with $ref.
affects: >=1.0.0
gotchaRequires Node.js version >=20.0.0. Older versions cause cryptic syntax errors.
fix
Upgrade Node.js to version 20 or later.
affects: >=1.0.0
deprecatedThe 'watch' command will be removed in v3 in favor of Vite plugin auto-watch.
fix
Use the Vite plugin or run 'chowbea-axios watch' with explicit file path.
affects: >=2.0.0 <3.0.0
Errors
Common errors & fixes
Error: Cannot find module './src/api/_generated/api.operations'
Generated files missing because fetch/generate was not run after init.
fix
Run 'npx chowbea-axios fetch' to generate the client.
TypeError: api.op.getUserById is not a function
Incorrect import; 'api.op' is undefined if import is default instead of named.
fix
Use 'import { api } from './src/api/api.client'' (named import).
Error: Spec validation failed: missing operationId
OpenAPI spec missing required operationId in one or more paths.
fix
Add operationId to all operations in the OpenAPI spec.
FetchError: request to http://... failed, reason: self-signed certificate
OpenAPI spec served over HTTPS with self-signed certificate.
fix
Use '--ignore-ssl-errors' flag or configure NODE_TLS_REJECT_UNAUTHORIZED=0 in environment.
Upgrade
Version history
2.1.2latest on npm
Audit
Dependencies
viteoptionalPeer dependency required for Vite plugin integration and codegen during build
Agent activity
13 hits · last 30 days
node
12
Amazon
1
Resources
chowbea-axios — npm install chowbea-axios · libregistry