How Apache Superset's Frontend Architecture Combines React, Redux, and @superset-ui/core

Apache Superset implements a TypeScript-based single-page application that uses React for UI composition, Redux (via Redux Toolkit) for global state management, and @superset-ui/core as a centralized design system for shared components and utilities.

Apache Superset’s modern frontend is built as a modular, type-safe SPA leveraging industry-standard libraries. The architecture separates concerns between React components, Redux state containers, and a core UI package to ensure consistency across dashboards, SQL Lab, and chart exploration interfaces.

React and Redux Application Shell

The foundation of Superset’s frontend relies on React for rendering and Redux Toolkit for predictable state management. This combination creates a unidirectional data flow that scales across the application’s many features.

Store Configuration with Redux Toolkit

In superset-frontend/src/views/store.ts, the root Redux store is instantiated using configureStore from @reduxjs/toolkit. This setup automatically includes the thunk middleware and Redux DevTools extension integration, as implemented in lines 24-28.

Connecting Components with Hooks

Throughout the codebase, React components access global state using useSelector and dispatch actions via useDispatch from react-redux. For example, the Dashboard page in superset-frontend/src/dashboard/containers/DashboardPage.tsx (lines 24-28) selects dashboard initialization state, while SQL Lab (superset-frontend/src/pages/SqlLab/index.tsx) and Explore controls (superset-frontend/src/explore/components/controls/VizTypeControl/FastVizSwitcher.tsx) follow identical patterns.

// Example from a page component
import { useDispatch, useSelector } from 'react-redux';

const DashboardPage = () => {
  const dispatch = useDispatch();
  const hasDashboardInfoInitiated = useSelector<RootState, boolean>(
    state => state.dashboardInfo.initiated,
  );
  // ...
};

Slice-Based State Organization

State is organized into domain-specific slices created with createSlice. Each slice—such as those for dashboard info, charts, or native filters—exports actions and reducers that are combined in the central store. Many reducers remain deliberately simple (exposing only initial state) specifically to expose data to Redux DevTools for debugging purposes, as noted in superset-frontend/src/views/store.ts lines 62-66.

@superset-ui-core Design System

The @superset-ui/core package serves as Superset’s shared UI toolkit, encapsulating Ant Design-based components, theming utilities, and formatting helpers that ensure visual consistency.

Component Library

Core exports include InfoTooltip, TableView, and icon systems used across visualizations. The TimeTable visualization in superset-frontend/src/visualizations/TimeTable/TimeTable.tsx (lines 20-22) imports these components directly from the core package.

Theming and Utilities

Design tokens from Ant Design are wrapped through helpers in superset-frontend/src/theme/utils/antdTokenNames.ts. Utility functions like formatNumber, formatTime, and extendedDayjs handle data presentation consistently, as seen in superset-frontend/src/visualizations/TimeTable/components/SparklineCell/SparklineCell.tsx (lines 20-36). The package also provides spec-testing helpers for rendering components with proper theme context in test files.

Data Flow Architecture

Superset’s frontend orchestrates data fetching, routing, and state updates through a coordinated pipeline that connects the Redux store to React components.

Application Bootstrap

The entry point setupApp.ts renders the top-level <App> component inside a <Provider store={store}> (Redux) and a <ThemeProvider> (from @superset-ui/core). This dual-provider pattern ensures global state and design tokens are available throughout the component tree.

Routing and Code Splitting

React Router (configured in src/views/RootContextProviders.tsx) switches between major sections including SQL Lab, Dashboard, Explore, and Settings. Each route’s component freely reads from and writes to Redux state while consuming UI elements from @superset-ui/core.

API Integration with RTK Query

Data fetching leverages RTK Query endpoints defined in superset-frontend/src/hooks/apiResources/queryApi.ts (lines 20-22). Components call generated hooks (e.g., useGetChartDataQuery) which store results in the Redux cache, making data instantly available to any component that selects it with useSelector.

Key Benefits of the Architecture

Benefit Explanation
Predictable state Redux’s single source of truth makes it easy to trace UI changes, especially with the optional Redux DevTools integration enabled in store.ts.
Reusable UI @superset-ui/core centralises Ant-Design-based components, reducing duplication and enforcing a consistent look-and-feel across all pages.
Type safety TypeScript typings are provided by both Redux Toolkit and @superset-ui/core, catching many bugs at compile time.
Scalable feature development New features can add their own slice and use existing UI components without touching unrelated parts of the code.
Testability Components are thin UI layers that consume selectors and dispatch actions, making unit tests straightforward using mocked Redux stores.

Practical Implementation Examples

Below are minimal snippets illustrating typical patterns throughout Superset’s frontend.

// 1️⃣ Creating a Redux slice (e.g., for native filters)
import { createSlice, PayloadAction } from '@reduxjs/toolkit';

interface FilterState {
  enabled: boolean;
  values: Record<string, any>;
}
const initialState: FilterState = { enabled: false, values: {} };

export const nativeFiltersSlice = createSlice({
  name: 'nativeFilters',
  initialState,
  reducers: {
    toggle(state) { state.enabled = !state.enabled; },
    setValue(state, action: PayloadAction<{ id: string; value: any }>) {
      state.values[action.payload.id] = action.payload.value;
    },
  },
});
export const { toggle, setValue } = nativeFiltersSlice.actions;
export default nativeFiltersSlice.reducer;
// 2️⃣ Consuming the slice in a component with @superset-ui/core UI
import { useDispatch, useSelector } from 'react-redux';
import { Switch, Tooltip } from '@superset-ui/core';
import { toggle } from 'src/dashboard/components/nativeFilters/state';

const FilterToggle = () => {
  const dispatch = useDispatch();
  const enabled = useSelector(state => state.nativeFilters.enabled);

  return (
    <Tooltip title="Enable native filters">
      <Switch checked={enabled} onChange={() => dispatch(toggle())} />
    </Tooltip>
  );
};
// 3️⃣ Fetching data with RTK Query and displaying it with a core table
import { useGetChartDataQuery } from 'src/hooks/apiResources/queryApi';
import { TableView } from '@superset-ui/core';

const ChartDataTable = ({ chartId }: { chartId: number }) => {
  const { data, isLoading } = useGetChartDataQuery(chartId);
  return <TableView data={data ?? []} loading={isLoading} />;
};

Summary

  • Superset uses Redux Toolkit's configureStore in superset-frontend/src/views/store.ts to create a type-safe global store with DevTools integration.
  • React components interact with state via standard useSelector and useDispatch hooks throughout pages like Dashboard and SQL Lab.
  • The @superset-ui/core package provides centralized UI components, theming, and utilities to maintain visual consistency.
  • RTK Query handles API caching and data synchronization through endpoints defined in superset-frontend/src/hooks/apiResources/queryApi.ts.
  • Domain-specific slices (dashboard, native filters, charts) keep state logic isolated and testable.

Frequently Asked Questions

What state management library does Apache Superset use?

Apache Superset uses Redux via Redux Toolkit (@reduxjs/toolkit) for global state management. The store is configured in superset-frontend/src/views/store.ts using configureStore, which includes middleware for async thunks and automatic Redux DevTools extension support.

How does Superset handle API data fetching?

Superset implements RTK Query (part of Redux Toolkit) to define API endpoints in superset-frontend/src/hooks/apiResources/queryApi.ts. This approach automatically caches responses in the Redux store and provides generated hooks like useGetChartDataQuery for components to consume, eliminating the need for manual fetch logic.

What is the purpose of @superset-ui/core?

@superset-ui/core is a monorepo package that exports shared React components, design tokens, theming utilities, and formatters. It wraps Ant Design components and ensures consistent styling across all Superset features, from visualizations to administrative interfaces, while providing TypeScript definitions for compile-time safety.

How are React components connected to Redux in Superset?

Components use standard react-redux hooks—specifically useSelector to read state and useDispatch to trigger actions. This pattern appears throughout the codebase in files like DashboardPage.tsx and SqlLab/index.tsx, avoiding the need for class-based container components and enabling a functional programming style.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →