How shivamteotia/disha-hr works
DISHA HR is a mobile-friendly HR application with employee self-service and administration workflows, plus Disha, an assistant for policy and scoped HR-data questions. Users sign in through the Next.js app, which calls the FastAPI API for HR operations; chat requests are routed by the LangGraph agent and streamed back to the UI. The graph preserves the documented policy-RAG and guarded text-to-SQL branches. Some backend modules and frontend pages were not sampled, so their internal wiring is omitted where it cannot be established.
Main entry points: lib.js API client · agent.py LangGraph agent · main.py FastAPI HR API · knowledge.py Policy retrieval
Components 20
Web app
- Sign in
frontend/app/login/page.js - App shell
frontend/components/Shell.js - API client
frontend/lib.js - Dashboard
frontend/app/(app)/page.js - Employee directory
frontend/app/(app)/employees/page.js - Leave requests
frontend/app/(app)/leaves/page.js - Payslips
frontend/app/(app)/payslips/page.js - HR pages
frontend/app/(app) - Chat popup
frontend/components/DishaChat.js
HR operations
- FastAPI HR API
backend/app/main.py - HR records
backend/app/main.py
Disha assistant
- LangGraph agent
backend/app/agent.py - Input and output rails
backend/app/rails.py - Scoped SQL guard
backend/app/safe_sql.py - Policy retrieval
backend/app/knowledge.py
Data and policy
- HR database
backend/app/db.py - Company policies
data/policies
Other components
- Employee or admin
- Qdrant
- OpenAI models
Connections 21
- Employee or admin → Sign in: signs in
- Sign in → API client: submits credentials
- App shell → API client: loads session
- Dashboard → API client: requests HR data
- Employee directory → API client: manages employees
- Leave requests → API client: manages leave
- Payslips → API client: requests payslips
- HR pages → API client: uses HR API
- Chat popup → API client: streams chat
- API client → FastAPI HR API: calls endpoints
- FastAPI HR API → HR records: handles HR workflows
- FastAPI HR API → HR database: reads and writes
- FastAPI HR API → LangGraph agent: dispatches chat
- LangGraph agent → Input and output rails: checks input and output
- LangGraph agent → Policy retrieval: retrieves policy
- LangGraph agent → Scoped SQL guard: queries scoped data
- Policy retrieval → Company policies: searches content
- Policy retrieval → Qdrant: searches vectors
- LangGraph agent → OpenAI models: plans and responds
- Policy retrieval → OpenAI models: embeds and reranks
- Scoped SQL guard → HR database: reads scoped views