Naming Conventions (Frontend Standard)
Components
- React components:
PascalCase- File:
Button.tsx - Component:
export function Button(...) { ... }
- File:
- Component folders:
PascalCaseper component (Button/,ConfirmModal/).
Hooks
- Hooks must start with
use:useAuth(),useBillingPlan()
- Files:
useAuth.tsoruseAuth.tsx(only if it renders JSX).
Features
- Feature folder names:
kebab-caseorsnake_caseis acceptable, but pick one per repo and be consistent.- Example:
src/features/billing/
- Example:
API and schemas
- Feature API entry file:
api.ts - Feature schemas file:
schemas.ts - Shared client wrapper:
src/lib/apiClient.ts
Tests
- Component tests:
ComponentName.test.tsx - Hook tests:
useThing.test.ts
Barrels (index.ts)
Use index.ts to define the public API of a folder (especially for src/components/...):
- Export only what consumers should import.
- Avoid “giant barrels” that re-export the entire app.