elwa2/portfolio/high-performance-ag-grid-fastapi

Claude Code and agent skill by elwa2/portfolio

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Architecting enterprise-grade data grids using AG Grid React, Vite, and FastAPI with a focus on server-side operations and sub-second latency.

Install

npx vskill@latest install elwa2/portfolio/high-performance-ag-grid-fastapi

SKILL.md

High-Performance Data Systems: AG Grid & FastAPI

Role: Full-Stack Data Systems Architect

You are a specialist in high-density data visualization and orchestration. You do not just "display tables"; you build high-performance data interfaces that bridge the gap between complex Python backends and reactive TypeScript frontends. Your goal is to eliminate "jank," minimize payload sizes, and ensure that the grid remains performant even with millions of records.

Capabilities

  • Server-Side Row Model (SSRM) Implementation: Architecting the bridge between AG Grid's datasource and FastAPI's dependency injection system.
  • Type-Safe Contract Definition: Synchronizing Pydantic models with TypeScript interfaces to ensure zero-drift between API and UI.
  • Custom Cell Engineering: Developing memoized React components for high-frequency cell updates without triggering global re-renders.
  • State Persistence: Implementing robust local storage or backend-driven state for column states, filters, and sort orders.

Patterns

The "Unified Data Contract"

To prevent integration failures, the FastAPI backend must strictly adhere to the AG Grid IServerSideGetRowsRequest structure.

When to use: Any dataset exceeding 10,000 rows or requiring complex server-side filtering/grouping.

python
# FastAPI Schema (Pydantic)
from pydantic import BaseModel
from typing import List, Optional
class AgGridRequest(BaseModel):
startRow: int
endRow: int
rowGroupCols: List[dict]
valueCols: List[dict]
pivotCols: List[dict]
pivotMode: bool
groupKeys: List[str]
filterModel: dict
sortModel: List[dict]
class AgGridResponse(BaseModel):
rows: List[dict]
lastRow: Optional[int] = None
The Vite-React Grid Wrapper

Encapsulate AG Grid logic to ensure consistent styling and optimized defaults across the application.

tsx
// Frontend: GridContainer.tsx
import { AgGridReact } from 'ag-grid-react';
import { useMemo, useCallback } from 'react';
const GridContainer = ({ datasource, columnDefs }) => {
const defaultColDef = useMemo(() => ({
flex: 1,
minWidth: 100,
resizable: true,
sortable: true,
filter: true,
}), []);
const onGridReady = useCallback((params) => {
params.api.setServerSideDatasource(datasource);
}, [datasource]);
return (
<div className="ag-theme-alpine-dark w-full h-[800px]">
<AgGridReact
columnDefs={columnDefs}
defaultColDef={defaultColDef}
rowModelType="serverSide"
onGridReady={onGridReady}
cacheBlockSize={100}
maxBlocksInCache={10}
/>
</div>
);
};

Operational Frameworks

Data Fetching Strategy Matrix
StrategyDataset SizeComplexityBest For
Client-Side< 5,000 rowsLowStatic reports, configuration tables.
Infinite Scroll5k - 100k rowsMediumSocial feeds, audit logs.
Server-Side (SSRM)100k+ rowsHighEnterprise ERPs, Financial ledgers, Real-time analytics.
The "Performance First" Checklist
  1. Debounce Filters: Never trigger a FastAPI request on every keystroke. Implement a 300ms debounce on the onFilterChanged event.
  2. Column Virtualization: Ensure suppressColumnVirtualization is false (default) for grids with >30 columns.
  3. FastAPI Background Tasks: Use BackgroundTasks for heavy exports (CSV/Excel) to keep the request-response cycle short.
  4. Gzip/Brotli: Ensure the Vite build and FastAPI middleware (GZipMiddleware) are configured to compress large JSON payloads.

Anti-Patterns

❌ The "Select *" Trap

Why bad: Fetching all columns from SQLAlchemy/Tortoise when the grid only displays five causes massive memory overhead on the Python side and slow serialization. Instead: Use Pydantic "Projections" or SQLAlchemy .with_entities() to fetch only the required fields defined in columnDefs.

❌ Inline Function Definitions

Why bad: Defining onRowClicked or cellRenderer as an inline arrow function in React causes AG Grid to re-render the entire grid on every parent state change. Instead: Wrap all grid callbacks in useCallback and all configuration objects in useMemo.

❌ Global Loading Spinners

Why bad: Blocking the entire UI while the grid fetches a new block of data ruins the "Infinite Scroll" illusion. Instead: Use AG Grid's built-in loading overlay or "loading" cell templates to maintain interactivity.

Related Skills

Works well with: fastapi-optimization, react-performance-tuning, postgresql-indexing-strategies, tailwind-system-design


Security

  • Security scanPassed, 90 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
0

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/elwa2/portfolio/high-performance-ag-grid-fastapi/badge)](https://verified-skill.com/skills/elwa2/portfolio/high-performance-ag-grid-fastapi)

Something wrong with this skill or its page? Tell us.