webiny-project-structure
Skill này làm gì
Giải thích cấu trúc thư mục của dự án Webiny và vai trò của file cấu hình chính. Dành cho lập trình viên mới làm quen với Webiny và cần biết nên đặt code ở đâu.
Khi nào nên dùng
- ✓Khi lập trình viên hỏi nên đặt code tùy chỉnh ở đâu trong dự án Webiny.
- ✓Khi lập trình viên muốn biết file webiny.config.tsx làm gì.
- ✓Khi lập trình viên cần đăng ký một extension mới trong dự án Webiny.
Liên kết skill
https://github.com/webiny/webiny-js/blob/next/skills/user-skills/project-structure/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Tôi nên đặt code tùy chỉnh của mình ở đâu trong dự án Webiny?”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Skill giải thích các thư mục chính và file cấu hình, nơi mọi extension được đăng ký. AI dùng thông tin này để đặt code mới vào đúng vị trí.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
Webiny Project Structure
TL;DR
A Webiny project has a flat structure centered around webiny.config.tsx -- the single configuration file where all extensions are registered. Custom code lives in the extensions/ folder. Extensions are registered as React components (<Api.Extension>, <Admin.Extension>, <Infra.*>, <Cli.Command>) and can be conditionally loaded per environment.
Project Layout
my-webiny-project/
├── extensions/ # All custom code -- API, Admin, Infra, CLI extensions
│ └── README.md
├── public/ # Static assets for the Admin app
│ ├── favicon.ico
│ ├── global.css
│ ├── index.html
│ └── robots.txt
├── package.json # Single package.json for the whole project
├── tsconfig.json # Single TypeScript config
├── webiny.config.tsx # Main configuration -- all extensions registered here
├── webiny-env.d.ts # TypeScript environment types
└── yarn.lock
Key points:
- Single
package.json-- no monorepo, no workspaces needed. - Single
tsconfig.json-- straightforward TypeScript setup. webiny.config.tsx-- the entry point for everything. All extensions, infrastructure options, and project settings are declared here.extensions/-- where all your custom code lives. Organize with subfolders as needed (e.g.,extensions/contactSubmission/,extensions/AdminBranding/).
The webiny.config.tsx File
This file exports a single React component called Extensions. It uses JSX to declaratively register all configuration:
// webiny.config.tsx
import React from "react";
import { Admin, Api, Cli, Infra, Project, Security } from "webiny/extensions";
import { Cognito } from "@webiny/cognito";
export const Extensions = () => {
return (
<>
{/* Infrastructure configuration */}
<Infra.Aws.DefaultRegion name={"us-east-1"} />
<Infra.Core.OpenSearch enabled={true} />
<Infra.Aws.Tags tags={{ OWNER: "me", PROJECT: "my-project" }} />
{/* Identity provider */}
<Cognito />
{/* API extensions (backend) */}
<Api.Extension src={"/extensions/ProductCategoryModel.ts"} />
<Api.Extension src={"/extensions/ProductModel.ts"} />
<Api.Extension src={"/extensions/contactSubmission/ContactSubmissionHook.ts"} />
{/* Security hooks */}
<Api.Extension src={"/extensions/MyApiKey.ts"} />
<Security.ApiKey.AfterUpdate src={"/extensions/MyApiKeyAfterUpdate.ts"} />
{/* Admin extensions (frontend) */}
<Admin.Extension src={"/extensions/AdminTheme/AdminTheme.tsx"} />
<Admin.Extension src={"/extensions/AdminTitleLogo/AdminTitleLogo.tsx"} />
<Admin.Extension src={"/extensions/contactSubmission/EmailEntryListColumn.tsx"} />
{/* Infrastructure / Pulumi extensions */}
<Infra.Core.Pulumi src={"/extensions/MyCorePulumiHandler.ts"} />
{/* CLI extensions */}
<Cli.Command src={"/extensions/MyCustomCommand.ts"} />
{/* Project settings */}
<Project.Telemetry enabled={false} />
</>
);
};
Extension Types
| JSX Element | What It Does | File Type |
|---|---|---|
<Api.Extension src="..." /> |
Registers a backend extension (GraphQL schemas, content models, lifecycle hooks) | .ts |
<Admin.Extension src="..." /> |
Registers a frontend Admin UI extension (themes, branding, custom columns, custom forms) | .tsx |
<Infra.Core.Pulumi src="..." /> |
Registers a Pulumi infrastructure handler | .ts |
<Cli.Command src="..." /> |
Registers a custom CLI command | .ts |
<Security.ApiKey.AfterUpdate src="..." /> |
Registers a security lifecycle hook | .ts |
YOU MUST include the full file path with the .ts or .tsx extension in every src prop. For example, use src={"/extensions/MyModel.ts"}, NOT src={"/extensions/MyModel"}. 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 Extensio
Câu hỏi thường gặp
Thư mục extensions dùng để làm gì?
Nó chứa code tùy chỉnh cho các phần API, admin, hạ tầng và dòng lệnh của dự án.
Dự án Webiny có dùng nhiều file package không?
Không. Skill nói dự án có một package.json và một tsconfig.json, không dùng cấu trúc monorepo.
Những loại extension nào được đăng ký?
Skill liệt kê extension API, admin, hạ tầng và dòng lệnh, được thêm dưới dạng thành phần trong file cấu hình.
Chi tiết
Mô tả gốc của tác giả
Webiny project layout, webiny.config.tsx anatomy, and extension registration. Use this skill when the developer asks about folder structure, where custom code goes, how to register extensions, what webiny.config.tsx does, or how the project is organized. Also use when they need to understand the relationship between extensions/, webiny.config.tsx, and the different extension types (Api, Admin, Infra, CLI).
repo: webiny/webiny-js
Độ phổ biến
- Sao GitHub
- 8.1k
- Vị trí xếp hạng
- #12616
- Giấy phép
- —
- Cập nhật
- 2/11/2026
Bình luận
- …
Thêm skill từ kho mã này
prd-to-plan
8.1kGiúp agent của bạn biến tài liệu yêu cầu sản phẩm thành kế hoạch theo giai đoạn gồm các lát cắt đầu-cuối nhỏ, lưu thành file Markdown.
webiny-admin-architect
8.1kDạy agent của bạn cách xây dựng màn hình quản trị cho nền tảng Webiny, dùng các tầng logic nghiệp vụ và mẫu presenter.
webiny-admin-permissions
8.1kDạy agent của bạn thêm kiểm soát quyền vào màn hình quản trị Webiny, gồm form quyền tự sinh và kiểm tra ẩn hoặc hiện.
webiny-form-model
8.1kDạy agent của bạn xây dựng form trong Webiny bằng trình tạo trường khai báo, bố cục, kiểm tra hợp lệ và quy tắc có điều kiện.
Skill tương tự
diffs
394kGiúp agent của bạn tạo một diff có thể chia sẻ về các chỉnh sửa, dưới dạng liên kết xem hoặc file ảnh, thay vì một bản tóm tắt viết tay.
coding-agent
394kGiúp agent của bạn giao một việc lập trình lớn cho Codex, Claude Code hoặc OpenCode chạy nền, rồi theo dõi tiến độ của nó.
gh-issues
394kGiúp agent của bạn tìm issue trên GitHub, chọn những issue cần xử lý và mở pull request với bản sửa, kể cả theo dõi nhận xét đánh giá.