Langsung ke konten
Skillpedia
Pemrograman umum8.1k ยท #12616

webiny-project-structure

Fungsinya

Menjelaskan tata letak folder proyek Webiny dan peran file konfigurasi utamanya. Skill ini untuk developer yang baru mengenal Webiny dan perlu tahu di mana menempatkan kode mereka.

Kapan dipakai

  • โœ“Saat developer bertanya di mana kode kustom sebaiknya diletakkan di proyek Webiny.
  • โœ“Saat developer ingin tahu apa fungsi file webiny.config.tsx.
  • โœ“Saat developer perlu mendaftarkan ekstensi baru di proyek Webiny.

Link skill

https://github.com/webiny/webiny-js/blob/next/skills/user-skills/project-structure/SKILL.md

Salin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.

Cara pakai

Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.

Pesan siap tempel

Gunakan skill ini untuk membantu saya: https://github.com/webiny/webiny-js/blob/next/skills/user-skills/project-structure/SKILL.md Baca file SKILL.md di link tersebut dan ikuti instruksinya untuk tugas saya.
Mau AI Anda menemukan skill seperti ini sendiri?Pasang MCP Skillpedia gratis: cukup satu baris, dan AI mencari di antara 15.000+ skill sebelum tiap tugas.Pasang dalam 1 menit โ†’

Contoh permintaan ke AI

โ€œDi mana saya harus menempatkan kode kustom di proyek Webiny saya?โ€

5 skill baru setiap minggu. 1 menit baca.

Cara kerjanya

Skill ini menjelaskan folder utama dan file konfigurasi, tempat semua ekstensi didaftarkan. AI memakai ini untuk menempatkan kode baru di lokasi yang tepat.

Konten teknis (SKILL.md asli)

Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.

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

Pertanyaan umum

Untuk apa folder extensions?

Folder ini berisi kode kustom untuk bagian API, admin, infrastruktur, dan command-line proyek.

Apakah proyek Webiny memakai beberapa file package?

Tidak. Skill ini menyatakan proyek memiliki satu package.json dan satu tsconfig.json, tanpa pengaturan monorepo.

Jenis ekstensi apa saja yang didaftarkan?

Skill ini mencantumkan ekstensi API, admin, infrastruktur, dan command-line, yang ditambahkan sebagai komponen di file konfigurasi.

Detail

Deskripsi asli dari pembuat

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

Popularitas

Bintang GitHub
8.1k
Peringkat
#12616
Lisensi
โ€”
Diperbarui
2/11/2026

Apakah skill ini berguna?

0

Masuk untuk memberi suara.

Komentar

  • โ€ฆ

Skill lain dari repositori ini

Skill serupa