0 / 0
Skip to content

Themoccurrence Project

Project Overview

Themoccurrence is a NodeJS-based web application and daemon service I developed to manage and automate theme changes across multiple web portals. Developed between 2015-2016, the project was built using older technologies and serves as a CMS-like system for managing portal themes and automated tasks.

Download

You can download the project source code from: themoccurrence.zip

Technical Stack

  • Node.js: v0.12.7
  • Vue.js: v0.12.16 (specifically kept at this version for compatibility)
  • Express.js: v4.13.1
  • Frontend Framework: Color Admin theme v1.8
  • Authentication: LDAP-based authentication
  • Build Tools:
    • Gulp for task automation
    • Bower for package management
    • Browserify for JavaScript bundling
  • Backend Libraries:
    • lodash: Utility functions
    • fs-extra: Enhanced file system operations
    • express-mailer: Email functionality
    • multer: File upload handling

Core Features

  1. Theme Management

    • Calendar-based theme scheduling
    • Theme events with start and end dates
    • Automatic theme activation based on date ranges
    • Overlap detection for theme events
    • Theme validation and conflict checking
  2. Portal Management

    • CMS capabilities for managing portals/companies
    • Import/Export functionality
    • ZIP file handling
    • Email template management with theming
    • Company-specific theme management
    • Theme event scheduling per company
  3. Automation

    • SSH command execution for remote theme changes
    • Daemon service for automated task execution
    • Event-based theme switching
    • Background process monitoring
    • Automated theme deployment
  4. Security

    • LDAP authentication integration
    • Secure SSH connections for remote operations
    • Environment-specific security configurations
    • File upload security measures

Project Structure

themoccurrence/
├── bin/                 # Application startup scripts
├── config/             # Configuration files
├── data/               # Data storage
│   ├── json/          # JSON data files
│   └── uploads/       # Uploaded files
├── init.d/             # Service initialization scripts
├── public/             # Static assets
├── resources/          # Resource files
│   └── backend/       # Backend utilities
├── routes/             # Express.js routes
│   ├── companies.js   # Company management
│   ├── daemon.js      # Daemon control
│   ├── force.js       # Force operations
│   ├── model.js       # Core business logic
│   ├── uploads.js     # File upload handling
│   └── users.js       # User management
├── tests/              # Test files
├── views/              # View templates
└── tmp/                # Temporary files

Key Components

  1. Web Application

    • Express.js server
    • Vue.js frontend
    • Handlebars templating
    • LESS CSS preprocessing
    • RESTful API endpoints
  2. Daemon Service

    • Automated task execution
    • Event monitoring
    • SSH command execution
    • Status monitoring
    • Start/Stop control
    • Background process management
  3. CMS Features

    • Portal management
    • Theme management
    • File upload/download
    • Email template system
    • Company-specific configurations
    • Theme event scheduling
  4. Core Business Logic

    • Theme event validation
    • Date range checking
    • Overlap detection
    • Data filtering and validation
    • Company-specific operations

Environment Support

The application supports multiple environments:

  • Test
  • Local
  • Development
  • Production

Each environment has its own:

  • Configuration files
  • Data storage
  • SSH connections
  • Security settings
  • Deployment process

Dependencies

Key dependencies include:

  • express: Web framework
  • vue: Frontend framework
  • less: CSS preprocessing
  • archiver: ZIP file handling
  • express-mailer: Email functionality
  • multer: File upload handling
  • moment: Date handling
  • lodash: Utility functions
  • fs-extra: Enhanced file system operations

Development Tools

  • Gulp for task automation
  • Browserify for JavaScript bundling
  • Bower for frontend package management
  • Livereload for development
  • Custom bash scripts for deployment

Important Notes

  1. The project requires specific Node.js version (0.12.7) for compatibility
  2. Vue.js must be kept at version 0.12.x
  3. The application uses a specific deployment process for different environments
  4. SSH access is required for remote theme changes
  5. LDAP authentication is mandatory for access
  6. Theme events cannot overlap for the same company
  7. Environment-specific data storage is used

Deployment Requirements

  1. Node.js v0.12.7
  2. NPM v2.12.1
  3. Global npm packages:
    • express-generator
    • gulp
    • bower
    • browserify
    • livereload
  4. SSH access to target servers
  5. LDAP server configuration
  6. Environment-specific configurations

Security Considerations

  1. LDAP authentication required
  2. SSH key-based authentication for remote operations
  3. Environment-specific configurations
  4. Secure file handling
  5. Upload file validation
  6. Company-specific access control
  7. Secure data storage

Maintenance Notes

  1. The project contains legacy code and dependencies
  2. Version updates should be carefully managed
  3. Environment-specific configurations need to be maintained
  4. Regular backup of data and configurations recommended
  5. Monitor daemon service status
  6. Check for theme event conflicts
  7. Maintain SSH connections

Future Considerations

  1. Potential upgrade to newer Node.js versions
  2. Modernization of frontend framework
  3. Security updates and patches
  4. Dependency updates and compatibility checks
  5. Migration to modern build tools
  6. Enhanced error handling
  7. Improved logging system
  8. Automated testing implementation