|
| 1 | +[](https://github.com/ZhikharevAl/interview/actions/workflows/code-quality.yaml) |
| 2 | +[](https://codecov.io/gh/ZhikharevAl/interview) |
| 3 | +  |
| 4 | + |
| 5 | +[](https://deepwiki.com/ZhikharevAl/interview) |
| 6 | + |
| 7 | + |
| 8 | +### Code Coverage |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | +# Interview Preparation App |
| 13 | + |
| 14 | +A modern web application for creating and studying interview questions using interactive flashcards. |
| 15 | + |
| 16 | +## Features |
| 17 | + |
| 18 | +- 📚 **Interactive Flashcards**: Click to flip between questions and answers |
| 19 | + |
| 20 | +- 🏷️ **Category Management**: Organize questions by topics (JavaScript, Python, etc.) |
| 21 | +- 📝 **Question Management**: Add, edit, and delete questions |
| 22 | +- 🔀 **Shuffle Mode**: Randomize question order for better learning |
| 23 | +- ➕ **Content Management**: Add new categories and questions through web interface |
| 24 | + |
| 25 | +- 🎨 **Modern UI**: Clean, responsive design with Tailwind CSS |
| 26 | + |
| 27 | +## Tech Stack |
| 28 | + |
| 29 | +- **Backend**: FastAPI (Python 3.13) |
| 30 | +- **Database**: PostgreSQL with SQLAlchemy ORM |
| 31 | +- **Frontend**: Vanilla JavaScript with Tailwind CSS |
| 32 | +- **Package Management**: UV |
| 33 | +- **Code Quality**: Ruff, Pyright, pre-commit hooks |
| 34 | +- **Deployment**: Docker & Docker Compose |
| 35 | + |
| 36 | +## Quick Start |
| 37 | + |
| 38 | +### Using Docker (Recommended) |
| 39 | + |
| 40 | +```bash |
| 41 | +# Clone the repository |
| 42 | +git clone https://github.com/ZhikharevAl/interview.git |
| 43 | +cd interview-prep-app |
| 44 | + |
| 45 | +# Start the application |
| 46 | +docker-compose up -d |
| 47 | + |
| 48 | +# Access the app at http://localhost:8000 |
| 49 | +``` |
| 50 | + |
| 51 | +### Local Development |
| 52 | + |
| 53 | +```bash |
| 54 | +# Install dependencies |
| 55 | +uv sync --group dev |
| 56 | + |
| 57 | +# Run the development server |
| 58 | +cd backend |
| 59 | +uv run uvicorn app.main:app --reload |
| 60 | + |
| 61 | +# Access the app at http://localhost:8000 |
| 62 | +``` |
| 63 | + |
| 64 | +## Usage |
| 65 | + |
| 66 | +1. **Study Mode**: Select a category and click cards to reveal answers |
| 67 | +2. **Management**: Add new categories and questions via the management tab |
| 68 | +3. **Shuffle**: Randomize question order to test your knowledge |
| 69 | + |
| 70 | +## API Endpoints |
| 71 | + |
| 72 | +### Categories |
| 73 | + |
| 74 | +- `GET /api/v1/categories/` - List all categories (with optional `skip` and `limit` parameters) |
| 75 | +- `POST /api/v1/categories/` - Create a new category |
| 76 | +- `GET /api/v1/categories/{category_id}` - Get category by ID |
| 77 | +- `PATCH /api/v1/categories/{category_id}` - Update category by ID |
| 78 | +- `DELETE /api/v1/categories/{category_id}` - Delete category by ID |
| 79 | + |
| 80 | +### Questions |
| 81 | + |
| 82 | +- `GET /api/v1/questions/` - List all questions (optional `?category_id=X` parameter) |
| 83 | +- `POST /api/v1/questions/` - Create a new question |
| 84 | +- `GET /api/v1/questions/{question_id}` - Get question by ID |
| 85 | +- `PATCH /api/v1/questions/{question_id}` - Update question by ID |
| 86 | +- `DELETE /api/v1/questions/{question_id}` - Delete question by ID |
| 87 | + |
| 88 | +## Testing |
| 89 | + |
| 90 | +The project includes comprehensive test suite with three levels of testing: |
| 91 | + |
| 92 | +### Test Structure |
| 93 | + |
| 94 | +``` |
| 95 | +tests/ |
| 96 | +├── unit/ # Unit tests for services |
| 97 | +├── integration/ # Integration tests with FastAPI TestClient |
| 98 | +├── e2e/ # End-to-end tests with Playwright |
| 99 | +├── api/ # API client classes |
| 100 | +├── utils/ # Test utilities and models |
| 101 | +└── config/ # Test configuration |
| 102 | +``` |
| 103 | + |
| 104 | +### Running Tests |
| 105 | + |
| 106 | +```bash |
| 107 | +# Run all tests |
| 108 | +uv run pytest |
| 109 | + |
| 110 | +# Run specific test type |
| 111 | +uv run pytest tests/unit/ # Unit tests only |
| 112 | +uv run pytest tests/integration/ # Integration tests only |
| 113 | +uv run pytest tests/e2e/ # E2E tests only |
| 114 | + |
| 115 | +# Run with coverage |
| 116 | +uv run pytest --cov=backend/app --cov-report=html |
| 117 | + |
| 118 | +# Run specific test file |
| 119 | +uv run pytest tests/unit/test_category_service.py |
| 120 | + |
| 121 | +# Run with Allure reporting |
| 122 | +uv run pytest --alluredir=allure-results |
| 123 | +allure serve allure-results |
| 124 | +``` |
| 125 | + |
| 126 | +### Test Types |
| 127 | + |
| 128 | +#### Unit Tests |
| 129 | + |
| 130 | +- Test individual service functions in isolation |
| 131 | +- Use in-memory SQLite database |
| 132 | +- Fast execution, no external dependencies |
| 133 | +- Coverage: `CategoryService`, `QuestionService` |
| 134 | + |
| 135 | +#### Integration Tests |
| 136 | + |
| 137 | +- Test complete API endpoints with FastAPI TestClient |
| 138 | +- Test database interactions and business logic |
| 139 | +- Validate HTTP status codes and response schemas |
| 140 | +- Coverage: Categories API, Questions API, Health endpoints |
| 141 | + |
| 142 | +#### End-to-End Tests |
| 143 | + |
| 144 | +- Test complete user workflows using Playwright |
| 145 | +- Real HTTP requests against running application |
| 146 | +- Test API clients and error handling |
| 147 | +- Coverage: Full API workflow testing |
| 148 | + |
| 149 | +### Test Configuration |
| 150 | + |
| 151 | +Tests use separate configuration via `tests/config/config.py`: |
| 152 | + |
| 153 | +- Base URL: `http://localhost:8080` (configurable via `.env.test`) |
| 154 | +- Timeout: 30 seconds |
| 155 | +- Endpoints: `/api/v1/categories`, `/api/v1/questions` |
| 156 | + |
| 157 | +### Test Utilities |
| 158 | + |
| 159 | +- **API Clients**: High-level clients for Categories and Questions APIs |
| 160 | +- **Fixtures**: Managed test data with automatic cleanup |
| 161 | +- **Allure Integration**: Detailed test reporting with steps and attachments |
| 162 | + |
| 163 | + |
| 164 | +- **Faker**: Random test data generation |
| 165 | + |
| 166 | +## Development |
| 167 | + |
| 168 | +```bash |
| 169 | +# Install pre-commit hooks |
| 170 | +pre-commit install |
| 171 | + |
| 172 | +# Run linters |
| 173 | +uvx ruff check . |
| 174 | +uvx ruff format . |
| 175 | +uv run pyright . |
| 176 | + |
| 177 | +``` |
| 178 | + |
| 179 | +## License |
| 180 | + |
| 181 | +MIT License - see [LICENSE](LICENSE) file for details. |
0 commit comments