Kategori Standar Contoh
Folder kebab-case shared/, ai-analysis/, project-files/
File kebab-case auth.service.ts, api-response.ts
Module plural + kebab-case users/, projects/, payments/
Function camelCase createProject(), refreshToken()
Variable camelCase userId, projectOwner, accessToken
Constant UPPER_SNAKE_CASE JWT_SECRET, MAX_UPLOAD_SIZE
Enum PascalCase UserRole, ProjectStatus
Enum Value UPPER_SNAKE_CASE ADMIN, IN_PROGRESS, COMPLETED
Class PascalCase AuthService, ProjectRepository
Interface PascalCase (tanpa prefix I) User, JwtPayload
Type Alias PascalCase ApiResponse, PaginationMeta
Generic Type Nama deskriptif ApiResponse<T>, Repository<TEntity>
Boolean Prefix is, has, can, should isActive, hasPermission
Event PascalCase + Past Tense ProjectCreated, PaymentCompleted
Error Code MODULE_ACTION_RESULT AUTH_INVALID_CREDENTIALS, PROJECT_NOT_FOUND
Response Code MODULE_ACTION_RESULT PROJECT_CREATED, PAYMENT_SUCCESS
Environment Variable UPPER_SNAKE_CASE DATABASE_URL, REDIS_URL
Import Internal Alias @/* @/modules/auth/auth.service
Database Table snake_case + plural users, project_milestones
Database Column snake_case created_at, project_id
Primary Key id (UUID) id
Foreign Key <entity>_id user_id, project_id
API Endpoint plural /api/v1/projects
Route Parameter camelCase /projects/:projectId
Query Parameter camelCase ?cursor=...&limit=20
Request Body camelCase projectName, walletAddress
Response JSON camelCase accessToken, expiresAt
DTO PascalCase + Suffix CreateProjectRequest, LoginResponse
Schema (Zod) camelCase + Schema createProjectSchema
Repository PascalCase + Repository ProjectRepository
Service PascalCase + Service AuthService
Controller PascalCase + Controller ProjectController
Mapper PascalCase + Mapper UserMapper
Plugin kebab-case + .plugin.ts jwt.plugin.ts
Middleware kebab-case + .middleware.ts auth.middleware.ts
Config kebab-case database.ts, redis.ts
Comment Jelaskan why, bukan what // Menggunakan transaction agar data tetap konsisten.
Async Gunakan async/await Hindari .then() bertingkat
Variable Declaration Gunakan const jika memungkinkan const user = ...
Magic Number Simpan di constants atau config MAX_UPLOAD_SIZE, TOKEN_EXPIRES_IN
Formatting ESLint + Prettier Mengikuti konfigurasi project
Architecture Single Responsibility Principle Satu file satu tanggung jawab