Skip to content

Latest commit

 

History

History
116 lines (79 loc) · 6.48 KB

File metadata and controls

116 lines (79 loc) · 6.48 KB

Stop building request logic. Start shipping features.
The request strategy layer for JavaScript — cut your request code by up to 70%.

English | 中文 | 日本語

Documentation | Demos

npm build coverage status stars discord wechat tree shaking typescript strategies license

What is alova?

alova (pronounced /əˈləʊva/) is the request strategy layer for JavaScript. You've hand-written pagination, forms, uploads and retries countless times — now just pick one of 20+ ready-made request strategies and cut your request code by up to 70%.

You don't have to throw away the axios or fetch you already know. alova sits right on top of your existing request library and takes over the logic you keep rewriting. One API set spans React, Vue, Svelte, Solid, mini-programs and the server — learn once, use everywhere, so you can focus on business logic on both the client and the server.

Here is a paginated list with prefetch, auto-cache and auto-sync on create/update/delete — about five lines of code:

const todoList = (page, size) =>
  alova.Get('/api/todos', { params: { page, size } });

const { loading, data, page, pageSize, pageCount, total } =
  usePagination(todoList);
// auto pagination · prefetch next page · auto cache sync on create/update/delete

Features

Instead of listing what alova "is", here's what it solves for you:

The boilerplate you're tired of What alova gives you The payoff
Hand-writing pagination, forms, uploads, SSE states usePagination / useForm / useUploader / useSSE Up to 70% less boilerplate
Server-side rate limiting & retries (incl. distributed) alova/server Capabilities React Query / SWR simply don't cover
Rebuilding the same logic for every framework One API set Spans React / Vue / Svelte / Solid / mini-programs
Manually maintaining cache invalidation Multi-level cache (L1/L2) + declarative invalidation via hitSource Cache invalidation is no longer painful
Copy-pasting API info between docs and your editor worma API hints & docs show up right inside your editor

And of course:

  • Easy to use, watch the video to get started in 5 mins.
  • Full compatibility with your favorite HTTP clients and UI frameworks.
  • 20+ high-performance request strategies (business modules) for building faster apps.
  • Request sharing and response cache to improve app performance.
  • End-to-end type safety.
  • Advanced OpenAPI solution worma: from one OpenAPI spec, generate type-safe calling code, TypeScript types, full API docs, and API knowledge for your AI coding assistant.

When should you use alova?

alova is honest about where it shines — and where a simpler tool is enough:

Your situation Recommendation
Simple CRUD + caching React Query / SWR are enough
Complex admin / forms / pagination / uploads ✅ alova is clearly a step ahead
Cross-platform (Web + mini-program / uni-app / Taro) ✅ One API set covers everything
Server-side request governance (rate limit / retry / distributed) ✅ alova is almost the only choice
OpenAPI → type-safe code + AI-friendly API knowledge ✅ Pair with worma (works out of the box with alova)

Not sure alova is right for you? Read When should you NOT use alova? for the honest reverse list before you commit.

Is there any difference?

Unlike libraries such as @tanstack/react-query, swrjs, and ahooks's useRequest, alova aims to make API integration very easy and efficient, while maintaining more efficient data interaction and bringing a smoother experience to users.

For the same paginated list, React Query needs roughly 25 lines while alova's usePagination takes about 5 — see the no-BS comparison.

You can also check Comparison with other request libraries to learn more about the differences of alova.

Join the community

We need your support

If you like alova, we are very grateful for giving us a star in the upper right corner, which is a recognition and encouragement for our work.

Welcome to contribute

We are honored to receive active participation from developers around the world in Issues and Discussions.

We hope to make alova a common project for everyone who is willing to participate. We encourage everyone to become a contributor to the alova community with an open and inclusive attitude. Even if you are a junior developer, as long as your ideas meet the development guidelines of alova, please participate generously.

Effective contributions will win you a certain reputation in the Alova community. Before contributing, please be sure to read the Contribution Guide in detail to ensure your contribution is effective.

Changelog

Link

Contributors

LICENSE

MIT