# Code Style and Conventions ## General Style - **Language**: JavaScript (Node.js backend, vanilla frontend) - **Module System**: CommonJS (require/module.exports) - **Indentation**: 4 spaces (based on observed code) - **Semicolons**: Used consistently - **Quotes**: Single quotes for strings - **Line Endings**: LF (Unix-style) ## Naming Conventions - **Variables**: camelCase (e.g., `downloadsDir`, `YouTubeService`) - **Constants**: camelCase (no SCREAMING_SNAKE_CASE observed) - **Classes**: PascalCase (e.g., `Database`, `YouTubeService`) - **Files**: kebab-case for some, camelCase for others (mixed) - **Directories**: lowercase ## Code Organization - **Classes**: Each service has its own class (Database, YouTubeService) - **Modules**: One class per file - **Error Handling**: Try-catch blocks for async operations - **Async/Await**: Preferred over promises .then() - **Express Routes**: Inline callback functions ## File Structure Patterns - **Imports**: All requires at the top of file - **Constants**: Defined after imports - **Class Instantiation**: After middleware setup - **Routes**: Defined after setup and initialization ## Database Conventions - **SQLite**: Used for data persistence - **Tables**: snake_case naming (users, search_history, downloads) - **Class Wrapper**: Database operations wrapped in Database class ## API Conventions - **RESTful**: Standard HTTP methods and status codes - **JSON**: All API responses in JSON format - **Error Responses**: Consistent error object structure - **Async Handlers**: All route handlers are async functions ## No Testing/Linting Framework The project currently has no configured: - Testing framework (no test scripts) - ESLint or other linting tools - Prettier or other formatting tools - TypeScript (pure JavaScript)