@shivaniwalunj/api-forge
v1.0.2
Published
Generate type-safe API integration code from cURL, Swagger/OpenAPI, and JSON samples. Healthcare-aware with HIPAA/GDPR compliance.
Downloads
345
Maintainers
Readme
How to Use api-forge|
npm i @shivaniwalunj/api-forge
Recommended: Use with Claude Code (simplest)
One-time setup
cd /path/to/your-project
npx @shivaniwalunj/api-forge initThis copies CLAUDE.md into your project, which teaches Claude Code how to analyze your codebase and generate API integration code that matches your existing patterns.
Usage
Open Claude Code in your project and just say:
Generate API integration for:
curl -X POST 'https://api.example.com/tasks/123/sync' \
-H 'Authorization: Bearer token' \
-H 'Tenant-Header: demo'Claude will:
- Parse the cURL command
- Scan your codebase to detect your HTTP client (axios/fetch), data-fetching library (React Query/SWR/Redux Saga), auth pattern, file structure, and naming conventions
- Generate a service file + hook file that match your existing code exactly
Example Prompts
| What you want | What to say |
| ------------------------- | ------------------------------------------------------------------------------------------------ |
| Integrate a POST endpoint | Generate API for: curl -X POST 'https://api.example.com/users' -d '{"name":"John"}' |
| Integrate a GET endpoint | Generate API for: curl -X GET 'https://api.example.com/patients/123/appointments?page=1' |
| Integrate from Swagger | Generate API integration for all endpoints in ./openapi.json tagged "patients" |
| Just the service, no hook | Generate only the API service function for: curl -X DELETE 'https://api.example.com/tasks/456' |
Works with any stack
Claude auto-detects your project's patterns:
| Your stack | What gets generated |
| --------------------------- | -------------------------------------------------- |
| React + Axios + React Query | Axios service file + useQuery/useMutation hook |
| React + Fetch + SWR | Fetch service file + useSWR hook |
| React + Axios + Redux Saga | Axios service file + saga worker/watcher |
| Vue + Axios | Axios service file + Vue composable |
| Next.js + Fetch | Fetch service file + custom hook or server action |
| Any + no data lib | Service file + plain async function |
Alternative: CLI Commands (for CI/CD or scripting)
Setup
# Build the project
cd /path/to/api-forge
npm install && npm run build
# Link globally (optional, for shorter commands)
npm linkCommands
# Initialize config in your project
api-forge init --preset zenara-tenant
# Parse a cURL (preview only, no files written)
api-forge parse --from-curl 'curl -X GET "https://api.example.com/patients/123"'
# Generate code from cURL
api-forge generate --from-curl 'curl -X POST "https://api.example.com/tasks" -d "{}"'
# Generate from Swagger/OpenAPI
api-forge generate --from-swagger ./openapi.json --tag patients
# Preview without writing files
api-forge generate --from-curl '...' --dry-run
# Overwrite existing files
api-forge generate --from-curl '...' --forceCLI Options
| Option | Description |
| ----------------- | ----------------------------------------------------------------- |
| --preset <name> | Use a preset: zenara-tenant, nextjs-app, express, minimal |
| --dry-run | Preview without writing files |
| --force | Overwrite existing files |
| --tag <tags> | Filter Swagger endpoints by tag |
| --skip-hooks | Skip hook generation |
| --skip-types | Skip type generation |
| --no-claude | Skip copying CLAUDE.md during init |
