A full-stack HR management platform with an AI-powered chatbot assistant. Built with React, Express, tRPC, Drizzle ORM, and MySQL — deployable to Vercel or Railway.
Live demo: lunar-hr.vercel.app
- Employee Management — manage employee records, roles, and departments
- AI HR Chatbot — powered by any OpenAI-compatible LLM (OpenAI, Anthropic, etc.)
- Google OAuth — sign in with Google, JWT session management
- Role-based Access —
adminanduserroles with protected routes - Type-safe API — end-to-end type safety via tRPC + Zod
- Database Migrations — Drizzle ORM with MySQL, schema push + migrate workflow
- Charts & Dashboards — Recharts-powered data visualizations
| Layer | Technology |
|---|---|
| Frontend | React 19, Vite, TailwindCSS v4, shadcn/ui, Radix UI |
| Routing | Wouter |
| State / Data | TanStack Query, tRPC |
| Backend | Express.js, tRPC server |
| Database | MySQL + Drizzle ORM |
| Auth | Google OAuth 2.0 + JWT (jose) |
| AI | Any OpenAI-compatible API |
| Deployment | Vercel (frontend) / Railway (full-stack) |
| Language | TypeScript (93.9%) |
- Node.js 18+
- pnpm (
npm i -g pnpm) - A running MySQL database
git clone https://github.com/summmz/Lunar-HR.git
cd Lunar-HRpnpm install
# or
npm install --legacy-peer-depscp .env.example .env.localFill in .env.local:
| Variable | Description |
|---|---|
DATABASE_URL |
MySQL connection string |
JWT_SECRET |
A long random string for signing session JWTs |
VITE_GOOGLE_OAUTH_CLIENT_ID |
Google OAuth client ID (public) |
GOOGLE_OAUTH_CLIENT_SECRET |
Google OAuth client secret (server-only) |
BUILT_IN_FORGE_API_URL |
Base URL of any OpenAI-compatible LLM API |
BUILT_IN_FORGE_API_KEY |
API key for the LLM service |
APP_URL |
Your public domain (leave blank for local dev) |
pnpm db:pushpnpm devThe app will be available at http://localhost:3000.
- Go to Google Cloud Console and create a project
- Enable the Google+ API under APIs & Services → Library
- Create an OAuth 2.0 Client ID (Web application type)
- Add the authorised redirect URI:
- Development:
http://localhost:3000/api/oauth/google/callback - Production:
https://yourdomain.com/api/oauth/google/callback
- Development:
- Copy the Client ID →
VITE_GOOGLE_OAUTH_CLIENT_ID - Copy the Client Secret →
GOOGLE_OAUTH_CLIENT_SECRET
Note: The redirect URI registered in Google Cloud must exactly match the one your server generates. In production, set
APP_URLto your full domain.
The chatbot works with any OpenAI-compatible API. Set BUILT_IN_FORGE_API_URL and BUILT_IN_FORGE_API_KEY in your environment.
To change the model, edit the model field in server/_core/llm.ts.
Examples:
- OpenAI:
BUILT_IN_FORGE_API_URL=https://api.openai.com - Anthropic:
BUILT_IN_FORGE_API_URL=https://api.anthropic.com(use aclaude-*model name)
| Command | Description |
|---|---|
pnpm dev |
Start development server (client + server with hot reload) |
pnpm build |
Build client (Vite) + server (esbuild) for production |
pnpm start |
Start production server |
pnpm db:push |
Generate and run database migrations |
pnpm test |
Run tests with Vitest |
pnpm check |
TypeScript type check |
pnpm format |
Format code with Prettier |
Lunar-HR/
├── client/ # React frontend (Vite)
├── server/ # Express + tRPC backend
├── shared/ # Shared types and schemas
├── drizzle/ # Database migration files
├── .env.example # Environment variable template
├── drizzle.config.ts
├── vite.config.ts
├── railway.toml # Railway deployment config
└── vercel.json # Vercel deployment config
The repo includes a vercel.json. Connect the repo to Vercel and set all environment variables in the Vercel dashboard.
A railway.toml is included. Connect the repo to Railway and configure environment variables in your Railway service settings.
After first login via Google OAuth, your account is created with role user. Promote yourself to admin directly in the database:
UPDATE users SET role = 'admin' WHERE email = 'you@example.com';MIT