📛 Naming Conventions
Consistency in naming reduces cognitive load and prevents deployment naming conflicts. BayanCore enforces the following naming patterns:
1. Git Branching
Branch names must follow a standard prefix pattern:
| Category | Branch Prefix | Example |
|---|---|---|
| New Features | feature/ | feature/zatca-b2b-clearance |
| Bug Fixes | bugfix/ | bugfix/gosi-deduction-rounding |
| Security Patches | security/ | security/clerk-token-refresh |
| Hotfixes | hotfix/ | hotfix/zatca-api-endpoint |
| Documentation | docs/ | docs/update-naming-rules |
2. API Endpoints
Our dual-API strategy uses distinct patterns for REST and GraphQL:
REST API v1
- Use plural nouns for resource endpoints:
/v1/invoices,/v1/employees. - URL paths must be lowercase using kebab-case:
/v1/purchase-orders. - Use standard HTTP methods:
GET /v1/invoices- List invoicesPOST /v1/invoices- Draft invoiceGET /v1/invoices/{id}- Fetch single invoice detailDELETE /v1/invoices/{id}- Anonymize/Purge record
GraphQL Schema
- Types: Use PascalCase (e.g.
InvoiceLineItem,EmployeeProfile). - Queries & Mutations: Use camelCase with verb prefixes:
- Queries:
getInvoiceDetails,listTenantCompanies. - Mutations:
createDraftInvoice,approvePurchaseOrder.
- Queries:
3. Database Objects (MariaDB)
- Tables: Lowercase snake_case, prefixed by the module name to prevent namespace clashes (e.g.
hr_employee_attendance,acc_zatca_clearance_log). - Columns: Lowercase snake_case (e.g.
is_active,vat_amount_sar). - Foreign Keys: Prefixed with
fk_followed by target table and column (e.g.fk_invoice_company_id). - Indexes: Prefixed with
idx_followed by table and columns indexed (e.g.idx_invoice_company_status).