React/Next.js naming conventions for clarity and scalability.
Naming conventions matter a lot in Next.js and modern frontend projects for clarity and scalability. Hereβs a quick breakdown of the best naming conventions used in real-world Next.js + TypeScript projects
π§± Folder & File Naming Guidelines
1. Folders
β Lowercase-with-dashes (or just lowercase)
β‘οΈ Easy to type, consistent with most open-source repos.
Example:
2. React Components
β PascalCase (FileUpload.tsx)
β‘οΈ Matches how React components are named (<FileUpload />).
Examples:
3. Hooks
β camelCase with use prefix
β‘οΈ Matches Reactβs naming convention for hooks.
Examples:
4. Utility Files
β camelCase or kebab-case
β‘οΈ For reusable helpers that arenβt components or hooks.
Examples:
5. Feature-Based Folders (recommended for scaling apps)
As your app grows, use feature-based structure inside src/features/:
6. Next.js app folder
β Keep route folders lowercase (matches URL path).
β Use PascalCase only for component files inside.
Example:
β Summary
TypeConventionExample
Folder
lowercase / kebab-case
components, use-hooks
Component
PascalCase
FileUpload.tsx
Hook
camelCase (with use)
useAuth.ts
Utility
camelCase / kebab-case
formatDate.ts
Route Folder
lowercase
/auth/login/page.tsx