clean-architecture-frontend

Implement Clean Architecture layers in Next.js frontend projects.

Updated Jan 31, 2026
One-click install
npx skills add https://github.com/JordiNodeJS/.github-config --skill clean-architecture-frontend
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: clean-architecture-frontend
Source: https://github.com/JordiNodeJS/.github-config/tree/main/.github/skills/clean-architecture-frontend
Command: npx skills add https://github.com/JordiNodeJS/.github-config --skill clean-architecture-frontend

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill provides a structured blueprint for implementing Clean Architecture in Next.js 16 App Router projects, helping teams separate concerns and maintainability.

Core Features & Use Cases

  • Layered architecture: Domain, Application, Infrastructure, Delivery with strict dependency direction.
  • Use cases & ports: Define use cases as interactors and ports as interfaces to decouple business rules from frameworks.
  • DI-friendly: Lightweight factory approach to compose repositories and services for UI layers.

Quick Start

Create or refactor a feature by moving business rules from UI code into a domain model and a corresponding use-case, then wire it through a factory in the Delivery layer to execute the use case from a Server Action.

Frequently Asked Questions about clean-architecture-frontend

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I enforce clean architecture in Next.js App Router projects?

To enforce clean architecture in Next.js, you structure your project into four layers: Domain, Application, Infrastructure, and Delivery. This blueprint enforces dependency rules to keep business logic framework-agnostic and uses ports with use cases to decouple rules from frameworks.

What is the best way to decouple business logic from Next.js UI components?

The best way to decouple business logic from Next.js UI components is by moving rules into a domain model and a corresponding use case. You then wire these use cases through a factory in the Delivery layer to execute them from Server Actions.

How does dependency injection work for use cases in a Next.js frontend?

Dependency injection for use cases in a Next.js frontend works through a lightweight factory approach. This factory composes repositories and services, wiring the Application layer into the Delivery layer so the UI can execute use cases without direct framework coupling.

Can I use ports and adapters patterns with Next.js Server Actions?

Yes, you can use ports and adapters with Next.js Server Actions by defining ports as interfaces and use cases as interactors. You wire them through a factory in the Delivery layer, allowing Server Actions to execute the use cases seamlessly.

When do I need a four-layer architecture for my Next.js application?

You need a four-layer architecture for your Next.js application when you must separate concerns and maintainability at scale. Defining Domain, Application, Infrastructure, and Delivery layers ensures strict dependency direction for framework-agnostic business rules.

What are the limitations of using clean architecture patterns in Next.js?

A limitation of using clean architecture patterns in Next.js is the added boilerplate from defining domain models, ports, and factories. You must enforce the strict dependency direction manually across the four layers to prevent framework code from leaking into the Domain.