Next.js frontend projesi. Bu dosya Claude Code icin proje kurallarini tanimlar.
- Framework: Next.js 16 (App Router)
- Dil: TypeScript 5 (strict mode)
- Styling: Tailwind CSS 4
- Linting: ESLint 9 (flat config) + Prettier
- Test: Vitest + React Testing Library (unit/component), Playwright (E2E)
- Font: Geist Sans / Geist Mono (
next/font/google)
- Tum dosyalar TypeScript (
.ts/.tsx) - Path alias:
@/kullan (ornek:@/components/Button) - Prettier ayarlari: cift tirnak, 100 karakter satir, trailing comma
- Commit formati: conventional commits (
feat:,fix:,docs:,refactor:)
- Server Component varsayilan — sadece gerektiginde
"use client"ekle "use client"gereken durumlar: useState, useEffect, onClick, onChange, tarayici API'leri- Sayfa dosyalari:
app/[route]/page.tsx - Layout dosyalari:
app/[route]/layout.tsx - API route'lari:
app/api/[route]/route.ts - Metadata: her sayfada
export const metadata: Metadatatanimla - Loading UI:
loading.tsx, Error UI:error.tsx, Not Found:not-found.tsx
@import "tailwindcss"soz dizimi (eski@tailwinddegil)- Ozel renkler
@theme inlineblogu icerisinde tanimlanir - Dark mode:
dark:prefix ile (sistem tercihine gore)
- Component'ler
components/klasorunde - Props icin TypeScript interface tanimla (type degil, interface)
- Default export kullan
- Dosya adi: PascalCase (
Button.tsx,UserCard.tsx)
- Hook'lar
hooks/klasorunde - Dosya adi: camelCase,
useprefix (useAuth.ts,useDebounce.ts) - Named export kullan
- Test dosyalari:
__tests__/klasorunde,.test.tsxuzantisi - Component testlerinde
@testing-library/reactkullan — DOM query'leri icinscreenkullan - Kullanici etkilesimi icin
@testing-library/user-eventkullan (fireEventdegil) - Her component icin en az: render, interaction ve edge case testleri yaz
- Mock'lar icin
vi.fn()vevi.mock()kullan npm testile calistir,npm run test:watchile izleme modunda calistir
- Test dosyalari:
e2e/klasorunde,.spec.tsuzantisi - Locator'lar icin
getByRole,getByTexttercih et (CSS selector yerine) - Her kritik kullanici akisi icin E2E testi yaz (navigasyon, form submit, auth)
npm run test:e2eile calistir,npm run test:e2e:uiile gorsel modda calistir
__tests__/ # Unit & component testleri
page.test.tsx # Sayfa testleri
components/ # Component testleri
Button.test.tsx
e2e/ # E2E testleri
home.spec.ts
app/ # Next.js App Router sayfalari
components/ # Paylasilan React component'leri
ui/ # Temel UI component'leri (Button, Input, Card...)
hooks/ # Custom React hook'lari
lib/ # Yardimci fonksiyonlar, config
types/ # Paylasilan TypeScript tipleri
public/ # Statik dosyalar
__tests__/ # Unit & component testleri (Vitest)
e2e/ # E2E testleri (Playwright)
Bu projede 6 adet slash komutu tanimli:
/component— React component olustur/page— Next.js sayfa olustur/hook— Custom React hook olustur/form— Form component olustur (validasyonlu)/api— API route handler olustur/layout— Next.js layout olustur