Skip to content
Skillpedia
APIs & servers (backend)8.1k Β· #12583

webiny-api-architect

What it does

This skill gives your AI the main rules for building backend code on the Webiny API. It is for developers writing extensions that add business logic to a Webiny project.

When to use it

  • βœ“When you build any backend feature or extension for a Webiny API.
  • βœ“When you need to decide between a service and a use case for a piece of logic.
  • βœ“When you want to organize a new backend feature into the right folders and registrations.

Skill link

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

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

Ready-to-paste message

Use this skill to help me: https://github.com/webiny/webiny-js/blob/next/skills/user-skills/api/api-architect/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute β†’

Example of what to ask your AI

β€œBuild a backend feature in Webiny that calculates shipping costs, following the project's architecture rules.”

5 new skills a week. 1 minute to read.

How it works

The skill explains the difference between services and use cases, how features are named by business purpose, and how they are registered in the dependency container. It also lists common mistakes to avoid.

Technical content (original SKILL.md)

Original text by the author, straight from 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
FAQ

What is the difference between a service and a use case?

A service has several methods and is shared, while a use case has one method for a single operation.

How are features named?

Features are named by business capability, and the files inside by their technical role.

Does it cover the admin side?

No. Admin patterns are covered by separate Webiny admin skills.

Details

Original description by the author

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

Popularity

GitHub stars
8.1k
Ranking position
#12583
License
β€”
Updated
11/2/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills