docs/DOCS_CLAUDE.md
This guide helps LLMs work with the Apache Superset documentation site built with Docusaurus 3.
You are currently in the /docs subdirectory of the Apache Superset repository. When referencing files from the main codebase, use ../ to access the parent directory.
/Users/evan_1/GitHub/superset/ # Main repository root
āāā superset/ # Python backend code
āāā superset-frontend/ # React/TypeScript frontend
āāā docs/ # Documentation site (YOU ARE HERE)
āāā docs/ # Main documentation content
āāā developer_portal/ # Developer guides (currently disabled)
āāā components/ # Component playground (currently disabled)
āāā docusaurus.config.ts # Site configuration
# Development
yarn start # Start dev server on http://localhost:3000
yarn stop # Stop running dev server
yarn build # Build production site
yarn serve # Serve built site locally
# Version Management (USE THESE, NOT docusaurus commands)
yarn version:add:docs <version> # Add new docs version
yarn version:add:developer_portal <version> # Add developer portal version
yarn version:add:components <version> # Add components version
yarn version:remove:docs <version> # Remove docs version
yarn version:remove:developer_portal <version> # Remove developer portal version
yarn version:remove:components <version> # Remove components version
# Quality Checks
yarn typecheck # TypeScript validation
yarn eslint # Lint TypeScript/JavaScript files
/docs)The primary documentation lives in /docs with this structure:
docs/
āāā intro.md # Auto-generated from ../README.md
āāā quickstart.mdx # Getting started guide
āāā api.mdx # API reference with Swagger UI
āāā faq.mdx # Frequently asked questions
āāā installation/ # Installation guides
ā āāā installation-methods.mdx
ā āāā docker-compose.mdx
ā āāā docker-builds.mdx
ā āāā kubernetes.mdx
ā āāā pypi.mdx
ā āāā architecture.mdx
āāā configuration/ # Configuration guides
ā āāā configuring-superset.mdx
ā āāā alerts-reports.mdx
ā āāā caching.mdx
ā āāā databases.mdx
ā āāā [more config docs]
āāā using-superset/ # User guides
ā āāā creating-your-first-dashboard.md
ā āāā exploring-data.mdx
ā āāā [more user docs]
āāā contributing/ # Contributor guides
ā āāā development.mdx
ā āāā testing-locally.mdx
ā āāā [more contributor docs]
āāā security/ # Security documentation
āāā security.mdx
āāā [security guides]
/developer_portal) - Currently DisabledWhen enabled, contains developer-focused content:
/components) - Currently DisabledWhen enabled, provides interactive component examples for UI development.
.md files: Basic Markdown documents.mdx files: Markdown with JSX - can include React components.tsx files in /src: Custom React components and pagesEvery documentation page should have frontmatter:
---
title: Page Title
description: Brief description for SEO
sidebar_position: 1 # Optional: controls order in sidebar
---
MDX files can import and use React components:
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
<Tabs>
<TabItem value="npm" label="npm" default>
```bash
npm install superset
```
</TabItem>
<TabItem value="yarn" label="yarn">
```bash
yarn add superset
```
</TabItem>
</Tabs>
Use triple backticks with language identifiers:
```python
def hello_world():
print("Hello, Superset!")
```
```sql title="Example Query"
SELECT * FROM users WHERE active = true;
```
```bash
# Installation command
pip install apache-superset
```
Docusaurus supports various admonition types:
:::note
This is a note
:::
:::tip
This is a tip
:::
:::warning
This is a warning
:::
:::danger
This is a danger warning
:::
:::info
This is an info box
:::
Versions are managed through versions-config.json:
{
"docs": {
"disabled": false,
"lastVersion": "6.0.0", // Default version shown
"includeCurrentVersion": true, // Show "Next" version
"onlyIncludeVersions": ["current", "6.0.0"],
"versions": {
"current": {
"label": "Next",
"path": "",
"banner": "unreleased" // Shows warning banner
},
"6.0.0": {
"label": "6.0.0",
"path": "6.0.0",
"banner": "none"
}
}
}
}
IMPORTANT: Always use the custom scripts, NOT native Docusaurus commands:
# ā
CORRECT - Updates both Docusaurus and versions-config.json
yarn version:add:docs 6.1.0
# ā WRONG - Only updates Docusaurus, breaks version dropdown
yarn docusaurus docs:version 6.1.0
When versioning, these files are created:
versioned_docs/version-X.X.X/ - Snapshot of current docsversioned_sidebars/version-X.X.X-sidebars.json - Sidebar configversions.json - List of all versionsAdd custom styles in /src/css/custom.css:
:root {
--ifm-color-primary: #20a7c9;
--ifm-code-font-size: 95%;
}
Create React components in /src/components/:
// src/components/FeatureCard.tsx
import React from 'react';
export default function FeatureCard({title, description}) {
return (
<div className="card">
<h3>{title}</h3>
<p>{description}</p>
</div>
);
}
Use in MDX:
import FeatureCard from '@site/src/components/FeatureCard';
<FeatureCard
title="Fast"
description="Lightning fast queries"
/>
Use relative paths for internal documentation:
[Installation Guide](./installation/docker-compose)
[Configuration](../configuration/configuring-superset)
Always use full URLs:
[Apache Superset GitHub](https://github.com/apache/superset)
Reference code in the main repository:
See the [main configuration file](https://github.com/apache/superset/blob/master/superset/config.py)
.mdx file in the appropriate directoryThe API docs use Swagger UI embedded in /docs/api.mdx:
import SwaggerUI from "swagger-ui-react";
import "swagger-ui-react/swagger-ui.css";
<SwaggerUI url="/api/v1/openapi.json" />
Use MDX to create interactive documentation:
import CodeBlock from '@theme/CodeBlock';
import MyComponentExample from '!!raw-loader!../examples/MyComponent.tsx';
<CodeBlock language="tsx">{MyComponentExample}</CodeBlock>
When creating or updating documentation:
yarn startyarn build)Sidebars are configured in /sidebars.js:
module.exports = {
CustomSidebar: [
{
type: 'doc',
label: 'Introduction',
id: 'intro',
},
{
type: 'category',
label: 'Installation',
items: [
{
type: 'autogenerated',
dirName: 'installation',
},
],
},
],
};
Docusaurus includes Algolia DocSearch integration configured in docusaurus.config.ts.
yarn docusaurus docs:version - Use yarn version:add:docs insteadyarn build before committingyarn stop # Kill any running servers
yarn clear # Clear cache
yarn start # Restart
# Check for broken links
yarn build
# TypeScript issues
yarn typecheck
# Linting issues
yarn eslint
If versions don't appear in dropdown:
versions-config.json includes the versionversioned_docs/From docs/configuration/configuring-superset.mdx:
---
title: Configuring Superset
hide_title: true
sidebar_position: 1
version: 1
---
# Configuring Superset
## superset_config.py
Superset exposes hundreds of configurable parameters through its
[config.py module](https://github.com/apache/superset/blob/master/superset/config.py).
```bash
export SUPERSET_CONFIG_PATH=/app/superset_config.py
**Key patterns:**
- Links to source code for reference
- Code blocks with bash/python examples
- Environment variable documentation
- Step-by-step configuration instructions
### Example: Tutorial Documentation Pattern
From `docs/using-superset/creating-your-first-dashboard.mdx`:
```mdx
import useBaseUrl from "@docusaurus/useBaseUrl";
## Creating Your First Dashboard
:::tip
In addition to this site, [Preset.io](http://preset.io/) maintains an updated set of end-user
documentation at [docs.preset.io](https://docs.preset.io/).
:::
### Connecting to a new database
Key patterns:
From docs/api.mdx:
import SwaggerUI from "swagger-ui-react";
import "swagger-ui-react/swagger-ui.css";
## API Documentation
<SwaggerUI url="/api/v1/openapi.json" />
Key patterns:
// For images in static folder
import useBaseUrl from "@docusaurus/useBaseUrl";
// With caption
<figure>
<figcaption>Superset Dashboard Interface</figcaption>
</figure>
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
<Tabs
defaultValue="docker"
values={[
{label: 'Docker', value: 'docker'},
{label: 'Kubernetes', value: 'k8s'},
{label: 'PyPI', value: 'pypi'},
]}>
<TabItem value="docker">
```bash
docker-compose up
```
</TabItem>
<TabItem value="k8s">
```bash
kubectl apply -f superset.yaml
```
</TabItem>
<TabItem value="pypi">
```bash
pip install apache-superset
```
</TabItem>
</Tabs>
```python title="superset_config.py"
# Database connection example
SQLALCHEMY_DATABASE_URI = 'postgresql://user:password@localhost/superset'
# Security configuration
SECRET_KEY = 'YOUR_SECRET_KEY_HERE'
WTF_CSRF_ENABLED = True
# Feature flags
FEATURE_FLAGS = {
'ENABLE_TEMPLATE_PROCESSING': True,
'DASHBOARD_NATIVE_FILTERS': True,
}
### Cross-Referencing Pattern
```mdx
For detailed configuration options, see:
- [Configuring Superset](./configuration/configuring-superset)
- [Database Connections](./configuration/databases)
- [Security Settings](./security/security)
External resources:
- [SQLAlchemy Documentation](https://docs.sqlalchemy.org/)
- [Flask Configuration](https://flask.palletsprojects.com/config/)
## Prerequisites
:::warning
Ensure you have Python 3.9+ and Node.js 16+ installed before proceeding.
:::
## Installation Steps
1. **Clone the repository**
```bash
git clone https://github.com/apache/superset.git
cd superset
Install Python dependencies
pip install -e .
Initialize the database
superset db upgrade
superset init
:::tip Success Check Navigate to http://localhost:8088 and login with admin/admin :::
### Documenting API Endpoints
```mdx
## Chart API
### GET /api/v1/chart/
Returns a list of charts.
**Parameters:**
- `page` (optional): Page number
- `page_size` (optional): Number of items per page
**Example Request:**
```bash
curl -X GET "http://localhost:8088/api/v1/chart/" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
Example Response:
{
"count": 42,
"result": [
{
"id": 1,
"slice_name": "Sales Dashboard",
"viz_type": "line"
}
]
}
---
**Note**: This documentation site serves as the primary resource for Superset users, administrators, and contributors. Always prioritize clarity, accuracy, and completeness when creating or updating documentation.