---
title: "async api routes"
description: "In API routes and Server Actions, start independent operations immediately, even if you don't await them yet."
type: skill
canonical_url: https://claudary.paisolsolutions.com/skills/async-api-routes
source: "Claudary"
difficulty: intermediate
author: "Claude Code Knowledge Pack"
date: 2026-07-10T11:08:00.169Z
license: CC-BY-4.0
attribution: "async api routes — Claudary (https://claudary.paisolsolutions.com/skills/async-api-routes)"
---

# async api routes
In API routes and Server Actions, start independent operations immediately, even if you don't await them yet.

## Overview

---
title: Prevent Waterfall Chains in API Routes
impact: CRITICAL
impactDescription: 2-10× improvement
tags: api-routes, server-actions, waterfalls, parallelization
---

## Prevent Waterfall Chains in API Routes

In API routes and Server Actions, start independent operations immediately, even if you don't await them yet.

**Incorrect (config waits for auth, data waits for both):**

```typescript
export async function GET(request: Request) {
  const session = await auth()
  const config = await fetchConfig()
  const data = await fetchData(session.user.id)
  return Response.json({ data, config })
}
```

**Correct (auth and config start immediately):**

```typescript
export async function GET(request: Request) {
  const sessionPromise = auth()
  const configPromise = fetchConfig()
  const session = await sessionPromise
  const [config, data] = await Promise.all([
    configPromise,
    fetchData(session.user.id)
  ])
  return Response.json({ data, config })
}
```

For operations with more complex dependency chains, use `better-all` to automatically maximize parallelism (see Dependency-Based Parallelization).

---

Source: [Claudary](https://claudary.paisolsolutions.com/skills/async-api-routes) · https://claudary.paisolsolutions.com
