v0.3.2 — Vue & React DevTools + 13 rules + GraphQL & WebSocket intelligence

Lighthouse for
your API calls

Scans your web app's API layer. Finds waterfalls, duplicate fetches, N+1 patterns, and missing cache. Drop-in DevTools for Vue & React. Generates framework-aware fix code.

⚡ Get Started View on GitHub →
Terminal
$ npx flux-scan https://myapp.com --network jio-4g
⠙ Scanning... [████████████████████] 30s

╔════════════════════════════════════════════════════╗
║ FluxAPI Report — Score: 38/100 (poor) ║
╚════════════════════════════════════════════════════╝

⚡ Efficiency ██████░░░░░░░░░░░░░░ 30%
💾 Caching ████████████░░░░░░░░ 55%
🔄 Patterns ██████████████░░░░░░ 70%

⚛️ React 18.2.0 (Next.js) · TanStack Query v5
🌐 2 WebSocket connections · 142 messages

Issues Found:
🔴 5 critical 🟡 5 warnings ℹ️ 3 info

Top Fixes:
E2: GET /api/user called 4x from 4 components
⚡ 600ms faster 📉 3 fewer requests
E3: N+1: 25 individual GET /products/:id
⚡ 2.1s faster 📉 24 fewer requests

What it finds

13 audit rules catch the API anti-patterns killing your app performance

🔗
Request Waterfalls
Sequential API calls with no data dependency. Request B waits for A to finish. Could run in parallel with Promise.all.
E1 · Critical
👯
Duplicate Requests
Header, Sidebar, and ProfileCard each call GET /api/user. TanStack Query deduplicates this — but only if you use a shared hook.
E2 · Critical
💥
N+1 Query Pattern
Product list page fires GET /products/1, /products/2... ×25. Classic N+1. One batch endpoint eliminates 24 requests.
E3 · Critical
📦
Payload Over-fetching
API returns 50 fields but app reads 6. That's 88% wasted bytes. Suggests GraphQL or sparse fieldsets.
E4 · Warning
🚫
No Cache Strategy
Endpoints with zero caching — no Cache-Control, no ETag, no staleTime. Every mount triggers a fresh network round-trip.
C1 · Critical
🔁
Unnecessary Polling
Polling every 2s but data changes once a minute. 95% of polls wasted. Switch to SSE or increase interval.
P2 · Warning
🖥️
Vue & React DevTools
Drop-in <FluxDevTools /> component for Vue 3 and React. Floating panel with live score, violations, and request feed. Integrates with TanStack Query & SWR.
New in v0.3.2
🔧
Framework-Aware Fixes
Auto-detects your stack — React, Vue, Next.js, Nuxt, Angular, SWR, Apollo — and generates fix code that matches your framework.
Auto-fixable
🌐
WebSocket & GraphQL
Monitors WS connections, message rates, subscriptions. Deduplicates GraphQL queries by operation + variables hash.
Intelligence

Three steps. Sixty seconds.

No config, no setup, no API key

1
Scan
Run npx flux-scan against any URL, or add <FluxDevTools /> to your Vue/React app for live monitoring.
2
Analyze
13 audit rules score your API layer 0-100. Network-adjusted scoring shows how patterns compound on Jio 4G vs WiFi.
3
Fix
Each violation generates framework-aware fix code — React, Vue, Angular, SWR, Apollo. Copy-paste the fix and re-scan.

Network-adjusted scoring

Same code, different scores. A waterfall costs 3x more on Jio 4G than WiFi.

75
WiFi
48
Jio 4G
30
BSNL 2G

See a real report

This is what FluxAPI finds when scanning a typical Next.js e-commerce app on Jio 4G

📍 nextshop.vercel.app ⚛️ React 18 (Next.js) · TanStack Query 📡 Jio 4G · 32s scan
0 poor

API Health Score

18 API calls · Jio 4G · 32s scan

4Critical
2Warnings
1Info
⚡ 3.4sTime Saved
📉 31Fewer Requests
💾 142KBBandwidth
Efficiency
25%
💾 Caching
50%
🔄 Patterns
65%

Top Issues

E2 GET /api/user called 4× from 4 components ⚡600ms
E3 N+1: 25× GET /api/products/:id ⚡2.1s
E1 4 sequential requests (waterfall) ⚡480ms
Click to see all 7 issues with fix code →
E2 Duplicate Requests GET /api/user called 4× from 4 components
⚡600ms 📉 3 reqs

Same endpoint hit 4 times within 120ms. Header, Sidebar, ProfileCard, and NotificationBell each call GET /api/user independently. Extract a shared useQuery hook.

Fix — TanStack Query
// hooks/useUser.ts — shared across components
export function useUser() {
  return useQuery({
    queryKey: ['user'],
    queryFn: () => fetch('/api/user').then(r => r.json()),
    staleTime: 30_000,
  });
}
E3 N+1 Pattern 25× GET /api/products/:id
⚡2.1s 📉 24 reqs

Product listing page fires 25 individual requests to parameterized endpoint. Classic N+1 — each product card fetches its own data instead of one batch call.

Fix — Batch Endpoint
// Replace 25 individual calls with one batch
const products = await fetch(
  '/api/products?ids=1,2,3,4,...25'
).then(r => r.json());
E1 Request Waterfall 4 sequential requests (waterfall)
⚡480ms

4 API calls run one after another with no data dependency. /api/config → /api/user → /api/cart → /api/recommendations. These could all run in parallel.

Fix — TanStack Query
import { useSuspenseQueries } from '@tanstack/react-query';

const results = useSuspenseQueries({
  queries: [
    { queryKey: ['config'], queryFn: fetchConfig },
    { queryKey: ['user'], queryFn: fetchUser },
    { queryKey: ['cart'], queryFn: fetchCart },
    { queryKey: ['recs'], queryFn: fetchRecs },
  ]
});
C1 No Cache Strategy No cache: /api/categories (3×)
📉 2 reqs 💾 48KB

No Cache-Control, ETag, or Last-Modified header. Categories rarely change but every page navigation refetches from network.

Fix — staleTime
useQuery({
  queryKey: ['categories'],
  queryFn: fetchCategories,
  staleTime: 5 * 60_000,  // 5 minutes
  gcTime: 10 * 60_000,     // 10 minutes
});
E4 Over-fetching 87KB response: /api/products (list view)
💾 52KB

Product list endpoint returns full product objects (description, specs, reviews, related items) but the list view only uses name, price, image, and rating.

Fix — Sparse Fields
fetch('/api/products?fields=id,name,price,image,rating')
P2 Unnecessary Polling Polling /api/notifications every 3s (92% wasted)
📉 9 reqs

92% of polls return identical data. Notifications update once every ~40 seconds on average but the app polls every 3 seconds.

Fix — Longer Interval
useQuery({
  queryKey: ['notifications'],
  queryFn: fetchNotifications,
  refetchInterval: 15_000,  // 15s instead of 3s
});
P4 Uncompressed 6 responses without gzip/brotli (~42KB)
💾 29KB

6 JSON responses over 1KB have no content-encoding. Gzip compression typically saves 60-80% on JSON payloads.

Fix — Server Config
// next.config.js
module.exports = {
  compress: true,  // enabled by default in Next.js
}

// Or Nginx:
gzip on;
gzip_types application/json;
MethodPathStatusDurationSizeCache
GET/api/config20045ms1.2KBmax-age=3600
GET/api/user20082ms3.4KBnone
GET/api/user20078ms3.4KBnone
GET/api/user20091ms3.4KBnone
GET/api/user20076ms3.4KBnone
GET/api/cart200120ms2.8KBnone
GET/api/categories20068ms16KBnone
GET/api/categories20072ms16KBnone
GET/api/categories20065ms16KBnone
GET/api/products200210ms87KBmax-age=60
GET/api/products/120048ms4.2KBnone
GET/api/products/220052ms3.9KBnone
GET/api/products/320061ms4.5KBnone
... +12 more /api/products/:id requests (N+1 pattern)
GET/api/recommendations200180ms12KBnone
GET/api/notifications20035ms1.8KBnone
GET/api/notifications20038ms1.8KBnone
GET/api/notifications20032ms1.8KBnone
Request Timeline (2.4s total)
/api/config
45ms
/api/user ×4
82ms
/api/cart
120ms
/api/categories ×3
68ms
/api/products
210ms
/api/products/1
48ms
/api/products/2
52ms
/api/products/3
61ms
... ×22 more
~1.1s
/api/recommendations
180ms
/api/notifications
3s int
API call Duplicate N+1 Polling

Installation

Choose your setup — CLI, Vue DevTools, React DevTools, or programmatic SDK

terminal
# Zero install — scan any URL, get HTML report
$ npx flux-scan https://your-app.com -o report.html

# Test with Indian mobile network scoring
$ npx flux-scan https://your-app.com --network jio-4g -o report.html

# Authenticated apps — login manually, browse, press Enter
$ npx flux-scan https://admin.your-app.com --no-headless --interact

# JSON output for CI/CD pipelines (exit code 1 if score < 50)
$ npx flux-scan https://staging.your-app.com -f json

# Stress test on slow networks
$ npx flux-scan https://your-app.com -n bsnl-2g -o slow-report.html
vue
# Step 1: Install
$ npm install @fluxiapi/vue

# Step 2: Add one component to your App.vue

<!-- App.vue -->
<script setup>
import { FluxDevTools } from '@fluxiapi/vue';
</script>

<template>
  <RouterView />
  <FluxDevTools force-show verbose network="jio-4g" />
</template>

# That's it! A floating badge appears in the corner.
# Click it to expand the panel. Press Ctrl+Shift+F to toggle.

# Optional: With TanStack Vue Query
import { wrapQueryClient } from '@fluxiapi/vue';
const queryClient = wrapQueryClient(new QueryClient());

# Optional: Use composables for custom UI
import { useFluxScore, useFluxViolations } from '@fluxiapi/vue';
const score = useFluxScore();      // { overall, grade, color }
const violations = useFluxViolations(); // RuleViolation[]
react
# Step 1: Install
$ npm install @fluxiapi/react

# Step 2: Add one component to your App.tsx

import { FluxDevTools } from '@fluxiapi/react';

function App() {
  return (
    <>
      <YourApp />
      <FluxDevTools forceShow verbose network="jio-4g" />
    </>
  );
}

# That's it! Floating badge + expandable panel.

# Optional: With TanStack Query
import { wrapQueryClient } from '@fluxiapi/react';
const queryClient = wrapQueryClient(new QueryClient());

# Optional: With SWR
import { fluxSWRMiddleware } from '@fluxiapi/react';
<SWRConfig value={{ use: [fluxSWRMiddleware] }}>

# Optional: Use hooks for custom UI
import { useFluxScore, useFluxViolations } from '@fluxiapi/react';
const { overall, grade } = useFluxScore();
javascript
# Step 1: Install the core SDK
$ npm install @fluxiapi/scan

# Step 2: Use programmatically

import { FluxScanner, FluxAnalyzer, generateHtmlReport } from '@fluxiapi/scan';

// Scan
const scanner = new FluxScanner({ duration: 60, network: 'jio-4g' });
scanner.start();

// ... user browses app ...

const session = scanner.stop();

// Analyze
const analyzer = new FluxAnalyzer({ network: 'jio-4g' });
const report = analyzer.analyze(session);

// Output
const html = generateHtmlReport(report);
console.log(report.score.overall); // 38

Packages

@fluxiapi/scan
Core scanner + analyzer engine
167 KB
@fluxiapi/cli
CLI tool (npx flux-scan)
207 KB
@fluxiapi/vue
Vue 3 DevTools + composables
34 KB
@fluxiapi/react
React DevTools + hooks
42 KB

Use cases

FluxAPI fits into every stage of your development workflow

🚀
Pre-Deploy Audit
Run before every deploy to catch API regressions. Generate an HTML report and share with your team.
npx flux-scan https://staging.app.com -o report.html
🖥️
Live Dev Monitoring
Add <FluxDevTools /> to your Vue or React app. See API health scores update in real-time as you develop. Catches issues the CLI can't — like component re-mounts and user interaction patterns.
🔒
Authenticated App Scanning
Admin panels, dashboards, apps behind login — open a visible browser, login manually, browse all pages, press Enter.
npx flux-scan https://admin.app.com --no-headless --interact
🇮🇳
India Market Optimization
Your app works on WiFi but crashes on Jio 4G. Score your APIs against real Indian network conditions.
npx flux-scan https://app.com -n jio-4g -o jio.html
⚙️
CI/CD Quality Gate
Fail the build automatically if API health drops below 50. Exit code 1 on poor scores — works with any CI system.
npx flux-scan https://staging.app.com -f json
🔍
Chrome DevTools Extension
Real-time scanning inside DevTools. Best for daily development — you're already logged in, no setup needed. Export as HTML or JSON.

CLI Reference

Every option at a glance

options
-d, --duration <sec>     Scan duration in seconds (default: 30)
-n, --network <name>    wifi | jio-4g | airtel-4g | airtel-3g | bsnl-2g | slow-3g
-o, --output <file>     Output file (.html or .json)
-f, --format <fmt>      console | html | json
-s, --session <file>    Analyze saved session JSON (skip live scan)
    --no-headless       Show browser window during scan
    --interact          Manual browse mode (press Enter to stop)
-h, --help              Show help
-v, --version           Show version

EXIT CODES
  0  Score >= 50 (pass)
  1  Score < 50  (fail — useful for CI/CD)
  2  Fatal error

Show your score

Add a badge to your README. Every repo becomes a billboard.

72
FluxAPI Score
Markdown ![FluxAPI Score](https://img.shields.io/badge/FluxAPI_Score-72%2F100-blue)
HTML <img src="https://img.shields.io/badge/FluxAPI_Score-72%2F100-blue" />

Run npx flux-scan → copy the badge line from the output → paste into README.md

Stop shipping slow APIs

One command. Sixty seconds. Copy-paste fixes.

⚡ Star on GitHub View on npm →