Code Style and Conventions
Python (Backend)
- PEP 8 Compliance: Follow Python’s PEP 8 style guide
- Type Hints: Use type hints for function parameters and return values
- Docstrings: Document all modules, classes, and functions
- Imports: Group imports (standard library, third-party, local)
JavaScript/React (Frontend)
- Functional Components: Use functional components with hooks
- Component Structure: Props, state, effects, handlers, render
- Naming: PascalCase for components, camelCase for functions/variables
- File Organization: One component per file
Adding New Interview Types
To add a new interview mode (e.g., System Design, Behavioral):Adding New AI Models or Engines
The system uses Mistral AI by default. To add support for other models:Option 1: Add Alternative LLM Provider
Option 2: Use Local Models with Ollama
The codebase previously supported Ollama. To re-enable:- Install Ollama locally
- Pull a model:
ollama pull llama2 - Update
backend/config.pyto use Ollama endpoint - Modify
rag.pyto use local model instead of Mistral API
Extending the Knowledge Base
To add new topics or domains:Adding New API Endpoints
Follow this pattern when adding new endpoints:Frontend Component Patterns
Component Structure
Testing New Features
Backend Testing
Create test files alongside your modules:Frontend Testing
Updatefrontend/src/App.test.js or create component-specific tests:
Pull Request Process
When contributing new features:- Create a Feature Branch:
git checkout -b feature/my-new-feature - Make Incremental Commits: Write clear, descriptive commit messages
- Test Thoroughly: Verify both frontend and backend functionality
- Update Documentation: Add comments and update relevant docs
- Create Pull Request: Include:
- Clear description of the feature
- Screenshots/demo if UI changes
- Testing steps
- Any breaking changes
Best Practices
Error Handling
Always wrap async operations in try-catch blocks and provide meaningful error messages to users.
State Management
Keep state as close to where it’s used as possible. Use context or props for shared state.
API Design
Follow RESTful conventions. Use consistent response formats across all endpoints.
Security
Never expose API keys in frontend code. Always validate user input on the backend.
Next Steps
- Review the Project Structure for file locations
- Check the API Authentication and Interview Endpoints for existing endpoints
- Explore existing components for patterns and examples