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