Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Interactive organizational chart and employee analytics dashboard built with Next.js 15

Notifications You must be signed in to change notification settings

martin-iliew/organizational-chart

Repository files navigation

Organizational Chart

A modern, interactive organizational chart application built with Next.js 15, featuring hierarchical visualization and comprehensive employee data analysis.

Organizational Chart Dashboard

Features

Interactive Organizational Chart

  • Hierarchical Visualization: Displays company structure with automatic Dagre-based layout
  • Department Hierarchy: Board of Directors → Engineering, HR, Marketing, Sales, IT Support
  • Real-time Data: Fetches organizational structure from database via API
  • Interactive Controls: Pan, zoom, and navigate through the organizational tree
  • Mini-map Navigation: Quick overview and navigation of large hierarchies

Data Analysis Dashboard

Data Analysis Table
  • Comprehensive Employee Table: View all employee data with advanced filtering
  • Profile Pictures: UI Avatars integration for consistent visual identity
  • Status Badges: Color-coded active/inactive employee status
  • Sortable Columns: Sort by name, salary, start date, and more
  • Advanced Filtering: Filter by first name, last name, gender, and department
  • Column Visibility: Show/hide columns based on your needs
  • Pagination: Navigate through large datasets efficiently

Tech Stack

Getting Started

Prerequisites

  • Node.js 18+ and pnpm
  • MySQL database

Installation

  1. Clone the repository:
git clone https://github.com/martin-iliew/organizational-chart.git
cd organizational-chart
  1. Install dependencies:
pnpm install
  1. Set up environment variables:
cp .env.example .env

Edit .env and add your database connection string:

DATABASE_URL="mysql://user:password@localhost:3306/orgchart"
  1. Push the database schema:
pnpm db:push
  1. Seed the database with sample data:
pnpm db:seed
  1. Run the development server:
pnpm dev
  1. Open http://localhost:3000 in your browser.

Project Structure

organizational-chart/
├── src/
│   ├── app/                    # Next.js app router pages
│   │   ├── api/               # API routes
│   │   │   ├── employees/     # Employee data endpoint
│   │   │   └── hierarchy/     # Organizational hierarchy endpoint
│   │   ├── dashboard/         # Dashboard pages
│   │   └── layout.tsx
│   ├── components/            # React components
│   │   ├── nodes/            # Custom React Flow nodes
│   │   ├── edges/            # Custom React Flow edges
│   │   ├── ui/               # shadcn/ui components
│   │   ├── OrgChartComponent.tsx
│   │   ├── DataTable.tsx
│   │   └── Columns.tsx
│   ├── db/                   # Database configuration
│   │   ├── schema.ts         # Drizzle schema
│   │   ├── queries/          # Database queries
│   │   └── seed.ts           # Database seeding script
│   ├── lib/                  # Utility functions
│   │   ├── layoutUtils.ts    # Dagre layout logic
│   │   └── placeholder-data.ts
│   └── types/                # TypeScript type definitions
├── public/                   # Static assets
└── package.json

Database Schema

The application uses the following main entities:

  • Regions: Geographic regions
  • Settlements: Cities within regions
  • Citizens: Personal information
  • Positions: Job positions/titles
  • Departments: Organizational departments with hierarchical relationships
  • Employees: Links citizens to departments and positions

Features in Detail

Organizational Chart

  • Automatically layouts departments in a hierarchical tree structure
  • Each node displays the department name and head's profile picture
  • Supports nested departments (e.g., Engineering → Atlassian, QA)
  • Interactive controls for zoom, pan, and fit-to-view
  • Professional styling with hover effects and smooth transitions

Data Table

  • Displays comprehensive employee information
  • Real-time filtering and sorting
  • Responsive design with zebra-striped rows
  • Professional UI with status badges and formatted data
  • Export-ready for reports and analysis

Scripts

pnpm dev          # Start development server
pnpm build        # Build for production
pnpm start        # Start production server
pnpm lint         # Run ESLint
pnpm db:push      # Push schema to database
pnpm db:seed      # Seed database with sample data

About

Interactive organizational chart and employee analytics dashboard built with Next.js 15

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published