ABOUT

MENU

How I Structure My React Projects in 2025

Interfaces

10/18/25

INTRODUCTION

Over the years, my React project structure has evolved a lot. By 2025, I’ve landed on a system that balances scalability, clarity, and simplicity.

1. THE HIGH-LEVEL FOLDER STRUCTURE

bash

/src
  /app
  /components
  /hooks
  /lib
  /features
  /styles
  • app/ → pages and routes (Next.js or React Router)

  • components/ → reusable UI pieces

  • hooks/ → custom React hooks

  • lib/ → utilities (formatters, API clients)

  • features/ → domain-specific functionality

  • styles/ → global CSS or Tailwind config

2. CO-LOCATE FEATURE FILES

Each feature gets its own folder with components, hooks, and tests.

bash

/features/auth
  LoginForm.tsx
  useAuth.ts
  authService.ts

This avoids “giant components” and keeps concerns modular.

3. NAMING CONVENTIONS

  • Components: PascalCase

  • Hooks: useSomething.ts

  • Services: somethingService.ts

  • Tests: *.test.tsx

4. STATE MANAGEMENT IN 2025

With React Server Components, state management is simpler. For local state, I use useState/useReducer. For global, I prefer Zustand or React Query for server state.

ts

// authStore.ts
import { create } from 'zustand';
export const useAuthStore = create(set => ({
  user: null,
  login: (u) => set({ user: u }),
}));

5. TESTING STRATEGY

I keep tests close to the feature. Jest + React Testing Library handle most cases.

test("renders login form", () => {
  render(<LoginForm />);
  expect(screen.getByText("Login")).toBeInTheDocument();
});

CONCLUSION

A good React project structure doesn’t have to be overcomplicated. Keep features modular, co-locate files, use modern state tools, and maintain naming discipline.


INTRODUCTION

Over the years, my React project structure has evolved a lot. By 2025, I’ve landed on a system that balances scalability, clarity, and simplicity.

1. THE HIGH-LEVEL FOLDER STRUCTURE

bash

/src
  /app
  /components
  /hooks
  /lib
  /features
  /styles
  • app/ → pages and routes (Next.js or React Router)

  • components/ → reusable UI pieces

  • hooks/ → custom React hooks

  • lib/ → utilities (formatters, API clients)

  • features/ → domain-specific functionality

  • styles/ → global CSS or Tailwind config

2. CO-LOCATE FEATURE FILES

Each feature gets its own folder with components, hooks, and tests.

bash

/features/auth
  LoginForm.tsx
  useAuth.ts
  authService.ts

This avoids “giant components” and keeps concerns modular.

3. NAMING CONVENTIONS

  • Components: PascalCase

  • Hooks: useSomething.ts

  • Services: somethingService.ts

  • Tests: *.test.tsx

4. STATE MANAGEMENT IN 2025

With React Server Components, state management is simpler. For local state, I use useState/useReducer. For global, I prefer Zustand or React Query for server state.

ts

// authStore.ts
import { create } from 'zustand';
export const useAuthStore = create(set => ({
  user: null,
  login: (u) => set({ user: u }),
}));

5. TESTING STRATEGY

I keep tests close to the feature. Jest + React Testing Library handle most cases.

test("renders login form", () => {
  render(<LoginForm />);
  expect(screen.getByText("Login")).toBeInTheDocument();
});

CONCLUSION

A good React project structure doesn’t have to be overcomplicated. Keep features modular, co-locate files, use modern state tools, and maintain naming discipline.


Create a free website with Framer, the website builder loved by startups, designers and agencies.