Proje: Okul B2B App · Hub: Okul B2B App — Conventions
Naming ve Klasör Yapısı Konvansiyonları
Dosya ve Klasör Naming
| Tür | Konvansiyon | Örnek |
|---|---|---|
| Ekranlar (app/) | kebab-case.tsx | leads.tsx, gallery.tsx |
| Bileşenler | PascalCase.tsx | LeadDetailModal.tsx |
| Servisler | PascalCaseService.ts | LeadsService.ts, AuthService.ts |
| Util fonksiyonlar | PascalCase.ts | ApiClient.ts, Logger.ts |
| Context’ler | PascalCaseContext.tsx | CompanyContext.tsx |
| Hook’lar | useCamelCase.ts | useForceUpdate.ts |
| Constants | PascalCase.ts | Config.ts, ServiceConfig.ts |
| Types | camelCase.ts / kebab | api.ts, schoolContent.ts |
Import Alias
@/ alias her yerde kullanılır:
import { apiClient } from '@/utils/ApiClient';
import { useCompany } from '@/contexts/CompanyContext';
import LeadsService from '@/services/LeadsService';tsconfig.json’da baseUrl: "." ve paths: { "@/*": ["./*"] } tanımlı.
Platform-Specific Dosyalar
.ios.tsx ve .android.tsx uzantıları ile platform farkı:
PhotoViewModal.tsx(shared)PhotoViewModal.android.tsx(Android-specific override)IconSymbol.tsx(shared)IconSymbol.ios.tsx(iOS-specific)TabBarBackground.tsx/TabBarBackground.ios.tsx
Servis Export Pattern
Servisler static class olarak export edilir:
class LeadsService {
static async getLeads(...): Promise<LeadsResponse> { ... }
static async getLeadById(id: number): Promise<Lead | null> { ... }
}
export default LeadsService;Singleton class:
class ApiClient {
public static getInstance(): ApiClient { ... }
}
export const apiClient = ApiClient.getInstance();Type Tanımları
- Domain tipleri
types/klasöründe - Her domain’e özgü tip dosyası:
types/api.ts,types/schoolContent.ts - Shared tiplere
types/index.tsüzerinden erişilir
Türkçe Karakter Kuralı
Tüm kullanıcıya gösterilen metinler Türkçe karakterlerle yazılmalı: ı, ş, ö, ü, ç, ğ, İ. Kod içinde identifier’lar İngilizce kalır.
Related
- api-client-pattern — servis naming
- context-state-yonetimi — context naming