project-structure

Organize React/Next.js/TypeScript code into feature-based module directories.

Updated Apr 17, 2026
One-click install
npx skills add https://github.com/Chris-Maskey/opencode-config --skill project-structure-chris-maskey
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: project-structure
Source: https://github.com/Chris-Maskey/opencode-config/tree/main/skills/project-structure
Command: npx skills add https://github.com/Chris-Maskey/opencode-config --skill project-structure-chris-maskey

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This guide helps teams organize code by feature/domain, improving maintainability, scalability, and collaboration when building React/Next.js/TypeScript projects.

Core Features & Use Cases

  • Feature-based module organization: groups code by domain under src/features, enabling independent shipping and clearer ownership.
  • Enforced unidirectional dependencies: promotes boundaries (app/routes, features, shared) to reduce cross-feature imports and coupling.
  • Practical templates: provides a recommended directory structure and placement guidelines (app, features, components, api, stores, utils).

Quick Start

Use this structure as a template when starting a new React/Next.js/TypeScript project to organize code by feature.

Frequently Asked Questions about project-structure

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

FAQPage Schema
What is a feature-based project structure in React and TypeScript?

A feature-based project structure organizes code by domain under src/features, grouping related components, APIs, and stores together. This improves maintainability and enables independent shipping with clearer team ownership.

How do I organize a Next.js project to reduce cross-file coupling?

To reduce cross-file coupling in Next.js, enforce unidirectional dependencies by separating code into app/routes, features, and shared directories. This establishes boundaries that prevent cross-feature imports and reduce coupling.

When should I use a feature-based directory structure for my React app?

Use a feature-based directory structure for medium-to-large React applications requiring scalable module boundaries. It is ideal when multiple teams need clear feature ownership and independent shipping capabilities.

What's the best way to structure a scalable TypeScript project?

The best way to structure a scalable TypeScript project is using feature-based organization with top-level directories like src, app, features, and components. This provides placement templates and enforces unidirectional dependencies.

How do I set up feature modules in a React TypeScript project?

Set up feature modules by creating a src/features directory and grouping domain-specific code with subdirectories for components, api, stores, and utils. Avoid empty folders and ensure each feature has clear boundaries.

Does feature-based code organization work with Next.js app router?

Yes, feature-based code organization works with Next.js by using the app directory for routes while keeping feature modules under src/features. This maintains unidirectional dependencies and scalable module boundaries.