You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 375d10d
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: docs/developer_docs/extensions/architecture.md
+32-31Lines changed: 32 additions & 31 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,34 +33,39 @@ The extension architecture is built on six core principles that guide all techni
33
33
### 1. Lean Core
34
34
35
35
Superset's core should remain minimal, with many features delegated to extensions. Built-in features use the same APIs and extension mechanisms available to external developers. This approach:
36
+
36
37
- Reduces maintenance burden and complexity
37
38
- Encourages modularity
38
39
- Allows the community to innovate independently of the main codebase
39
40
40
41
### 2. Explicit Contribution Points
41
42
42
-
All extension points are clearly defined and documented. Extension authors know exactly where and how they can interact with the host system. Backend contributions are declared in `extension.json`. Frontend contributions are registered directly in code at module load time, giving the host clear visibility into what each extension provides:
43
+
All extension points are clearly defined and documented. Extension authors know exactly where and how they can interact with the host system. Both backend and frontend contributions are registered directly in code — backend contributions via classes decorated with `@api` (and other decorators) imported from the auto-discovered entrypoint, frontend contributions via calls like `views.registerView` and `commands.registerCommand` executed at module load time in `index.tsx`. This gives the host clear visibility into what each extension provides:
44
+
43
45
- Manage the extension lifecycle
44
46
- Provide a consistent user experience
45
47
- Validate extension compatibility
46
48
47
49
### 3. Versioned and Stable APIs
48
50
49
51
Public interfaces for extensions follow semantic versioning, allowing for:
52
+
50
53
- Safe evolution of the platform
51
54
- Backward compatibility
52
55
- Clear upgrade paths for extension authors
53
56
54
57
### 4. Lazy Loading and Activation
55
58
56
59
Extensions are loaded and activated only when needed, which:
60
+
57
61
- Minimizes performance overhead
58
62
- Reduces resource consumption
59
63
- Improves startup time
60
64
61
65
### 5. Composability and Reuse
62
66
63
67
The architecture encourages reusing extension points and patterns across different modules, promoting:
68
+
64
69
- Consistency across extensions
65
70
- Reduced duplication
66
71
- Shared best practices
@@ -80,6 +85,7 @@ Two core packages provide the foundation for extension development:
80
85
**Frontend: `@apache-superset/core`**
81
86
82
87
This package provides essential building blocks for frontend extensions and the host application:
88
+
83
89
- Shared UI components
84
90
- Utility functions
85
91
- APIs and hooks
@@ -90,6 +96,7 @@ By centralizing these resources, both extensions and built-in features use the s
90
96
**Backend: `apache-superset-core`**
91
97
92
98
This package exposes key classes and APIs for backend extensions:
99
+
93
100
- Database connectors
94
101
- API extensions
95
102
- Security manager customization
@@ -102,6 +109,7 @@ It includes dependencies on critical libraries like Flask-AppBuilder and SQLAlch
102
109
**`apache-superset-extensions-cli`**
103
110
104
111
The CLI provides comprehensive commands for extension development:
112
+
105
113
- Project scaffolding
106
114
- Code generation
107
115
- Building and bundling
@@ -114,13 +122,15 @@ By standardizing these processes, the CLI ensures extensions are built consisten
114
122
The Superset host application serves as the runtime environment for extensions:
115
123
116
124
**Extension Management**
125
+
117
126
- Exposes `/api/v1/extensions` endpoint for registration and management
118
127
- Provides a dedicated UI for managing extensions
119
128
- Stores extension metadata in the `extensions` database table
120
129
121
130
**Extension Storage**
122
131
123
132
The extensions table contains:
133
+
124
134
- Extension name, version, and author
125
135
- Metadata and configuration
126
136
- Built frontend and/or backend code
@@ -132,6 +142,7 @@ The following diagram illustrates how these components work together:
132
142
<imgwidth="955"height="586"alt="Extension System Architecture"src="https://github.com/user-attachments/assets/cc2a41df-55a4-48c8-b056-35f7a1e567c6" />
133
143
134
144
The diagram shows:
145
+
135
146
1.**Extension projects** depend on core packages for development
136
147
2.**Core packages** provide APIs and type definitions
137
148
3.**The host application** implements the APIs and manages extensions
@@ -151,23 +162,25 @@ The architecture leverages Webpack's Module Federation to enable dynamic loading
151
162
152
163
Extensions configure Webpack to expose their entry points:
153
164
154
-
```typescript
155
-
newModuleFederationPlugin({
156
-
name: 'my_extension',
157
-
filename: 'remoteEntry.[contenthash].js',
158
-
exposes: {
159
-
'./index': './src/index.tsx',
160
-
},
161
-
externalsType: 'window',
162
-
externals: {
163
-
'@apache-superset/core': 'superset',
164
-
},
165
-
shared: {
166
-
react: { singleton: true },
167
-
'react-dom': { singleton: true },
168
-
'antd-v5': { singleton: true }
169
-
}
170
-
})
165
+
```javascript
166
+
externalsType:'window',
167
+
externals: {
168
+
'@apache-superset/core':'superset',
169
+
},
170
+
plugins: [
171
+
newModuleFederationPlugin({
172
+
name:'my_extension',
173
+
filename:'remoteEntry.[contenthash].js',
174
+
exposes: {
175
+
'./index':'./src/index.tsx',
176
+
},
177
+
shared: {
178
+
react: { singleton:true, import:false },
179
+
'react-dom': { singleton:true, import:false },
180
+
antd: { singleton:true, import:false },
181
+
},
182
+
}),
183
+
]
171
184
```
172
185
173
186
This configuration does several important things:
@@ -195,24 +208,12 @@ Here's what happens at runtime:
195
208
196
209
On the Superset side, the APIs are mapped to `window.superset` during application bootstrap:
0 commit comments