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
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
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
Automation
- SSH command execution for remote theme changes
- Daemon service for automated task execution
- Event-based theme switching
- Background process monitoring
- Automated theme deployment
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
Web Application
- Express.js server
- Vue.js frontend
- Handlebars templating
- LESS CSS preprocessing
- RESTful API endpoints
Daemon Service
- Automated task execution
- Event monitoring
- SSH command execution
- Status monitoring
- Start/Stop control
- Background process management
CMS Features
- Portal management
- Theme management
- File upload/download
- Email template system
- Company-specific configurations
- Theme event scheduling
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
- The project requires specific Node.js version (0.12.7) for compatibility
- Vue.js must be kept at version 0.12.x
- The application uses a specific deployment process for different environments
- SSH access is required for remote theme changes
- LDAP authentication is mandatory for access
- Theme events cannot overlap for the same company
- Environment-specific data storage is used
Deployment Requirements
- Node.js v0.12.7
- NPM v2.12.1
- Global npm packages:
- express-generator
- gulp
- bower
- browserify
- livereload
- SSH access to target servers
- LDAP server configuration
- Environment-specific configurations
Security Considerations
- LDAP authentication required
- SSH key-based authentication for remote operations
- Environment-specific configurations
- Secure file handling
- Upload file validation
- Company-specific access control
- Secure data storage
Maintenance Notes
- The project contains legacy code and dependencies
- Version updates should be carefully managed
- Environment-specific configurations need to be maintained
- Regular backup of data and configurations recommended
- Monitor daemon service status
- Check for theme event conflicts
- Maintain SSH connections
Future Considerations
- Potential upgrade to newer Node.js versions
- Modernization of frontend framework
- Security updates and patches
- Dependency updates and compatibility checks
- Migration to modern build tools
- Enhanced error handling
- Improved logging system
- Automated testing implementation