In latest NextJS, what is the folder structure for a scalable frontend project
- User
In latest NextJS, what is the folder structure for a scalable frontend project
Assistant
For a scalable Next.js project (as of late 2024), I'd recommend this folder structure:
/app /api # API routes /(routes) # App router pages /layout.tsx # Root layout /components /ui # Reusable UI components /features # Feature-specific components /layouts # Layout components /lib /utils # Utility functions /hooks # Custom React hooks /services # API service functions /styles # Global styles /public # Static assets /types # TypeScript type definitions /config # App configurationThis structure leverages Next.js 14's App Router, separates concerns clearly, and scales well as your project grows. The
/componentsdirectory uses a component-driven approach with clear separation between UI primitives and feature components.Would you like me to explain any specific part of this structure in more detail?
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.