Skillpedia
واجهات API والخوادم (backend)8.1k · #12583

webiny-api-architect

ما الذي تفعله

تمنح هذه المهارة ذكاءك القواعد الأساسية لبناء كود الخلفية على Webiny API. وهي لمطورين يكتبون امتدادات تضيف منطق عمل إلى مشروع Webiny.

متى تستخدمها

  • ✓عندما تبني أي ميزة خلفية أو امتداد لـWebiny API.
  • ✓عندما تحتاج إلى تحديد هل يكون المنطق خدمة أو حالة استخدام.
  • ✓عندما تريد تنظيم ميزة خلفية جديدة في المجلدات والتسجيلات الصحيحة.

رابط المهارة

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

انسخه والصقه في الذكاء الاصطناعي الذي تستخدمه (Claude أو ChatGPT أو Cursor) واطلب منه اتباع التعليمات.

طريقة الاستخدام

أسهل طريقة: انسخ الرسالة والصقها في الذكاء الاصطناعي الذي تستخدمه. سيقرأ المهارة وينفّذ تعليماتها.

رسالة جاهزة للصق

استخدم هذه المهارة لمساعدتي: https://github.com/webiny/webiny-js/blob/next/skills/user-skills/api/api-architect/SKILL.md اقرأ ملف SKILL.md في هذا الرابط ونفّذ تعليماته لمهمتي.
تريد أن يجد الذكاء الاصطناعي مهارات مثل هذه بنفسه؟ثبّت خادم Skillpedia MCP المجاني: سطر واحد، ويبحث في 15,000+ مهارة قبل كل مهمة.ثبّته في دقيقة واحدة →

مثال على ما تطلبه من الذكاء الاصطناعي

“ابنِ ميزة خلفية في Webiny تحسب تكاليف الشحن، مع اتباع قواعد البنية في المشروع.”

5 مهارات جديدة كل أسبوع. قراءة في دقيقة واحدة.

كيف تعمل

تشرح المهارة الفرق بين الخدمات وحالات الاستخدام، وكيفية تسمية الميزات حسب الغرض التجاري، وكيفية تسجيلها في حاوية التبعيات. وتذكر أيضًا الأخطاء الشائعة التي يجب تجنبها.

المحتوى التقني (ملف SKILL.md الأصلي)

النص الأصلي من المؤلف، مباشرة من GitHub.

API Architecture Patterns

TL;DR

API extensions use createFeature to register features into the DI container. Each feature is a vertical slice with abstractions, implementations, and a feature.ts registration file. The key abstractions are Services (multi-method, singleton) and UseCases (single-method orchestrators, transient). Repositories handle persistence via CMS. Features are named by business capability, files inside by technical responsibility.

Working Context

This skill applies to both extension developers (working in extensions/) and core developers (working in packages/). The architecture patterns are identical — only imports and registration differ.

Extensions (extensions/) Core (packages/)
Imports webiny/api, webiny/api/cms/model, etc. @webiny/feature/api, @webiny/api-headless-cms/..., etc.
Catalog paths Use the Import: path Use the Source: path
Entry point export default createFeature(...) in a file targeted by <Api.Extension src={...}> createFeature registered by the package initializer
GraphQL schemas export default GraphQLSchemaFactory.createImplementation(...) — registered via container.register() inside the entry point's createFeature Same pattern, but imported from @webiny/handler-graphql

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

Architecture Overview

Extension (root) ── registers ──> Features + GraphQL Schemas + Models
    Feature ── registers ──> UseCase | Service | EventHandler + Repository
        UseCase ── depends on ──> Service | Repository (+ EventPublisher)
            Repository ── depends on ──> CMS Use Cases (GetModel, CreateEntry, etc.)
        Service ── depends on ──> external APIs, other Services
  • Extension: Top-level entry point. Registers all features, GraphQL schemas, and CMS models.
  • Feature: A vertical slice. Registers its use cases, services, repositories, and event handlers.
  • UseCase: Single-method orchestrator (execute()). Coordinates services, repositories, and events. Transient scope.
  • Service: Multi-method abstraction for external API calls or cohesive domain logic. Singleton scope.
  • Repository: Persistence layer using CMS as storage. Singleton scope.
  • EventHandler: Thin orchestrator reacting to domain events. Delegates to services/use cases.
  • GraphQL Schema: Defines types, inputs, queries, and mutations. Resolvers delegate to use cases.
  • CMS Model: Defines the data schema stored in headless CMS.

Services vs UseCases

Services

Multi-method abstractions for external API calls or cohesive domain logic. A service groups related operations that belong together.

// abstractions.ts
export interface ILingotekService {
  translate(documentId: string, targetLocale: string): Promise<Result<void, Error>>;
  getTranslationStatus(documentId: string): Promise<Result<TranslationStatus, Error>>;
  deleteProject(projectId: string): Promise<Result<void, Error>>;
}

export const LingotekService = createAbstraction<ILingotekService>("MyExt/LingotekService");

export namespace LingotekService {
  export type Interface = ILingotekService;
}
  • Registered in singleton scope (.inSingletonScope())
  • Located in: features/{serviceName}/ or features/services/{serviceName}/
  • One service per external system or cohesive domain area
  • If async bootstrap is needed (loading settings from CMS, fetching remote config): use the ServiceProvider pattern — a provider abstraction with async getService() that lazily initializes and caches the service. Consumers inje
الأسئلة الشائعة

ما الفرق بين الخدمة وحالة الاستخدام؟

الخدمة لها عدة دوال وتُشارَك، أما حالة الاستخدام فلها دالة واحدة لعملية واحدة.

كيف تُسمّى الميزات؟

تُسمّى الميزات حسب القدرة التجارية، والملفات داخلها حسب دورها التقني.

هل تغطي جانب الإدارة؟

لا. تغطي أنماط الإدارة مهارات Webiny الإدارية المنفصلة.

التفاصيل

الوصف الأصلي من المؤلف

The hub skill for all API/backend architecture in Webiny. Covers architecture overview, Services vs UseCases, feature naming and organization, feature structure templates, DI decision tree, anti-patterns, createFeature, createAbstraction, container registration, domain errors, entity patterns, naming conventions, scoping rules, and code conventions. Use this skill for ANY backend API work — it references sub-skills for deep implementation details.

repo: webiny/webiny-js

الشعبية

نجوم GitHub
8.1k
الترتيب
#12583
الترخيص
—
آخر تحديث
2‏/11‏/2026

هل هذه المهارة مفيدة؟

0

سجّل الدخول للتصويت.

التعليقات

  • …

المزيد من المهارات من هذا المستودع

مهارات مشابهة