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:
2026-09-03 08:13:10 +00:00
commit a464e550c9
133 changed files with 17019 additions and 0 deletions
+49
View File
@@ -0,0 +1,49 @@
# =============================================================================
# Development overlay: hot reload for both halves of the stack.
#
# docker compose -f docker-compose.yml -f docker-compose.dev.yml up --build
# → SPA (Vite dev server) http://localhost:5173
# → API http://localhost:8000/api/docs/
#
# Sources are bind-mounted, so an edit is live without rebuilding an image.
# =============================================================================
services:
backend:
build:
target: runtime
command:
- python
- manage.py
- runserver
- 0.0.0.0:8000
environment:
DJANGO_SETTINGS_MODULE: config.settings.dev
DJANGO_DEBUG: "true"
LOG_LEVEL: DEBUG
volumes:
- ./backend:/app
- ./data:/data:ro
ports:
- "127.0.0.1:${BACKEND_PORT:-8000}:8000"
# runserver reloads on save; gunicorn's healthcheck curl is still valid.
user: "0:0"
frontend:
image: node:22-alpine
build: !reset null
working_dir: /app
command: sh -c "npm install --no-audit --no-fund && npm run dev -- --host 0.0.0.0"
environment:
VITE_PROXY_TARGET: http://backend:8000
volumes:
- ./frontend:/app
- frontend-node-modules:/app/node_modules
ports:
- "5173:5173"
read_only: false
tmpfs: !reset []
networks: [frontend-net]
volumes:
frontend-node-modules: