File size: 11,841 Bytes
609ba3d 664c157 0803a31 664c157 0803a31 664c157 0803a31 664c157 0803a31 664c157 0803a31 664c157 0803a31 664c157 0803a31 664c157 0803a31 664c157 0803a31 664c157 609ba3d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 | ---
tags:
- ml-intern
---
# π€ AI-Powered HR Task Optimizer
<p align="center">
<img src="https://img.shields.io/badge/Next.js-14-black?style=for-the-badge&logo=next.js" />
<img src="https://img.shields.io/badge/Node.js-20-green?style=for-the-badge&logo=node.js" />
<img src="https://img.shields.io/badge/Python-3.11-blue?style=for-the-badge&logo=python" />
<img src="https://img.shields.io/badge/FastAPI-0.100+-009688?style=for-the-badge&logo=fastapi" />
<img src="https://img.shields.io/badge/PostgreSQL-15-336791?style=for-the-badge&logo=postgresql" />
<img src="https://img.shields.io/badge/Redis-7-DC382D?style=for-the-badge&logo=redis" />
<img src="https://img.shields.io/badge/Tailwind-3.4-38B2AC?style=for-the-badge&logo=tailwind-css" />
</p>
<p align="center">
<b>Production-grade AI recruitment platform</b> β automate resume screening, rank candidates with embeddings + LLM reranking, prioritize recruiter tasks with ML, and manage the entire hiring pipeline.
</p>
---
## π What This Is
A **startup-grade SaaS ATS** (Applicant Tracking System) built for modern HR teams. It combines:
- **Semantic resume parsing** with LLM extraction
- **AI candidate ranking** using sentence embeddings + GPT-4o reranking
- **Intelligent task prioritization** with LightGBM risk prediction
- **Interview scheduling** with Google Calendar integration
- **AI email assistant** with human-in-the-loop approval
- **Real-time analytics** for hiring velocity and pipeline bottlenecks
**Live Demo:** [Coming Soon]
**Architecture Deep Dive:** [See ADRs](./docs/adr/)
---
## ποΈ Architecture
```
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β CLIENT LAYER β
β Next.js 14 (App Router) βββΊ Vercel Edge / Serverless β
β - SSR Dashboards (SEO + performance) β
β - React Server Components for data-heavy tables β
ββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββββ
β HTTPS / JWT
ββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββββββ
β API GATEWAY (Node.js) β
β Express.js + Helmet + Rate Limiter + Request Validator β
β - Auth middleware (JWT + OAuth passthrough) β
β - Router: /api/v1/* β Main API β
β /ai/v1/* β AI Service Proxy (internal mTLS) β
ββββββββ¬ββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββ
β β
ββββββββΌβββββββ βββββββββΌβββββββββ
β CORE API β β AI SERVICE β
β Node.js β β FastAPI β
β Express β β (GPU/CPU) β
β PostgreSQL β β Sentence- β
β Redis β β Transformers β
β Bull MQ β β OpenAI SDK β
ββββββββ¬βββββββ βββββββββ¬βββββββββ
β β
βββββΌβββββ βββββΌβββββ
β AWS β β AWS β
β S3 β β SQS / β
β(Resumesβ β Redis β
β PDFs) β β (Queue)β
ββββββββββ ββββββββββ
```
**Pattern: BFF (Backend-for-Frontend) + AI Microservice**
- **Node.js Core API** handles I/O concurrency (auth, CRUD, notifications, calendar APIs)
- **FastAPI AI Service** isolates the ML lifecycle (torch, transformers, CUDA dependencies)
- **Next.js App Router** uses Server Components for dashboard data and Server Actions for mutations
---
## β¨ Features
| Feature | Description | AI/ML Component |
|---------|-------------|-----------------|
| π€ **AI Task Prioritization** | Dynamically ranks recruiter tasks by urgency, deadline, candidate quality, and workload | LightGBM risk model + heuristic blend |
| π **Resume Screening** | Upload PDFs, extract structured data (skills, experience, education) | unstructured.io + GPT-4o extraction |
| π― **Smart Candidate Ranking** | Semantic similarity scoring + LLM reranking for precision | Sentence Transformers + GPT-4o |
| π
**Interview Scheduler** | Auto-manage slots, calendar sync, reminders, multi-stage workflow | Google Calendar API + BullMQ cron |
| π **Recruitment Dashboard** | Pipeline analytics, hiring progress, task monitoring | PostgreSQL aggregations + Recharts |
| βοΈ **AI Email Assistant** | Generate follow-ups, invites, rejections with human approval | GPT-4o with few-shot prompting |
| π **Productivity Analytics** | Time-to-hire, conversion rates, recruiter efficiency, bottlenecks | Survival analysis + funnel metrics |
| π **Notification System** | Smart alerts, deadline reminders, candidate inactivity | SSE + Redis Pub/Sub |
---
## π οΈ Tech Stack
### Frontend
- **Next.js 14** (App Router, Server Components, Server Actions)
- **Tailwind CSS** + **shadcn/ui** primitives
- **TanStack Query** for client-side data fetching
- **Zustand** for lightweight global state
- **React Hook Form** + **Zod** for validation
- **Recharts / Tremor** for analytics
### Backend
- **Node.js + Express** (Core API)
- **Python + FastAPI** (AI Microservice)
- **PostgreSQL 15** (primary database + pgvector for semantic search)
- **Redis 7** (caching, sessions, BullMQ job queues)
- **BullMQ** (background job processing)
### AI/ML
- **Sentence Transformers** (`all-MiniLM-L6-v2` for embeddings)
- **OpenAI GPT-4o** (resume extraction, email generation, reranking)
- **LightGBM** (task prioritization model)
- **scikit-learn** (scoring ensembles)
- **unstructured.io** + **pdfplumber** (PDF parsing)
### Auth & Deployment
- **JWT** + **OAuth 2.0** (Google, GitHub)
- **Vercel** (frontend)
- **Railway / Render** (backend + AI service)
- **AWS S3** (resume storage)
- **SendGrid / AWS SES** (transactional email)
---
## π Monorepo Structure
```
hr-task-optimizer/
βββ apps/
β βββ web/ # Next.js 14 App Router
β β βββ app/ # Route groups, Server Components
β β βββ components/ # UI primitives + domain composites
β β βββ lib/ # API wrappers, utilities
β βββ api/ # Node.js Core API
β β βββ src/modules/ # Domain modules (auth, jobs, candidates, tasks)
β β βββ src/workers/ # BullMQ job processors
β β βββ Dockerfile
β βββ ai-service/ # Python FastAPI
β βββ app/routers/ # Embeddings, screening, generation, ranking
β βββ services/ # Model singletons, LLM clients
β βββ Dockerfile.gpu
βββ packages/
β βββ shared-types/ # Zod schemas β TS + Pydantic
β βββ ui/ # shadcn/ui base config
β βββ eslint-config/
βββ infra/
β βββ docker-compose.yml # Local dev stack
β βββ k8s/ # Kubernetes manifests
β βββ terraform/ # AWS/GCP provisioning
βββ docs/
β βββ adr/ # Architecture Decision Records
βββ turbo.json
```
---
## π Quick Start
### Prerequisites
- Docker + Docker Compose
- Node.js 20+ + pnpm
- Python 3.11+
### 1. Clone & Install
```bash
git clone https://github.com/plplpl183/ai-powered-hr-task-optimizer.git
cd ai-powered-hr-task-optimizer
pnpm install
```
### 2. Environment Setup
```bash
# Copy env files
cp apps/web/.env.example apps/web/.env.local
cp apps/api/.env.example apps/api/.env
cp apps/ai-service/.env.example apps/ai-service/.env
# Fill in your credentials (OpenAI, Google OAuth, AWS S3, etc.)
```
### 3. Start Local Stack
```bash
# Start PostgreSQL, Redis, MinIO (S3 mock)
docker-compose -f infra/docker-compose.yml up -d
# Run database migrations
pnpm db:migrate
# Start all apps in dev mode
pnpm dev
```
Services will be available at:
- **Web:** http://localhost:3000
- **Core API:** http://localhost:4000
- **AI Service:** http://localhost:8000
- **PostgreSQL:** localhost:5432
- **Redis:** localhost:6379
- **MinIO (S3):** http://localhost:9000
---
## π§ͺ Testing
```bash
# Unit tests
pnpm test
# Integration tests (requires local stack)
pnpm test:integration
# AI service tests
pnpm test:ai
```
---
## π Performance & Scale
| Metric | Target | Implementation |
|--------|--------|----------------|
| Resume parsing | <5s per PDF | Async BullMQ worker + model singleton |
| Candidate ranking | <200ms for top-20 | pgvector cosine similarity + LLM reranker |
| Task prioritization | <100ms | LightGBM inference + Redis caching |
| Dashboard load | <1s TTFB | Next.js Server Components + ISR |
| Concurrent users | 1000+ | Horizontal scaling via K8s / Railway |
---
## π Security
- **HTTP-only cookies** with `SameSite=Lax` for refresh tokens
- **Rate limiting** by IP + user (Redis-backed)
- **File upload validation** via magic numbers + size limits
- **Parameterized queries** (Drizzle ORM) β SQL injection impossible
- **CORS** restricted to known origins
- **Helmet.js** security headers
- **Human-in-the-loop approval** for all AI-generated emails
---
## π Documentation
- [Architecture Decision Records](./docs/adr/)
- [001: Why PostgreSQL over MongoDB](./docs/adr/001-why-postgres.md)
- [002: Why FastAPI for AI Service](./docs/adr/002-why-fastapi-for-ai.md)
- [003: Task Prioritization Heuristic vs ML](./docs/adr/003-task-prioritization.md)
- [API Documentation](https://api.hr-task-optimizer.dev/docs) (OpenAPI/Swagger)
- [Contributing Guidelines](./CONTRIBUTING.md)
---
## π€ Contributing
We use [Conventional Commits](https://www.conventionalcommits.org/):
```bash
feat: add AI email generation endpoint
fix: resolve race condition in task prioritization
docs: update API documentation
refactor: extract resume parser into service class
test: add integration tests for interview scheduler
```
See [CONTRIBUTING.md](./CONTRIBUTING.md) for details.
---
## π License
MIT License β see [LICENSE](./LICENSE) for details.
---
## π Acknowledgments
- [sentence-transformers](https://www.sbert.net/) for embedding models
- [unstructured.io](https://unstructured.io/) for PDF parsing
- [shadcn/ui](https://ui.shadcn.com/) for UI primitives
- [BullMQ](https://docs.bullmq.io/) for job queues
---
<p align="center">
Built with β€οΈ by <a href="https://github.com/plplpl183">@plplpl183</a>
</p>
<!-- ml-intern-provenance -->
## Generated by ML Intern
This model repository was generated by [ML Intern](https://github.com/huggingface/ml-intern), an agent for machine learning research and development on the Hugging Face Hub.
- Try ML Intern: https://smolagents-ml-intern.hf.space
- Source code: https://github.com/huggingface/ml-intern
## Usage
```python
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "plplpl183/ai-powered-hr-task-optimizer"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id)
```
For non-causal architectures, replace `AutoModelForCausalLM` with the appropriate `AutoModel` class.
|