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/
type
overinterface
- No
any
— useunknown
or 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 lint
before 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.log
in prod - ❌ No
.env
commits - ✅ 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
main
directly - 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.tsx
files that shows route, e.g.// pages/home/page.tsx
) - README / types / config updated (if any structural or API changes were made)
git clone https://github.com/deenify/api.git
cd api
npm i