Pular para o conteúdo
Skillpedia
APIs e servidores (backend)8,1 mil · #12583

webiny-api-architect

O que ela faz

Esta skill dá à sua IA as principais regras para construir código de backend na API do Webiny. É para desenvolvedores que escrevem extensões que acrescentam lógica de negócio a um projeto Webiny.

Quando usar

  • ✓Quando você constrói qualquer funcionalidade ou extensão de backend para uma API Webiny.
  • ✓Quando você precisa decidir entre um service e um use case para um trecho de lógica.
  • ✓Quando você quer organizar uma nova funcionalidade de backend nas pastas e registros certos.

Link da skill

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

Copie e cole na sua IA (Claude, ChatGPT ou Cursor) pedindo para seguir as instruções.

Como usar

O jeito mais fácil: copie a mensagem e cole na sua IA. Ela lê a skill e segue as instruções.

Mensagem pronta para colar

Use esta skill para me ajudar: https://github.com/webiny/webiny-js/blob/next/skills/user-skills/api/api-architect/SKILL.md Leia o arquivo SKILL.md desse link e siga as instruções dele na minha tarefa.
Quer que a sua IA encontre skills como esta sozinha?Instale o MCP grátis do Skillpedia: uma linha, e ela pesquisa entre 15.000+ skills antes de cada tarefa.Instalar em 1 minuto →

Exemplo do que pedir para a IA

“Construa uma funcionalidade de backend no Webiny que calcule o custo de envio, seguindo as regras de arquitetura do projeto.”

5 skills novas por semana. 1 minuto de leitura.

Como funciona

A skill explica a diferença entre services e use cases, como as funcionalidades são nomeadas pela finalidade de negócio e como são registradas no contêiner de dependências. Também lista erros comuns a evitar.

Conteúdo técnico (SKILL.md original)

Texto original do autor, em inglês, direto do 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
Perguntas frequentes

Qual é a diferença entre um service e um use case?

Um service tem vários métodos e é compartilhado, enquanto um use case tem um único método para uma operação.

Como as funcionalidades são nomeadas?

Pela capacidade de negócio, e os arquivos internos pelo papel técnico.

Ela cobre o lado do admin?

Não. Os padrões de admin são cobertos por skills separadas de arquitetura administrativa do Webiny.

Detalhes

Descrição original do autor

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

Popularidade

Estrelas no GitHub
8,1 mil
Posição no ranking
#12583
Licença
—
Atualizada em
02/11/2026

Essa skill é útil?

0

Entre para votar.

Comentários

  • …

Mais skills deste repositório

Skills parecidas