feature-driven-architecture

🧭 Feature-Driven Architecture (FDA) for Next.js & React

Stop arguing about folder structures β€” start shipping features.

FDA Banner


πŸš€ What Is FDA?

Feature-Driven Architecture (FDA) is a scalable way to organize modern React or Next.js projects β€” built around features, not file types. Instead of scattering logic across folders (components/, hooks/, api/, …), FDA makes each feature a self-contained mini-app with its own UI, logic, state, and API.

It’s the architecture used in Klickbee CMS β€” but it’s framework-agnostic and works beautifully in any Next.js project.


🧩 Why It Matters

Problem FDA Solution
Bloated components/ folder Every feature owns its components
Refactors break unrelated code Features are isolated & independent
Hard onboarding for new devs Predictable, self-contained structure
No scalability for large teams Each team can own a feature domain

FDA gives you clarity, velocity, and maintainability β€” no more β€œwhere do I put this file?” debates.


πŸ—‚οΈ Folder Structure Example

src/
β”œβ”€β”€ app/                  β†’ Next.js App Router (public & admin routes)
β”œβ”€β”€ feature/              β†’ Core feature modules
β”‚   β”œβ”€β”€ user/
β”‚   β”‚   β”œβ”€β”€ api/          β†’ Next.js API handlers
β”‚   β”‚   β”œβ”€β”€ components/   β†’ UI specific to user feature
β”‚   β”‚   β”œβ”€β”€ queries/      β†’ React Query hooks
β”‚   β”‚   β”œβ”€β”€ stores/       β†’ Zustand state
β”‚   β”‚   β”œβ”€β”€ schemas/      β†’ Zod validation
β”‚   β”‚   └── lib/          β†’ Server actions / business logic
β”‚   └── settings/...
β”œβ”€β”€ shared/               β†’ Cross-feature logic (UI, hooks, lib)
β”œβ”€β”€ providers/            β†’ React context providers
β”œβ”€β”€ styles/               β†’ Global styles & tokens
└── types/                β†’ Shared TypeScript types

πŸ‘‰ Each feature is plug-and-play β€” add or remove one without touching the others.


πŸ’‘ Core Concepts


🧠 Design Patterns

Concern Location Tech
Server actions lib/ Next.js server actions
API handlers api/ Next.js route handlers
Data fetching queries/ + options/ React Query
Local state stores/ Zustand
Validation schemas/ Zod
Typing types/ TypeScript

🧬 Example Integration

// src/app/api/admin/user/route.ts
export { GET, POST } from "@/feature/user/api/apiUser";
// src/app/admin/user/page.tsx
import { useUsers } from "@/feature/user/queries/useUsers";
import { UserTable } from "@/feature/user/components/UserTable";

export default function Page() {
  const { data } = useUsers();
  return <UserTable users={data} />;
}


πŸ“– Learn More


🀝 Contributing

FDA thrives on community feedback. You can help by:

The first contributor to open a PR gets a permanent mention in the README ⚑


πŸ§‘β€πŸ’» Author

Julien Mauclair β€” Founder of Klickbee CMS 🧠 Building scalable architecture for modern web teams. LinkedIn β€’ Medium


🧱 License

MIT Β© 2025 β€” Use, remix, and build freely.


🧠 TL;DR

Organize by feature, not by type. FDA = clarity + scalability + autonomy. Stop managing chaos, start shipping features. πŸš€