- Smart Parsing: Automatically detects if the response is JSON or Text (perfect for RSS/XML).
- Multi-Format Support: Added support for
blob,formData, andarrayBuffer. - Query Params: New
paramsoption to handle URL query strings safely. - Enhanced DX: Full JSDoc documentation for better IntelliSense in VS Code.
Venus is a modern, lightweight networking library for JavaScript and TypeScript that makes working with APIs feel effortless.
No bloated configs.
No fragile patterns.
No surprises.
Venus turns network requests into a calm, predictable experience by refining fetch into a clean, type-safe, and resilient API. You focus on your app — Venus handles the edge cases.
- Clean syntax that stays out of your way
- Type-safe by default, from request to response
- Built-in resilience (timeouts, predictable errors)
- Consistent results, no matter how a request fails
- Zero dependencies, powered by native Web APIs
Venus doesn’t try to do everything.
It does one thing exceptionally well:
making network requests simple, elegant, and reliable.
Get up and running with Venus in minutes.
Set your API base URL once at your app’s entry point (e.g. main.ts or index.ts).
import { venusConfig } from "@braydev/venus";
venusConfig.setBaseURL("https://api.yourdomain.com");Venus always returns a predictable response object — no try/catch required.
import { get, send } from "@braydev/venus";
// Fetching data
const { data, ok, error } = await get<User>("/profile");
if (ok) {
console.log(data.name);
} else {
console.error(error);
}
// Sending data
const newUser = { name: "Brayan", role: "Developer" };
const result = await send("/users", newUser);
// --- New in v1.2.0: Powerful Query Params & Smart Parsing ---
// Effortless filtering with the 'params' option
const { data: news } = await get("/latest", {
params: { category: "tech", limit: 5 },
});
/**
* Smart Response Detection:
* Venus automatically detects if 'news' should be a JavaScript Object (JSON)
* or a raw String (RSS/XML/HTML). No extra configuration required.
*/
if (typeof news === "string") {
console.log("RSS/XML content detected:", news);
} else {
console.log("JSON API object detected:", news);
}That’s it. No boilerplate. No guesswork. Just clean network calls.
| Method | Function | Description |
|---|---|---|
get |
get<T>(path, headers?, timeout?) |
Fetch resources with a built-in timeout. |
send |
send<T>(path, body, headers?) |
Create resources (POST) with validated body. |
update |
update<T>(path, body, headers?) |
Replace resources entirely (PUT). |
updateOnly |
updateOnly<T>(path, body, headers?) |
Update resources partially (PATCH). |
remove |
remove<T>(path, headers?) |
Delete resources with 204 handling. |
Venus is fully tested with Vitest.
Run the test suite with:
npm test
MIT © code-braydev