# Coding Conventions **Analysis Date:** 2026-06-02 ## Naming Patterns **Python files:** - `snake_case` throughout — `auth.py`, `cloud_utils.py`, `document_tasks.py` - Modules named for their responsibility, not their layer (e.g., `services/auth.py`, `services/audit.py`) **Python functions:** - `snake_case` for all functions and methods: `hash_password`, `verify_password`, `create_access_token`, `write_audit_log` - Private helpers prefixed with underscore: `_set_refresh_cookie`, `_port_open`, `_set_doc_user_id` - Async functions use same convention — no `async_` prefix **Python classes:** - `PascalCase` for ORM models and Pydantic models: `User`, `Document`, `RegisterRequest`, `DocumentPatch` - Request/response models end in `Request` or `Response`: `RegisterRequest`, `LoginRequest`, `ChangePasswordRequest` **Python variables:** - `snake_case`: `user_id`, `access_token`, `used_bytes`, `credentials_enc` - Constants use `UPPER_SNAKE_CASE`: `_PASSWORD_DETAIL` (underscore prefix when module-private) - Module-level singletons prefixed underscore: `_pwd`, `_CLOUD_PROVIDERS` **DB column naming:** - `snake_case` for all columns: `user_id`, `password_hash`, `is_active`, `created_at` - Exception: ORM attribute `metadata_` maps to DB column `metadata` (reserved SQLAlchemy name) - Timestamp columns use `_at` suffix: `created_at`, `used_at` - Boolean columns use `is_` or no prefix: `is_active`, `totp_enabled`, `password_must_change` **Frontend files:** - Vue components: `PascalCase` — `DocumentCard.vue`, `FolderTreeItem.vue`, `StorageBrowser.vue` - Stores: `camelCase.js` — `auth.js`, `documents.js`, `cloudConnections.js` - Utilities: `camelCase.js` — `formatters.js` - API client: single file `src/api/client.js` - Test files: `ComponentName.test.js` or `storeName.test.js` inside `__tests__/` subdirectory **Frontend functions and variables:** - `camelCase`: `formatDate`, `formatSize`, `providerColor`, `fetchDocuments`, `uploadToMinIO` - Store composables use `use` prefix: `useAuthStore`, `useFoldersStore`, `useDocumentsStore` - Private helpers prefixed underscore: `_refreshInFlight` - Event names emitted from components: `kebab-case` — `'breadcrumb-navigate'`, `'folder-create'`, `'file-open'` ## Code Style **Formatting:** - No Prettier, ESLint, Black, or Ruff config committed — style maintained by convention only - Backend follows PEP 8 organically; 4-space indentation - Tailwind CSS utility classes applied inline in Vue templates; no scoped `