跳到正文
Skillpedia
通用编程8.1k · #12600

webiny-full-stack-architect

它能做什么

这个技能为你的 AI 提供一个同时包含后端和管理后台代码的扩展包结构。适用于需要 Webiny 项目两端功能的开发者。

适用场景

  • ✓一个功能需要在同一个包中同时包含后端逻辑和管理界面的时候。
  • ✓正在设置同时注册 API 和管理后台部分的顶层扩展时。
  • ✓希望 API 和管理后台层共用领域代码的时候。

技能链接

https://github.com/webiny/webiny-js/blob/next/skills/user-skills/full-stack-architect/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/webiny/webiny-js/blob/next/skills/user-skills/full-stack-architect/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请帮我创建一个产品评论的全栈 Webiny 扩展,包含后端部分和管理界面。”

每周 5 个新技能,1 分钟读完。

工作原理

该技能讲解了一个顶层组件,它注册 API 入口和管理后台入口,两者都依托于共享领域层。每一端的细节见单独的 API 和管理后台技能。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Full-Stack Extension Skeleton

TL;DR

A full-stack extension bundles API and Admin into a single package with a shared domain layer. The top-level component registers both sides via <Api.Extension> and <Admin.Extension>, which point to separate entry-point files. Each side follows its own layered architecture pattern — see webiny-api-architect and webiny-admin-architect skills for details.

Working Context

This skill applies to both extension developers (working in extensions/) and core developers (working in packages/). The architecture patterns are the same — only the import convention and registration mechanism differ.

Extensions (extensions/) Core (packages/)
Imports webiny/api, webiny/admin, webiny/admin/ui @webiny/feature/api, @webiny/app-admin, @webiny/admin-ui
Catalog paths Use the Import: path Use the Source: path
Registration <Api.Extension src={...}> / <Admin.Extension src={...}> in webiny.config.tsx createFeature registered directly by the package's module initializer
Entry point export Files targeted by Extension src MUST use export default No restriction — features are registered programmatically
Top-level component Required — composes <Api.Extension> + <Admin.Extension> Not applicable — each package registers its own features

Detect which context you're in by checking the file path: extensions/ → extension mode, packages/ → core mode.

RULE — Extension Entry Points

Admin extensions CANNOT be directly mounted in webiny.config.tsx or in any child component tree without going through <Admin.Extension />.

The same rule applies to API extensions — they must go through <Api.Extension />.

These entry-point components are the only way to register code that runs inside the Admin app or the API runtime. They use the src prop to point to a file that will be loaded in the correct execution environment (browser for Admin, Lambda for API). Bypassing these entry points will fail at runtime because the Admin and API contexts (DI containers, routers, GraphQL registries, etc.) are not available outside their respective runtimes.

YOU MUST include the full file path with the .ts or .tsx extension in every src prop. For example, use src={"/extensions/lead/src/index.ts"}, NOT src={"/extensions/lead"}. Omitting the file extension will cause a build failure.

YOU MUST use export default for the createImplementation() call when the file is targeted directly by an Extension src prop. Using a named export (export const Foo = SomeFactory.createImplementation(...)) will cause a build failure. Named exports are only valid inside files registered via createFeature.

// CORRECT — always use entry-point components
<Api.Extension src={import.meta.dirname + "/api/Extension.js"} />
<Admin.Extension src={import.meta.dirname + "/admin/Extension.js"} />

// WRONG — never mount admin/api code directly
<MyAdminComponent />     // Will not have access to Admin DI container
<MyApiFeature />         // Will not have access to API DI container

Package Structure

my-extension/
├── src/
│   ├── index.ts                  # Single public export
│   ├── MyExtension.tsx           # Top-level component (registers Api + Admin)
│   ├── shared/                   # Shared between API and Admin
│   │   ├── constants.ts          # Model IDs, permission names, etc.
│   │   └── types.ts              # Shared types
│   ├── api/                      # API-side code → see webiny-api-architect skill
│   │   ├── Extension.ts
│   │   ├── domain/
│   │   ├── features/
│   │   └── graphql/
│   └── admin/                    # Admin-side code → see webiny-admin-architect skill
│       ├── Extension.tsx
│       ├── features/
│       └── presentation/

Top-Level Component

The top-lev

常见问题

两个入口分别是什么?

一个用于 API,一个用于管理后台,都在顶层组件中注册。

共享规则放在哪里?

放在两端都会使用的共享领域层中。

它会详细讲解每一端的代码吗?

它会指向单独的 API 和管理后台架构技能,以了解这些细节。

详情

作者的原始描述

Full-stack extension skeleton and registration pattern. Use this skill when creating an extension that spans both API and Admin — the top-level component with Api.Extension and Admin.Extension entry points, shared domain layer, BuildParam declarations, and package structure. References webiny-api-architect and webiny-admin-architect for layer-specific details.

repo: webiny/webiny-js

热度

GitHub 星标
8.1k
排名
#12600
许可证
—
更新时间
2026/11/2

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能