alova
repository·main·Indexed 26 days ago
https://github.com/alovajs/alovaA request strategy layer for JavaScript that sits on top of existing HTTP clients to provide high-level request strategies such as pagination, forms, and uploads. It reduces boilerplate code and supports various UI frameworks including React, Vue, and Svelte. alova features a highly extensible architecture with support for custom request adapters (e.g., Axios, XHR, Taro, UniApp), storage adapters, and state hooks for reactive state management.
What's inside alova
- alova is a high-performance business logic library designed to bridge the gap between backend APIs and frontend code. It is compatible with your preferred HTTP clients and UI frameworks, enabling efficient API integration, request sharing, and response caching. It provides a type-safe environment and advanced OpenAPI solutions to streamline development.
Overview of alova Request Strategy Layer
mainalova is a JavaScript request strategy layer designed to reduce boilerplate code for common request logic. It acts as a layer on top of your existing HTTP client (like
axiosorfetch), providing 20+ out-of-the-box strategies for tasks like pagination, forms, uploads, and SSE.Key Benefits
- Reduces Boilerplate: Can reduce request-related code by up to 70%.
- Framework Agnostic: Use the same API across React, Vue, Svelte, Solid, Mini-programs, and Server-side environments.
- Advanced Strategies: Includes
usePagination,useForm,useUploader, anduseSSE. - Server-side Capabilities: Supports rate limiting and retries (including distributed) via
alova/server. - Caching: Features multi-level caching (L1/L2) with declarative automatic invalidation using
hitSource. - OpenAPI Integration: Works with
wormato generate type-safe code, TypeScript types, and documentation from OpenAPI specifications.
Recommended IDE Setup for Svelte + Vite
mainFor the best development experience when working with Svelte and Vite, use VS Code along with the official Svelte extension.Submit a Pull Request to alova
mainYou can contribute code through Pull Requests in three areas:
- Bug Fixes: Choose from issues labeled
bug:confirmed. - New Features: Choose from issues labeled
feature-request:confirmed. - Project Configuration: Improve automation, configuration completeness, or repository management.
Important Guidelines:
- Read the Development Guide before starting development.
- Check if an issue is already claimed by another Pull Request before starting work.
- Bug Fixes: Choose from issues labeled
Run the Node.js Express template
mainTo start the HTTP server for this Node.js Express template, use the following command. The server will run on
http://localhost:8080.yarn startCompare alova with other request libraries
mainalova is specifically designed for scenarios requiring complex business logic integration rather than just simple data fetching.
When to use alova
- Complex Mid-to-Back-end Systems: Ideal for heavy use of forms, pagination, and file uploads.
- Cross-platform Development: When you need a single API that works across Web, Mini-programs, uni-app, and Taro.
- Server-side Request Governance: When you need rate limiting, retries, or distributed request management.
- OpenAPI Workflows: When you want to transform OpenAPI specs into type-safe code and AI-friendly interface knowledge using
worma.
When to use alternatives (like React Query or SWR)
- Simple CRUD: If your application only requires basic data fetching and simple caching, libraries like React Query or SWR are sufficient.
Propose a new feature for alova
mainTo propose a new feature, ensure your idea aligns with alova's mission (efficient Client-Server data interaction with minimal code) and design philosophy (Method proxy design, lightweight, high extensibility, and universal API design).
Submit your proposal via the New Feature Proposal form.
Contribute to alova documentation
mainYou can improve alova documentation in two ways:
- Correcting or Writing Content: If you find errors (wrong examples, wording, or missing info), you can create a new issue in the documentation repository or submit a Pull Request directly to the documentation repository.
- Translation: If you are proficient in other languages, you can help translate the documentation to expand alova's reach.
Extend alova with custom adapters and strategy libraries
mainalova's high extensibility allows you to build your own libraries. Common extension paths include:
- Custom
statesHook: Implement support for different UI frameworks (e.g.,solid,qwik). Currently,react,vue, andsvelteare supported. - Custom Request Adapters: Enable collaboration with other request schemes like
GraphQLorSSE. - Custom Storage Adapters: Support different environments, such as
react-native. - Custom Request Strategies: Create reusable, high-performance request strategies for specific business scenarios and publish them to npm.
If you build a library based on alova, you can submit your project in this issue to have it featured on the official website.
- Custom
Fix Node.js IPC channel establishment in @alova/psc
mainIn version1.0.0, a fix was applied to resolve an issue where the application was unable to establish an IPC channel in Node.js environments.Fix server retry errors in @alova/psc
mainIn version1.0.0, a fix was implemented to resolve server retry errors and improve CommonJS module referencing.Report a bug in alova
mainIf you encounter a bug, please report it using the appropriate template on GitHub Issues. Ensure the bug is confirmed before submitting a Pull Request to avoid invalid contributions.
Note: For general questions or discussions, please use GitHub Discussions. Issues used for asking questions will be closed immediately.