Skip to content

engmaryamameen/Activity-Tracker-Bryntum-Gantt-Charts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Gantt - Enterprise-Grade Bryntum Gantt Integration

A production-ready project management solution integrating Bryntum Gantt with Next.js frontend, Express.js backend, and MongoDB persistence.

Next.js Express.js MongoDB Bryntum Gantt

🎯 Overview

This project provides a complete, enterprise-grade implementation of Bryntum Gantt chart library integrated with modern web technologies. It demonstrates best practices for:

  • Frontend: Next.js 14 with App Router, TypeScript, and client-side rendering
  • Backend: Express.js RESTful API with MongoDB persistence
  • Data Management: Real-time synchronization using Bryntum's CrudManager
  • User Experience: Professional Gantt chart with full feature set matching Bryntum's official demos

Key Highlights

βœ… Full Feature Parity with Bryntum Gantt professional demo
βœ… Type-Safe TypeScript implementation
βœ… Production-Ready error handling and validation
βœ… Scalable architecture supporting large datasets
βœ… Real-Time Sync with automatic conflict resolution
βœ… Comprehensive task management (CRUD, dependencies, resources)

Main Gantt Chart View Full-featured Gantt chart with tasks, dependencies, and timeline visualization

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                     Client (Browser)                         β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚         Next.js Frontend (Port 3000)                 β”‚   β”‚
β”‚  β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚   β”‚
β”‚  β”‚  β”‚     Bryntum Gantt Component                  β”‚   β”‚   β”‚
β”‚  β”‚  β”‚  - Task Management                           β”‚   β”‚   β”‚
β”‚  β”‚  β”‚  - Dependency Visualization                  β”‚   β”‚   β”‚
β”‚  β”‚  β”‚  - Resource Assignment                       β”‚   β”‚   β”‚
β”‚  β”‚  β”‚  - Real-time Updates                         β”‚   β”‚   β”‚
β”‚  β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚   β”‚
β”‚  β”‚              ↕ CrudManager API                       β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                          ↕ HTTP/REST
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              Express.js Backend (Port 3001)                 β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚              REST API Endpoints                      β”‚   β”‚
β”‚  β”‚  - GET  /api/load  (Load all data)                  β”‚   β”‚
β”‚  β”‚  - POST /api/sync  (Sync changes)                    β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚              ↕ Mongoose ODM                                 β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚              MongoDB Database                         β”‚   β”‚
β”‚  β”‚  Collections: tasks, dependencies,                   β”‚   β”‚
β”‚  β”‚             resources, assignments                   β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

✨ Features

Core Functionality

  • Task Management

    • Create, read, update, delete tasks
    • Hierarchical task structure (parent/child relationships)
    • WBS (Work Breakdown Structure) support
    • Task duration and effort tracking
    • Progress percentage visualization
    • Milestone conversion
  • Dependencies

    • Visual dependency lines between tasks
    • Predecessor/successor relationships
    • Dependency types (Finish-to-Start, etc.)
    • Lag time configuration
    • Automatic constraint calculation
  • Resource Management

    • Resource assignment to tasks
    • Resource allocation units
    • Resource calendar support
  • Visual Features

    • Task Color Customization: Right-click any task bar to change its color

    Task Color Customization Customize task bar colors via context menu

    • Milestone Conversion: Convert tasks to milestones via context menu

    Milestone Conversion Convert tasks to milestones with a single click

    • Progress bars with percentage completion
    • Timeline visualization with customizable view presets
    • Zoom controls (in, out, fit, previous/next)
    • Current time indicator

User Interface

  • Toolbar

    • Create new tasks
    • Undo/Redo operations
    • Expand/Collapse all tasks
    • Zoom controls
    • Task search/filter
  • Context Menu (Right-click on tasks)

    • Edit task
    • Add task (above/below/subtask)
    • Convert to milestone
    • Delete task
    • Cut/Copy/Paste
    • Duplicate task
    • Split task
    • Indent/Outdent
    • Add dependencies
    • Color picker for task bars

    Context Menu Rich context menu with all task management options

    • Scroll to task
    • Expand to fit
  • Task Editor Dialog

    • General tab (name, dates, duration, progress, effort)
    • Predecessors tab
    • Successors tab
    • Resources tab
    • Advanced tab (scheduling mode, constraints, calendar)
    • Color field for task customization

    Task Editor Comprehensive task editor with multiple tabs and fields

Data Synchronization

  • Automatic save on changes (autoSync)
  • Optimistic UI updates
  • Conflict resolution
  • Transaction support (undo/redo)
  • Dirty state tracking

πŸ“Š Data Model

Bryntum Gantt uses 4 core data models that are part of the official Bryntum data structure:

Core Models

  1. Task - Represents project tasks/work items

    • Properties: name, dates, duration, progress, hierarchy (parent/child)
    • Purpose: The fundamental building blocks of your project plan
  2. Dependency - Defines relationships between tasks

    • Properties: fromEvent, toEvent, type, lag
    • Purpose: Creates the project's critical path and task sequencing
  3. Resource - Represents people, equipment, or materials

    • Properties: name, email, calendar, imageUrl
    • Purpose: Tracks who/what is available to work on tasks
  4. Assignment - Links resources to tasks

    • Properties: eventId, resourceId, units (allocation %)
    • Purpose: Manages resource allocation and workload

These models are official Bryntum data structures and are required for the Gantt chart to function. They follow industry-standard project management practices.

πŸ“– For detailed information, see Data Model Documentation

πŸ“¦ Prerequisites

Required Software

Bryntum Gantt Trial

This project uses the Bryntum Gantt trial version. The trial files should be located at:

bryntum-gantt-trial/gantt-6.3.3-trial/

For production use, you'll need a valid Bryntum license.

πŸš€ Quick Start

1. Clone and Navigate

cd Activity-Tracker-Bryntum-Gantt-Charts

2. Backend Setup

cd backend
npm install

Create backend/.env:

PORT=3001
MONGODB_URI=mongodb://localhost:27017/gantt_db
NODE_ENV=development

For MongoDB Atlas:

MONGODB_URI=mongodb+srv://username:[email protected]/gantt_db

3. Frontend Setup

cd ../frontend
npm install

Important: Set up Bryntum Gantt packages. Since we're using the trial version:

# Create symlink to Bryntum build directory
mkdir -p node_modules/@bryntum
ln -s ../../../bryntum-gantt-trial/gantt-6.3.3-trial/build node_modules/@bryntum/gantt

# Copy theme assets
mkdir -p public/themes
cp -r ../../bryntum-gantt-trial/gantt-6.3.3-trial/build/gantt.stockholm*.css public/themes/
cp -r ../../bryntum-gantt-trial/gantt-6.3.3-trial/build/fonts public/themes/

4. Database Setup

Start MongoDB (if local):

# macOS
brew services start mongodb-community

# Linux
sudo systemctl start mongod

# Windows - Start MongoDB service from Services panel

Seed the database:

cd backend
npm run seed

5. Run the Application

Terminal 1 - Backend:

cd backend
npm run dev

Terminal 2 - Frontend:

cd frontend
npm run dev

6. Access the Application

Open your browser and navigate to:

http://localhost:3000

Application Running Application running with full Gantt chart functionality

πŸ“ Project Structure

Activity-Tracker-Bryntum-Gantt-Charts/
β”œβ”€β”€ frontend/                    # Next.js application
β”‚   β”œβ”€β”€ app/                     # Next.js App Router
β”‚   β”‚   β”œβ”€β”€ layout.tsx           # Root layout
β”‚   β”‚   β”œβ”€β”€ page.tsx             # Main page
β”‚   β”‚   └── globals.css          # Global styles
β”‚   β”œβ”€β”€ components/              # React components
β”‚   β”‚   β”œβ”€β”€ Gantt.tsx            # Gantt wrapper component
β”‚   β”‚   └── GanttConfig.ts       # Gantt configuration
β”‚   β”œβ”€β”€ public/                  # Static assets
β”‚   β”‚   └── themes/              # Bryntum theme files
β”‚   β”œβ”€β”€ package.json
β”‚   β”œβ”€β”€ tsconfig.json
β”‚   └── next.config.js
β”‚
β”œβ”€β”€ backend/                     # Express.js server
β”‚   β”œβ”€β”€ models/                  # Mongoose models
β”‚   β”‚   β”œβ”€β”€ Task.js              # Task schema
β”‚   β”‚   β”œβ”€β”€ Dependency.js        # Dependency schema
β”‚   β”‚   β”œβ”€β”€ Resource.js          # Resource schema
β”‚   β”‚   └── Assignment.js        # Assignment schema
β”‚   β”œβ”€β”€ routes/                  # API routes
β”‚   β”‚   └── gantt.js             # Gantt CRUD endpoints
β”‚   β”œβ”€β”€ scripts/                  # Utility scripts
β”‚   β”‚   └── seed.js              # Database seeding
β”‚   β”œβ”€β”€ server.js                # Express server entry
β”‚   β”œβ”€β”€ package.json
β”‚   └── .env                     # Environment variables
β”‚
└── README.md                    # This file

βš™οΈ Configuration

Backend Configuration

Environment Variables (backend/.env):

PORT=3001                                    # Server port
MONGODB_URI=mongodb://localhost:27017/gantt_db  # MongoDB connection
NODE_ENV=development                        # Environment mode

Frontend Configuration

Environment Variables (frontend/.env.local):

NEXT_PUBLIC_API_URL=http://localhost:3001/api

Gantt Configuration (frontend/components/GanttConfig.ts):

Key configuration options:

{
  project: {
    autoLoad: true,        // Auto-load data on init
    autoSync: true,        // Auto-save changes
    loadUrl: '/api/load',  // Load endpoint
    syncUrl: '/api/sync'   // Sync endpoint
  },
  showTaskColorPickers: true,  // Enable color pickers
}

MongoDB Schema

Task Model:

  • id (Number, unique, indexed) - Bryntum task ID
  • parentId (Number) - Parent task reference
  • name (String) - Task name
  • startDate, endDate (Date) - Task dates
  • duration (Number) - Task duration
  • percentDone (Number) - Completion percentage
  • eventColor (String) - Task bar color
  • ... and more fields

Dependency Model:

  • id (Number, unique)
  • fromEvent (Number) - Source task ID
  • toEvent (Number) - Target task ID
  • type (Number) - Dependency type
  • lag (Number) - Lag time

Resource & Assignment Models:

  • Similar structure following Bryntum's data model

πŸ“‘ API Documentation

GET /api/load

Loads all Gantt data from MongoDB. Returns tasks, dependencies, resources, and assignments in Bryntum's expected format.

POST /api/sync

Synchronizes changes from the Gantt chart to MongoDB. Accepts added, updated, and removed records for all data types (tasks, dependencies, resources, assignments). Returns success status and any newly created record IDs mapped from phantom IDs.

πŸ’» Development Guide

Adding New Features

  1. Frontend (Gantt Features)

    • Edit frontend/components/GanttConfig.ts
    • Add feature configuration to features object
    • Update TypeScript types if needed
  2. Backend (API Endpoints)

    • Edit backend/routes/gantt.js
    • Add new endpoints or modify existing ones
    • Update models in backend/models/ if schema changes

Code Style

  • TypeScript: Strict mode enabled
  • ESLint: Next.js recommended rules
  • Prettier: Auto-formatting (if configured)

Testing

# Backend
cd backend
npm test  # (if tests are configured)

# Frontend
cd frontend
npm run lint
npm run build  # Test production build

Debugging

Backend:

  • Check console logs in terminal
  • MongoDB queries: Use mongosh or MongoDB Compass
  • API testing: Use Postman or curl

Frontend:

  • Browser DevTools console
  • React DevTools extension
  • Network tab for API calls

Environment Variables

Set production environment variables:

  • NEXT_PUBLIC_API_URL - Backend API URL
  • MONGODB_URI - Production MongoDB connection
  • NODE_ENV=production

Security Considerations

  • βœ… CORS configured for specific origins
  • βœ… Input validation on backend
  • βœ… MongoDB injection prevention (Mongoose)
  • ⚠️ Add authentication/authorization
  • ⚠️ Add rate limiting
  • ⚠️ Use HTTPS in production
  • ⚠️ Secure MongoDB connection (SSL/TLS)

πŸ› Troubleshooting

For detailed troubleshooting guides and solutions to common issues, please refer to:

πŸ“– Common Issues and Troubleshooting Guide

This comprehensive guide covers:

  • Installation Issues - Node.js, package installation, permissions
  • Bryntum Package Issues - Module not found, theme loading, watermark
  • Database Connection Issues - MongoDB local and Atlas connections
  • API and Network Issues - CORS, 404/500 errors, network failures
  • Build and Compilation Issues - TypeScript errors, Next.js build failures
  • Runtime Errors - Gantt rendering, task menu, data saving
  • Performance Issues - Slow loading, memory leaks, large datasets

Quick Fixes

Bryntum packages not found:

cd frontend
rm -rf node_modules/@bryntum
mkdir -p node_modules/@bryntum
ln -s ../../../bryntum-gantt-trial/gantt-6.3.3-trial/build node_modules/@bryntum/gantt

MongoDB connection errors:

  • Verify MongoDB is running: mongosh or mongo
  • Check connection string in backend/.env
  • For Atlas: Whitelist your IP address

Data not loading:

  • Check browser console for errors
  • Verify backend is running: curl http://localhost:3001/api/load
  • Seed database: cd backend && npm run seed

For more detailed solutions, see the Common Issues Guide.

🀝 Contributing

Development Workflow

  1. Create a feature branch
  2. Make changes
  3. Test thoroughly
  4. Update documentation
  5. Submit pull request

Code Review Checklist

  • Code follows project style guide
  • TypeScript types are correct
  • No console.logs in production code
  • Error handling is implemented
  • Documentation is updated
  • Tests pass (if applicable)

πŸ“š Additional Resources

Bryntum Gantt

Technologies

πŸ“„ License

This project uses Bryntum Gantt trial version. For production use, you need a valid Bryntum license.

See Bryntum Licensing for details.


Built with ❀️ using Bryntum Gantt, Next.js, Express.js, and MongoDB