NexusHR is a production-ready HRMS (Human Resource Management System) MVP designed for companies with 50-500 employees. The application provides role-based access control, employee self-service capabilities, leave management, attendance tracking, payroll processing, and recruitment features.
The system follows a full-stack TypeScript architecture with a React frontend and Express backend, using MongoDB Atlas as the primary database.
Preferred communication style: Simple, everyday language.
- Framework: React with TypeScript, built using Vite
- Styling: Tailwind CSS with shadcn/ui component library (New York style variant)
- State Management: TanStack React Query for server state, React Context for auth state
- Routing: Wouter for client-side navigation
- Form Handling: React Hook Form with Zod validation
- Charts: Recharts for dashboard analytics
- Animations: Framer Motion for page transitions
- Framework: Express.js with TypeScript
- Database: MongoDB Atlas with Mongoose ODM
- Authentication: JWT-based (access tokens stored in localStorage)
- Password Security: bcryptjs for hashing
- Validation: Zod schemas shared between frontend and backend
/client - React frontend application
/src
/components - UI components (shadcn/ui based)
/hooks - Custom React hooks for data fetching
/pages - Page components
/lib - Utilities and query client
/server - Express backend
/middleware - Auth and RBAC middleware
routes.ts - API route definitions
models.ts - Mongoose schemas
db.ts - MongoDB connection
/shared - Shared TypeScript types and Zod schemas
schema.ts - Data models and validation
routes.ts - API contract definitions
- JWT tokens issued on login, stored in localStorage
- Token passed via
Authorization: Bearer <token>header - Role-based access control with 4 roles: SUPER_ADMIN, HR_ADMIN, MANAGER, EMPLOYEE
- Middleware verifies tokens and checks role permissions
- User: Authentication credentials and role assignment
- Employee: Personal and employment information
- LeaveRequest: Leave applications with approval workflow
- Attendance: Daily check-in/check-out records
- Candidate: Recruitment pipeline tracking
- SalaryStructure/PayrollRun: Payroll management
- RESTful endpoints under
/api/*prefix - Standardized response format:
{ success: boolean, data?: T, error?: string } - Zod schemas define request/response contracts in
/shared/routes.ts
- MongoDB Atlas: Cloud-hosted MongoDB database
- Connection via
MONGO_URIenvironment variable - Mongoose ODM for schema definition and queries
- jsonwebtoken: JWT creation and verification
- bcryptjs: Password hashing
JWT_SECRETenvironment variable required
- Vite: Frontend dev server and bundler
- esbuild: Production server bundling
- tsx: TypeScript execution for development
- drizzle-kit: Database migration tooling (PostgreSQL support available)
MONGO_URI: MongoDB Atlas connection stringJWT_SECRET: Secret key for JWT signingDATABASE_URL: PostgreSQL connection (if using Drizzle/Postgres features)
Run server/seed.ts to populate initial data:
- Admin user:
admin@company.com/admin123 - HR Admin:
sarah.hr@company.com/password123 - Sample managers and employees