Skip to content

About

Employee On/Off-boarding Management System — web-based HR workflow platform for global corporations. Multi-region (US/EU/KR/CN) onboarding application management, automated offboarding compliance, asset return tracking. Built with Next.js 14, TypeScript, PostgreSQL, Prisma ORM, and Tailwind CSS.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Repository files navigation

Employee On/Off-boarding Management System

A full-stack web application for managing employee onboarding and offboarding workflows across global organizations. Built for HR teams, IT administrators, and department managers handling multi-region compliance.

Next.js TypeScript PostgreSQL Prisma Tailwind CSS License


Project Overview

Managing employee lifecycles in global companies involves complex, region-specific processes. This system centralizes and automates the end-to-end on/off-boarding workflow — from new hire registration and application provisioning to departure compliance and asset recovery.

Who It's For

Role Responsibilities
HR Managers Register new employees, monitor onboarding progress, generate reports
IT Administrators Manage system accounts, configure access permissions, enforce security policies
Department Managers Approve team member onboarding/offboarding, assign tasks, track progress

Key Capabilities

  • Multi-Region Compliance — region-specific workflows for US, EU, KR (South Korea), and CN (China)
  • Application Provisioning — request, approve, and track account creation for 3rd-party services
  • Automated Offboarding — systematic account deactivation, asset return tracking, and compliance checks
  • Role-Based Access Control — Admin, HR Manager, and User roles with granular permissions
  • Data Import/Export — CSV-based bulk operations for employee records
  • Authentication — NextAuth.js with credential-based login and session management

Architecture

┌──────────┐     ┌─────────────────────────────────┐     ┌────────────┐
│  Browser  │────▶│     Next.js 14 (App Router)      │────▶│ PostgreSQL │
│  Client   │◀────│  ┌──────────┐  ┌──────────────┐ │◀────│  Database  │
└──────────┘     │  │  React   │  │  API Routes  │ │     └────────────┘
                 │  │  Pages   │  │  (REST)      │ │
                 │  └──────────┘  └──────────────┘ │     ┌────────────┐
                 │         │              │         │────▶│  Google    │
                 │  ┌──────┴──────────────┴───────┐ │     │  Sheets    │
                 │  │        Prisma ORM           │ │     │  API       │
                 │  └─────────────────────────────┘ │     └────────────┘
                 └─────────────────────────────────┘

Tech Stack

Frontend

Category Technology Purpose
Framework Next.js 14 (App Router) Server-side rendering, routing, API routes
Language TypeScript 5 Type-safe development
UI Library React 18 Component-based UI
Styling Tailwind CSS 3 Utility-first CSS framework
Component System shadcn/ui Accessible, customizable UI primitives
Primitives Radix UI Unstyled, accessible headless components
Icons Lucide React Consistent icon set
Table TanStack React Table 8 Data grid with sorting, filtering, pagination
Forms React Hook Form + Zod Performant form handling with schema validation
Notifications Sonner Toast notifications

Backend

Category Technology Purpose
Runtime Node.js + Next.js API Routes RESTful API endpoints
Language TypeScript 5 Type safety across the stack
ORM Prisma 5 Type-safe database client & migrations
Auth NextAuth.js 4 Authentication with Prisma adapter
Validation Zod Request/response schema validation

Database

Category Technology Purpose
Primary DB PostgreSQL Relational data store
Migrations Prisma Migrate Schema versioning & migration management
Relations 6 models with foreign key constraints Employee, Application, User, Offboarding, and join tables

Integrations

Integration Purpose
Google Sheets API (googleapis) Import/export employee data to Google Sheets
JSZip Archive generation for document exports

Dev Tools

Tool Purpose
ESLint Static code analysis (Next.js config)
Prettier Code formatting
PostCSS + Autoprefixer CSS processing & vendor prefixes
ts-node TypeScript script execution (seed, admin setup)

Database Schema

┌──────────────┐       ┌───────────────────────┐       ┌───────────────┐
│   Employee   │───1:N──▶ EmployeeApplication  │◀───N:1──│  Application  │
│              │       │                       │       │               │
│  id (uuid)   │       │  status (enum)        │       │  type (enum)  │
│  name        │       │  requestedBy (User)   │       │  regions[]    │
│  region      │       └───────────────────────┘       └───────────────┘
│  department  │                                                     │
│  joiningDate │                                               ┌─────┴────────┐
│  status      │                                               │ Offboarding  │
│              │───1:N──▶  OffboardingApplication  ◀───N:1─────│ Application  │
└──────────────┘                                               └──────────────┘
       │
       │ 1:N
       ▼
┌──────────────┐       ┌───────────┐
│ Offboarding  │       │   User    │
│              │       │           │
│  startDate   │       │  email    │
│  endDate     │       │  role     │
│  status      │       │  (enum)   │
└──────────────┘       └───────────┘

Enums: Region (US, EU, KR, CN) · Status (ACTIVE, INACTIVE) · Role (ADMIN, HR_MANAGER, USER) · ApplicationType (ONBOARDING, OFFBOARDING)


Project Structure

src/
├── app/
│   ├── api/                   # REST API routes
│   │   ├── applications/      # Application management
│   │   ├── auth/              # Authentication (NextAuth)
│   │   ├── data/              # Import/export endpoints
│   │   ├── employees/         # Employee CRUD
│   │   ├── employee-applications/  # Employee-application mappings
│   │   └── offboarding/       # Offboarding workflows
│   ├── applications/          # Application pages
│   ├── auth/                  # Login/error pages
│   ├── dashboard/             # Main dashboard
│   ├── employees/             # Employee management pages
│   ├── employee-applications/ # Application request pages
│   ├── offboarding/           # Offboarding pages
│   └── settings/              # System settings
├── components/
│   ├── forms/                 # Employee & offboarding form components
│   ├── layout/               # Header, nav, user menu
│   ├── providers/            # Auth context provider
│   └── ui/                   # shadcn/ui primitives (button, input, table, etc.)
├── lib/
│   ├── api.ts                # API client utilities
│   ├── auth/                 # Auth configuration
│   ├── prisma/               # Prisma client singleton
│   └── utils.ts              # Shared utilities
├── types/                    # TypeScript type definitions
└── middleware.ts             # Next.js middleware (auth guard)
prisma/
├── schema.prisma             # Database schema definition
└── migrations/               # Versioned migrations
scripts/
├── create-admin.ts           # Admin user bootstrapping
└── db-csv.ts                 # CSV database utilities

Getting Started

Prerequisites

  • Node.js ≥ 18
  • PostgreSQL ≥ 15 (local or remote)
  • npm ≥ 9

Setup

# 1. Clone
git clone https://github.com/scale600/HR-Workflow-NextJS-PostgreSQL.git
cd HR-Workflow-NextJS-PostgreSQL

# 2. Install dependencies
npm install

# 3. Configure environment
cp .env.example .env
# Edit .env with your DATABASE_URL and NEXTAUTH_SECRET

# 4. Run database migrations
npx prisma migrate dev

# 5. (Optional) Seed initial data
npx prisma db seed

# 6. Start development server
npm run dev
# → http://localhost:3000

Create Admin User

npm run create-admin

Build for Production

npm run build
npm start

API Overview

Method Endpoint Description
GET/POST /api/employees List / Create employees
GET/PUT/DELETE /api/employees/[id] Employee detail / update / delete
GET/POST /api/applications List / Create applications
GET/PUT /api/applications/[id] Application detail / update
GET/POST /api/employee-applications List / Create employee-application mappings
GET/PUT /api/employee-applications/[id] Mapping detail / approve/reject
GET/POST /api/offboarding List / Start offboarding
GET/PUT /api/offboarding/[id] Offboarding detail / update status
GET/PUT /api/offboarding/[id]/applications/[appId] Offboarding application status
GET /api/data/export Export data (CSV)
POST /api/data/import Import data (CSV)
POST /api/auth/[...nextauth] Authentication (NextAuth.js)

Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the MIT License.

About

Employee On/Off-boarding Management System — web-based HR workflow platform for global corporations. Multi-region (US/EU/KR/CN) onboarding application management, automated offboarding compliance, asset return tracking. Built with Next.js 14, TypeScript, PostgreSQL, Prisma ORM, and Tailwind CSS.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages