UPPER_SNAKE_CASE→ constantscamelCase→ variables, functionsPascalCase→ types, interfaces, components- ❌ Never use
var
src/
├── app/ # App router
├── components/ # UI components
├── config/ # Static configs (links, meta)
├── hooks/ # Custom hooks
├── lib/
│ ├── api/ # Feature logic (fetch/process)
│ └── utils/ # Pure functions (clsx, strings)
├── types/ # Global types
- ✅ Use arrow functions
- ✅ Component name = file name (PascalCase)
- ✅ Small logic/types inside file
- ✅ Reused types →
types/ - ✅ Local logic →
hooks/orlib/api/
typeoverinterface- No
any— useunknownor schema types in prod - Use
types.d.ts,types/feature.d.ts - Schema validation → Zod (optional)
lib/utils/→ pure functions (no fetch or side-effects)lib/api/→ fetch/transform logichooks/→ useSomething logic only
- Prettier = required
- ESLint = required in dev-envoirment if not depricated
npm run lintbefore push (optional)
- ✅ Add this must-have comment at the top of every route file (like
page.tsx) to indicate its route; for example:
// pages/home/page.tsx ← describes the actual route path of this file🔒 This comment stays even in production to help with debugging and clarity across the team.
- ❌ No
console.login prod - ❌ No
.envcommits - ✅ Use
.env.local - ✅ Use
NEXT_PUBLIC_for frontend vars - ✅ Sanitize inputs (must-required)
- Branch:
FEAT/,FIX/,REFACTOR/ - Commit: conventional format or use ai to make
- Pull/rebase before push
- Never push to
maindirectly - Always PR with description
- Prettier run (use Prettier extension in VSCode – required)
- Lint clean (run
npm run lint— optional, but recommended; ESLint extension can be used) - Console.log removed (no logs should remain in any file)
- No comments left (❌ remove all except the top comment in
page.tsxfiles that shows route, e.g.// pages/home/page.tsx) - README / types / config updated (if any structural or API changes were made)