frontend-architecture

Organizes React and React Native apps into feature modules with strict state and import rules.

1|Updated Aug 4, 2026
One-click install
npx skills add https://github.com/Hamzaoui-Louai/LEAN-gym-dashboard-frontend --skill frontend-architecture-hamzaoui-louai
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: frontend-architecture
Source: https://github.com/Hamzaoui-Louai/LEAN-gym-dashboard-frontend/tree/main/.opencode/skills/frontend-architecture
Command: npx skills add https://github.com/Hamzaoui-Louai/LEAN-gym-dashboard-frontend --skill frontend-architecture-hamzaoui-louai

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Frontend codebases often grow into tangled structures where nobody knows where code belongs, what may import what, or whether data is server state or UI state. This Skill provides a portable, framework-agnostic architecture that makes those answers obvious for any React or React Native project. ## Core Features & Use Cases - Feature Module Structure: Organizes apps into self-contained modules/{feature}/ directories with pages, hooks, stores, services, and a single public barrel export. - State Split Enforcement: Separates server state (query/cache layer like TanStack Query or RTK Query) from UI state (Zustand, Redux Toolkit, MobX, or Jotai) with hard rules against mixing them. - Framework Adapters: Maps the same module model onto Next.js App Router, React + Vite, Remix, and Expo/React Native with thin routing layers. - Use Case: When scaffolding a new React + Vite SPA, apply this Skill to create the src/modules/ and src/shared/ layout, wire a typed API client, and build the first feature as a page directory with co-located styles. ## Quick Start Ask the AI to scaffold a new feature module for invoice management following the frontend-architecture structure with a page directory, store, and barrel export.

Frequently Asked Questions about frontend-architecture

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

FAQPage Schema
How do I structure a React app with feature modules?

Create a `modules/{feature}/` directory per product capability containing pages, components, hooks, stores, services, and an `index.ts` barrel. Other modules and the routing layer import only from that barrel, never from internal paths.

What is the difference between server state and UI state in React?

Server state is data the API owns, like fetched entities and lists, and belongs in a query/cache layer such as TanStack Query or RTK Query. UI state is client-only, like open dialogs or filters, and belongs in a store such as Zustand or Redux Toolkit.

Zustand vs Redux Toolkit for module UI state?

Both map onto the one-store-unit-per-module rule. Zustand uses a `useFeatureUiStore` hook in `{feature}.store.ts`, while Redux Toolkit uses a slice in `{feature}.slice.ts` registered in `shared/store/`. Pick one per project and stay consistent.

Does this architecture work with Next.js App Router?

Yes. Route files in `src/app/` stay thin and only mount page components imported from module barrels. Server Components are the default, with interactive leaves marked `"use client"` and providers placed in a client boundary.

Can I use this structure with Expo or React Native?

Yes. Pages become screens using the same directory pattern, routing uses Expo Router or React Navigation with thin screen files, and the query layer, client store, and typed API client work unchanged. Tamagui is recommended for shared web and native styling.

When should a component move to the shared folder?

A component moves to `shared/components/` only when a second module consumes it. Components start in the narrowest scope, such as a page's local `components/` folder, and are promoted deliberately rather than pre-placed.