Skip to main content
Scenario-first architecture · 01

The unit of a request isn’t a call, it’s a scenario.

alova distills every kind of request scenario into four stages and encapsulates them as request strategy functions. Request completeness no longer depends on the engineer or the AI prompt, but is pre-orchestrated by the strategy for that specific scenario.

Pagination.ts
Handwritten· 伪 JS · 框架无关
1let keyword = '';Trigger
2let page = 1;Trigger
3let data = [], total = 0;Application
4let loading = false;Application
5const cache = new Map();Decision
6
7on(keywordInput, 'input', () => {Trigger
8 debounce(() => {Trigger
9 keyword = getValue();Trigger
10 page = 1;Trigger
11 fetchPage();Trigger
12 }, 300);Trigger
13});Trigger
14
15async function fetchPage() {
16 const key = keyword + ':' + page;Decision
17 const nextKey = keyword + ':' + (page + 1);Decision
18 afterLoaded(() => {Decision
19 cache.set(nextKey, load(nextKey));Decision
20 });Decision
21
22 loading = true;Execution
23 const res = await axios.post(Execution
24 '/api/search', { keyword, page });Execution
25
26 data = normalize(res.list);Application
27 total = res.total;Application
28 cache.set(key, data);Application
29 render(data);Application
30}Application
alova declaration
1const {
2 data, page, pageSize,Application
3 loading, isLastPageApplication
4} = usePagination(
5 (page, size) =>Execution
6 api.searchList(keyword, page, size),Execution
7 {
8 watchingStates: [keyword],Trigger
9 debounce: 300,Trigger
10 preloadNextPage: trueDecision
11 }
12);
4 段手写→1 次声明
auto cycling

Sponsors

Gold
Your logo here
Your logo here
Silver
Your logo here
Your logo here
Your logo here
Bronze
watchthis.devwormaSealed Rose — AI Deepfake DetectorJamFeed — Instagram Account Analyzer for Musicians
THE REQUEST SCENARIO MODEL

The four lifecycle stages of a request scenario

Guided by these four lifecycle stages, every request scenario is organized completely, it knows exactly when to trigger, when to reuse, and when to actually send a request, instead of relying on scattered manual glue code.

View the request scenario model
Stage 01

Request Trigger

Requests are triggered at the right moment — such as manual actions, state changes, pagination, or network reconnection — cutting down unnecessary calls.

Initiate01 / TRIGGER
Stage 02

Request Decision

Determines how the request should be handled before it is sent.

Evaluate02 / DECISION
Stage 03

Request Execution

The network communication happens here, typically handled by fetch, axios, or XHR.

Delegate03 / EXECUTE
Stage 04

Data Application

The actions after the response is obtained — such as UI updates, automatic transformation, cache refresh, multi-end sync, and use by subsequent steps.

Integrate04 / APPLICATION
RSM Envelope Principle

Encapsulate trigger, decision, execution and data application in one cohesive scenario.

alova sits above your transport layer. axios and fetch handle the network, while alova owns the rest of the lifecycle.

RSM Core→axios / fetch→Zero Boilerplate
DEFAULT-ON CAPABILITIES

A request strategy goes beyond just firing a request.

alova’s request strategies provide a complete, beyond-expectation request feature set by default — no need to spell it out in your prompts.

Explore scenario hooks
01 / SURGE

Debounce

Collapses rapid, redundant triggers automatically. A burst of keystrokes never floods your backend.

Built-in GuardActive
02 / RESILIENCE

Retry

Automatic retries with exponential backoff. Flaky mobile and edge networks won’t break the flow.

Fault ToleranceActive
03 / CACHE

Multi-level Cache

L1 memory plus persistent storage. Pages restore instantly and work offline.

Sub-millisecondActive
04 / RACE GUARD

Race handling

Race-condition safe. The latest request always wins, and stale responses are discarded.

Race-ProofActive
05 / REVALIDATE

Auto Refresh

Revalidates data when the window regains focus, the network reconnects, or the tab becomes visible again.

Event-DrivenActive
06 / INTERVAL

Polling

Flexible continuous or stepped polling. It pauses automatically when you switch tabs.

Smart FrequencyActive
07 / DEDUPE

Request Sharing

Deduplicates identical concurrent requests anywhere in the component tree into a single in-flight call.

Single flightActive
08 / PREFETCH

Data Preloading

Preload the next page or a detail view on hover. Navigation and pagination feel instant.

Zero LatencyActive
09 / STORAGE

Form Draft

Keeps a local snapshot of multi-step forms. Safe from accidental tab closes or refreshes.

Auto PersistActive
10 / ATOMIC

Atomic Request

Bundles related reads and writes. A cascade of operations either fully succeeds or rolls back together.

State IntegrityActive
11 / STREAMS

Upload & Download

Byte-accurate progress hooks with pause, abort and resume for large binary transfers.

Chunk ControlActive
12 / REACTIVE

State-driven Request

Drops imperative dispatching. Data sync becomes a direct, reactive consequence of your UI state.

Reactive SyncActive
04 · STRATEGY LIBRARY

Every strategy is a complete scenario.

One declaration pre-orchestrates the trigger, the decision, the execution and the data application.

Client strategies

Built-in hooks that declare a complete scenario, trigger, decision, execution and application in one call. No need to stitch those stages together by hand.

Pagination Request

Client

Manage paging, preload the next page, and skip needless refreshes. Pagination becomes one declared scenario.

const todoList = (page, size) =>
alova.Get('/todos', { params: { page, size } });
const { loading, data, page, pageSize, pageCount, total } =
usePagination(todoList);
Learn more

Watch Request

Client

Fire requests the moment watched state changes. Ideal for tab switching and filtered searches.

useWatcher(
() => alova.Get(`/rewards/${activeKey}`),
[activeKey],
{
debounce: [500, 0]
}
)
Learn more

Fetch Data

Client

Preload data to render views faster, or re-fetch it across components.

const { fetching, error, fetch } = useFetcher()
fetch(alova.Get('/todo/1'))
Learn more

Token authentication

Client

A global interceptor with silent token refresh. Unified handling of login, logout, assignment and renewal.

const { onAuthRequired, onResponseRefreshToken } = createServerTokenAuthentication({
refreshTokenOnError: {
isExpired: res => res.status === 401,
handler: async () => {
const { token, refresh_token } = await refreshToken()
localStorage.setItem('token', token)
localStorage.setItem('refresh_token', refresh_token)
}
}
})
const alovaInstance = createAlova({
beforeRequest: onAuthRequired(),
responded: onResponseRefreshToken()
})
Learn more

Form Submission

Client

Manage form state for you. Any kind of form comes together quickly.

const {
loading: submitting,
form,
send: submit,
onSuccess,
onError,
onComplete
} = useForm(
formData =>
alova.Post('/api/submit', formData),
{
initialForm: { name: '', cls: '1' }
}
);
const handleSubmit = () => submit();
Learn more

Auto refresh data

Client

Refresh data automatically on browser events. The UI always shows the latest.

const { loading, data, error } = useAutoRequest(
() => alova.Get('/api/data'),
{
enableVisibility: true,
enableFocus: true,
enableNetwork: true,
throttle: 1000,
pollingTime: 2000
}
);
Learn more

Server strategies

Server-side control covers retry, rate limiting and atomic requests, with no extra middleware.

Retry Request

Server

Stabilize critical requests by retrying them automatically.

const res = await retry(
alova.Post('/api/order'),
{
retry: 3,
backoff: {
delay: 1000,
multiplier: 2
}
}
);
Learn more

Rate Limit

Server

Cap how many requests fire within a given window.

const limit = createRateLimiter({
points: 4,
duration: 60 * 1000
})
const orderRes = await limit(
alova.Get('/api/order')
)
Learn more

Atomize Requests

Server

Guarantee request atomicity in multi-process environments with a distributed lock. No hand-written locking code.

import { atomize } from 'alova/server';
// a distributed lock keeps the request atomic
const res = await atomize(
alova.Get('/api/user'),
{
channel: 'user_lock',
timeout: 5000
}
)
Learn more

Cross-component, zero wiring

Trigger and sync requests across any component. No prop drilling, no global store.

Action Delegation

Cross

Trigger, abort and share requests across components and modules. No extra state plumbing.

Learn more

Seamless Data Interaction

Cross

Keep shared data consistent across components with automatic state synchronization.

Learn more

Explore all 20+ strategies

Every strategy ships as a documented, ready-to-use module.

05 · FLEXIBLE RUNTIME

Runs in any JS environment with any request tool.

alova hands the network call to the request library you already use, axios, fetch or XHR. It works with React, Vue, Svelte and every major framework, including options and class-based ones.

06 · TRUSTED & OPEN SOURCE

Proven across a large number of real-world applications.

Adopted in production environments handling millions of critical data events daily.

15+FrameworksUniversal modern JS runtimes
20+Request StrategiesBattle-tested scenarios
MITOpen License100% free and open source
Join the community

Used in production by real teams

Open source projects dependent on alova

Scott Hu
Scott HuCreator of alova

Request libraries like fetch and axios make requests very simple, and react-query and swr further reduce the boilerplate code of requests. But alova aims to provide extreme API consumption efficiency, achieve more efficient data interaction, and reduce server pressure.

Proddy
ProddyThe author of EMS-ESP

I'm loving this library and slowly migrating my code from Axios to Alova.

0x1EC10D
0x1EC10DDeveloper

Alova is really meticulous. When I read the documents, every point was a pain point and solved many problems.

Ah jung
Ah jungAuthor of Naive Admin

The alovajs is nice. I plan to switch our products to alovajs uniformly

Alova team

Meet the core members

Scott HuScott Hu
MeetinaXDMeetinaXD
czhlinczhlin
07 · TRY IT NOW

Make requests more complete, and smoother to use.

From trigger and decision to execution and application, alova gathers the whole request lifecycle so every interaction feels complete and smooth.