Naming Conventions
Files and Directories
- Routes: Use kebab-case for route files:
user-profiles/routes.ts - Services: Use PascalCase for service files:
UserProfileService.ts - Directories: Use kebab-case:
user-api/,merchant-profiles/ - API Endpoints: Use kebab-case in URLs:
/user-profiles/,/merchant-settings/
Code Elements
- Classes: PascalCase -
UserService,ProductCatalogService - Methods: camelCase -
getUserProfile(),createProduct() - Variables: camelCase -
userId,productData,isAuthenticated - Constants: UPPER_SNAKE_CASE -
DATABASE_URL,JWT_SECRET - Interfaces/Types: PascalCase -
DBConnection,ApiRequest
Database Schema
- Tables: snake_case -
user_profiles,product_categories - Columns: snake_case -
user_id,created_at,merchant_id - Multi-tenancy: Always include
shop_idormerchant_id
Import Organization
Organize imports in the following order with blank lines between groups:Module Structure
Service Class Pattern
All service classes must extendAPIService and follow this pattern:
Route Handler Pattern
Route files must export a function that acceptsDBConnection:
Error Handling
Custom Error Usage
Always useCustomError from the shared library:
Response Handling
Use theservice.handleOk() pattern for consistent responses:

