feat: LinkedIn profile search engine (Django + React + Elasticsearch + ELK)
Full-stack implementation of the Cyberyan full-stack trial task. Backend (Django 5 / DRF) - Normalised PostgreSQL model (Profile, Company, School, Skill, Experience, Education) as the source of truth, with GIN + trigram indexes. - Self-healing CSV reader: the supplied export carries an injected watermark column, missing columns, rows split by broken quoting and a duplicated header. A signature-scored Needleman-Wunsch alignment reconstructs 284 clean records out of 336 physical rows; only 10 rows parse correctly without it. - Pluggable search layer (Strategy): Elasticsearch by default, PostgreSQL full-text search as a fallback selected by a single environment variable. - Keyword search with per-field boosts, fuzziness and phrase boosting, six faceted filters (OR within a filter, AND across filters), an experience range, four sort orders, highlighting and facet aggregations. - JWT auth with rotation + blacklist, three roles, PII masking, scoped rate limits, a single error envelope, OpenAPI schema and health probes. Frontend (React 18 / TypeScript / Vite) - Debounced search with type-ahead, faceted filter panel, result cards, profile drawer, URL-synced search state, automatic token refresh. - Highlight snippets rendered without dangerouslySetInnerHTML. Infrastructure - Hardened multi-stage images (non-root, read-only rootfs, healthchecks). - docker-compose for the full stack plus dev and production overlays. - ELK: structured JSON logs shipped asynchronously to Logstash, routed per event type, with a composable index template and a Kibana setup script. Quality - 61 backend tests (85% coverage), ruff/black/bandit/mypy, ESLint + tsc, GitHub Actions running lint, tests and both image builds. - Persian documentation: README plus architecture, search, API, data, security and operations guides. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GnFo6fNaHCTAkJbfcdkqtG
This commit is contained in:
@@ -0,0 +1,88 @@
|
||||
[project]
|
||||
name = "linkedin-search-backend"
|
||||
version = "1.0.0"
|
||||
description = "LinkedIn dataset search engine - Django/DRF backend"
|
||||
requires-python = ">=3.12"
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Ruff: linting + import sorting (replaces flake8/isort)
|
||||
# ---------------------------------------------------------------------------
|
||||
[tool.ruff]
|
||||
line-length = 100
|
||||
target-version = "py312"
|
||||
exclude = ["migrations", ".venv", "staticfiles"]
|
||||
|
||||
[tool.ruff.lint]
|
||||
select = [
|
||||
"E", # pycodestyle errors
|
||||
"W", # pycodestyle warnings
|
||||
"F", # pyflakes
|
||||
"I", # isort
|
||||
"B", # flake8-bugbear
|
||||
"C4", # flake8-comprehensions
|
||||
"DJ", # flake8-django
|
||||
"UP", # pyupgrade
|
||||
"S", # bandit (security)
|
||||
"SIM", # flake8-simplify
|
||||
"RET", # flake8-return
|
||||
"ARG", # unused arguments
|
||||
]
|
||||
ignore = [
|
||||
"S101", # assert is fine inside tests
|
||||
"B008", # function call in argument defaults (common in DRF)
|
||||
]
|
||||
|
||||
[tool.ruff.lint.per-file-ignores]
|
||||
"tests/*" = ["S105", "S106", "ARG001", "ARG002", "ARG005"]
|
||||
# The repair fixtures are raw CSV rows; wrapping them would change the input.
|
||||
"tests/test_dataset_repair.py" = ["E501"]
|
||||
"*/settings/*" = ["F403", "F405"]
|
||||
|
||||
[tool.ruff.lint.isort]
|
||||
known-first-party = ["apps", "config"]
|
||||
|
||||
[tool.ruff.lint.flake8-unused-arguments]
|
||||
# Django and DRF hand every hook `*args`/`**kwargs` whether it needs them or not.
|
||||
ignore-variadic-names = true
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Black: formatting
|
||||
# ---------------------------------------------------------------------------
|
||||
[tool.black]
|
||||
line-length = 100
|
||||
target-version = ["py312"]
|
||||
extend-exclude = "migrations"
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Pytest
|
||||
# ---------------------------------------------------------------------------
|
||||
[tool.pytest.ini_options]
|
||||
DJANGO_SETTINGS_MODULE = "config.settings.test"
|
||||
python_files = ["test_*.py"]
|
||||
addopts = "-ra --strict-markers --cov=apps --cov-report=term-missing"
|
||||
testpaths = ["tests"]
|
||||
filterwarnings = ["ignore::DeprecationWarning"]
|
||||
|
||||
[tool.coverage.run]
|
||||
omit = ["*/migrations/*", "*/tests/*", "manage.py", "config/asgi.py", "config/wsgi.py"]
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Bandit (security linting)
|
||||
# ---------------------------------------------------------------------------
|
||||
[tool.bandit]
|
||||
exclude_dirs = ["tests", "migrations", ".venv", "staticfiles"]
|
||||
skips = ["B101"] # asserts are only used in tests
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Mypy
|
||||
# ---------------------------------------------------------------------------
|
||||
[tool.mypy]
|
||||
python_version = "3.12"
|
||||
plugins = ["mypy_django_plugin.main", "mypy_drf_plugin.main"]
|
||||
ignore_missing_imports = true
|
||||
warn_unused_ignores = true
|
||||
warn_redundant_casts = true
|
||||
exclude = ["migrations"]
|
||||
|
||||
[tool.django-stubs]
|
||||
django_settings_module = "config.settings.dev"
|
||||
Reference in New Issue
Block a user