The Computer Management System (CMS) is a robust web application designed to manage, monitor, and control computers within an organization. Built on a centralized architecture with Backend as the coordination hub, the system orchestrates communication between the user interface and client computers. The Backend serves as the command center that processes all operations, providing real-time tracking of operational status, secure remote command execution, and comprehensive asset management capabilities.
- Features
- System Architecture
- Technologies
- Project Structure
- Setup & Installation
- Running the Project
- API Overview
- Configuration
- Documentation
- Contributing
- License
The CMS offers a robust set of features for effective computer asset management:
- Live Status Tracking: Monitor online/offline status via WebSocket connection
- Resource Monitoring: Track system metrics (CPU, RAM usage) in real-time
- Hardware Inventory: Collect and display detailed hardware information (OS, CPU, GPU, RAM, disk)
- Logical Grouping: Organize computers into virtual "Rooms"
- Visual Layout: Display computers in a spatial layout within each room
- Command Execution: Send console commands or system actions to remote computers
- Real-time Feedback: View command execution results as they happen
- Role-based Access: Administrator and User roles with appropriate permissions
- Granular Control: Admins manage the entire system while Users access assigned rooms/computers
- Multi-Factor Authentication: Enhanced security with MFA for new Agent registration
- Token Authentication: Secure communications using Agent Tokens
- Error Reporting: Agents report system errors to the central server
- Resolution Workflow: View, manage, and mark errors as resolved through the interface
- Comprehensive Filtering: Filter users, rooms, and computers by multiple criteria
- Fast Search: Quickly locate specific resources in the system
- Self-updating Agent: Agents automatically check for and install new versions
- Version Management: Admin interface for uploading and marking stable agent versions
- Admin Dashboard: Get an overview of system status and health
- Key Metrics: Track users, rooms, computers, online/offline status, and error states
- React & Ant Design: Clean, responsive user interface for optimal user experience
The CMS implements a hub-and-spoke architecture with Backend as the central coordination system:
%%{init: {
'theme': 'base',
'themeVariables': {
'primaryColor': '#4a90e2',
'primaryTextColor': '#ffffff',
'primaryBorderColor': '#2171c7',
'secondaryColor': '#82b1ff',
'tertiaryColor': '#b6e3ff',
'noteTextColor': '#333',
'noteBkgColor': '#fff9c4',
'noteBorderColor': '#f9a825',
'lineColor': '#666',
'textColor': '#333',
'mainBkg': '#fff',
'nodeBorder': '#2171c7',
'clusterBkg': '#f8f9fa'
},
'fontFamily': 'Arial',
'fontSize': '16px'
}}%%
flowchart TD
subgraph Architecture["π’ CMS Architecture System"]
direction TB
subgraph Client["π₯ Client Layer"]
direction LR
Frontend["π» Frontend<br/>(React/TypeScript)<br/>Modern User Interface"]
Agent["π€ Agent<br/>(.NET Core)<br/>Windows Service"]
%% Add descriptions
style Frontend fill:#61dafb,stroke:#20232a,stroke-width:2px,color:#000
style Agent fill:#512bd4,stroke:#3a1f99,stroke-width:2px,color:#fff
end
subgraph Server["βοΈ Server Layer"]
direction TB
Backend["π Backend<br/>(Node.js/Express)<br/>Central Coordination Hub"]
DB[(π PostgreSQL<br/>Database<br/>Data Storage)]
%% Add descriptions
style Backend fill:#339933,stroke:#1a4d1a,stroke-width:2px,color:#fff
style DB fill:#316192,stroke:#1a3d66,stroke-width:2px,color:#fff
end
%% Connections with descriptive labels
Frontend <-->|"π HTTP/REST API<br/>Secure Data Exchange"| Backend
Frontend <-.->|"β‘ WebSocket<br/>Real-time Updates"| Backend
Agent <-->|"π‘ HTTP/REST<br/>Command & Control"| Backend
Agent <-.->|"π WebSocket<br/>Status Reports"| Backend
Backend <-->|"πΎ Data Operations<br/>CRUD & Transactions"| DB
%% Add notes for clarity
note1["π Frontend provides modern<br/>responsive UI for users"]
note2["π Agent monitors and<br/>controls Windows systems"]
note3["π Backend orchestrates all<br/>system communications"]
note4["π Database ensures<br/>data persistence"]
%% Connect notes
Frontend --- note1
Agent --- note2
Backend --- note3
DB --- note4
%% Styling for layers
style Client fill:#f8f9fa,stroke:#dee2e6,stroke-width:2px
style Server fill:#f8f9fa,stroke:#dee2e6,stroke-width:2px
style Architecture fill:#ffffff,stroke:#e9ecef,stroke-width:3px
%% Style notes
classDef noteStyle fill:#fff9c4,stroke:#f9a825,stroke-width:1px,color:#333
class note1,note2,note3,note4 noteStyle
end
- Centralized Coordination Hub: Acts as the orchestration center for the entire system
- Two-way Command & Control: Manages bidirectional communication between Frontend and Agent
- Data Processing Center: Handles all business logic and data management operations
- API Gateway: Provides RESTful APIs for both Frontend and Agent interactions
- Real-time Communication: Manages WebSocket (Socket.IO) connections for instant updates
- Security Control: Handles authentication, authorization, and access control
- System Monitoring: Tracks agent status and system health
- Web-based user interface for system interaction
- Communication with Backend via REST APIs and WebSocket
- Data visualization including room layouts and computer statuses
- Administrative tools and dashboards
- Client application running as a Windows Service on managed computers
- System information collection (hardware specs, resource utilization)
- Secure communication with the Backend Server (HTTPS for API, WSS for WebSocket)
- Remote command execution and automatic updates
- Runtime: Node.js
- Framework: Express.js
- Database: PostgreSQL
- ORM: Sequelize
- Real-time: Socket.IO
- Authentication: JWT, bcrypt.js
- Security: otp-generator for MFA
- Logging: Winston
- Development: dotenv, nodemon
- Framework: React with Vite
- UI Library: Ant Design
- Styling: Tailwind CSS
- HTTP Client: Axios
- Real-time: Socket.IO Client
- Routing: React Router DOM
- State Management: React Context API
- Notifications: React Hot Toast
- Platform: .NET (C#)
- Communication: SocketIOClient.Net, HttpClient
- Logging: Serilog
- Windows Service: Microsoft.Extensions.Hosting.WindowsServices
- CLI: System.CommandLine
- Packaging: Inno Setup
- PostgreSQL with automated setup script
The project is organized into three main modules: Backend, Frontend, and Agent.
π Expanded Project Structure
computer-management-system/
βββ package.json # Main project dependencies and scripts
βββ README.md # Project documentation
β
βββ backend/ # Backend Server source code
β βββ create_db.sh # Database creation script
β βββ package.json # Backend dependencies and scripts
β βββ src/
β βββ app.js # Express app and Socket.IO initialization
β βββ server.js # HTTP server startup and database connection
β βββ config/ # Configuration files (database, auth)
β βββ controllers/ # Request handlers and service callers
β βββ database/ # Sequelize models, migrations, seeders
β βββ middleware/ # Authentication and permission middleware
β βββ routes/ # API endpoint definitions
β βββ services/ # Core business logic implementation
β βββ sockets/ # WebSocket event handling
β βββ utils/ # Utility functions and modules
β
βββ frontend/ # Frontend Application source code
β βββ package.json # Frontend dependencies and scripts
β βββ vite.config.js # Vite configuration
β βββ index.html # Root HTML file
β βββ src/
β βββ App.jsx # Root application component
β βββ main.jsx # React application entry point
β βββ assets/ # Static assets (images, icons)
β βββ components/ # Reusable UI components
β βββ contexts/ # React Context providers
β βββ hooks/ # Custom React hooks
β βββ layouts/ # Page layout components
β βββ pages/ # Page components
β βββ router/ # Routing configuration
β βββ services/ # API communication services
β
βββ agent/ # CMSAgent (.NET) source code
βββ CMSAgent.sln # .NET solution file
βββ README.md # Agent documentation
βββ build.ps1 # Installer build script
βββ build-update.ps1 # Update package build script
βββ src/ # Source code
β βββ CMSAgent/ # Main Agent implementation
β βββ CMSUpdater/ # Self-update implementation
β βββ CMSAgent.Common/ # Shared library
β βββ Setup/ # Installation packaging
βββ docs/ # Architecture documentation
Each module follows best practices for its respective technology stack:
- Backend: RESTful API design, service-oriented architecture, and middleware patterns
- Frontend: Component-based architecture with React hooks and contexts
- Agent: .NET service architecture with modular components
Before setting up CMS, ensure you have the following installed:
| Component | Minimum Version | Notes |
|---|---|---|
| Node.js | 16.x or higher | Includes npm |
| PostgreSQL | 12.x or higher | Required for database |
| Git | Any recent version | For cloning repository |
For Agent development:
- .NET SDK: 6.0 LTS or 8.0 LTS (check
agent/README.mdfor specific version) - Inno Setup: Required for building the installer package
- PowerShell: For running build scripts
π Detailed Backend Setup Instructions
-
Clone Repository
git clone <your-repository-url> cd computer-management-system
-
Install Dependencies
npm install
This installs
concurrentlyin the root and runsnpm installin bothbackendandfrontenddirectories. -
Configure Environment
cd backend cp .env.example .env # If .env.example exists
Edit
.envwith appropriate values:# Database Configuration DB_USER=myuser DB_PASSWORD=mypassword DB_NAME=mydatabase DB_HOST=localhost DB_PORT=5432 # JWT Configuration JWT_SECRET=cms-super-secret-key-please-change-me JWT_EXPIRES_IN=24h # Server Configuration PORT=3000 # Client URL (for CORS) CLIENT_URL=http://localhost:5173 -
Set Up Database
./create_db.sh # Create database and user npx sequelize-cli db:migrate # Set up tables npx sequelize-cli db:seed:all # (Optional) Add sample data
π Frontend Configuration
- Configure Environment
Create a
cd frontend.envfile with:VITE_API_URL=http://localhost:3000
π Agent Build & Installation
-
Build Agent
- Open
agent/CMSAgent.slnwith Visual Studio - Build in Release mode, or use:
cd agent ./build.ps1 # Will prompt for version number
- Open
-
Install on Client Machine
- Run generated installer with Admin privileges
- Follow setup wizard and configuration prompts
- Agent configuration will be stored in: -
C:\ProgramData\CMSAgent\runtime_config\runtime_config.json-C:\Program Files\CMSAgent\appsettings.json
Run Full Stack (Backend + Frontend)
npm run devRun Backend Only
cd backend
npm run devRun Frontend Only
cd frontend
npm run devBackend
cd backend
npm startFrontend
cd frontend
npm run build
# Serve the built files with your preferred static file serverCMS provides a comprehensive API for both Frontend and Agent communication.
π Frontend API Endpoints
| Endpoint | Description | Access Control |
|---|---|---|
/api/auth |
Authentication and user info | - |
/api/users |
User management (CRUD) | Admin only |
/api/rooms |
Room management | Admin or assigned users |
/api/computers |
Computer management | Admin or room access |
/api/admin/stats |
System statistics | Admin only |
/api/admin/agents/versions |
Agent version management | Admin only |
π€ Agent API Endpoints
| Endpoint | Description |
|---|---|
/api/agent/identify |
Register/identify agent |
/api/agent/verify-mfa |
Verify MFA for new agents |
/api/agent/hardware-info |
Send hardware information |
/api/agent/report-error |
Report computer errors |
/api/agent/check-update |
Check for agent updates |
/api/agent/agent-packages/:filename |
Download update packages |
sequenceDiagram
participant F as Frontend (Browser)
participant B as Backend Coordination Center
participant DB as Database
participant A as Agent (Windows)
rect rgb(240, 240, 240)
F ->> B: Status Updates
F ->> B: MFA
A ->> B: Status Data
Note over B: Orchestrates & Controls<br/>All Communications
B ->> DB: Store Data
DB ->> B: Retrieve Data
end
rect rgb(240, 240, 240)
F ->> B: Commands
B ->> A: Commands
end
Note over B: Backend as Communication Hub<br/>Processes, validates, and routes all<br/>commands and status updates
-
Backend as Communication Hub
- Orchestrates all data flow between Frontend and Agent
- Processes, validates, and routes all commands and status updates
- Maintains real-time state of the entire system
-
Frontend WebSocket Events
- Receives: Computer status updates, command results, MFA notifications
- Sends: Command execution requests to Backend for validation and routing
-
Agent WebSocket Events
- Receives: Validated command execution requests, version update notifications
- Sends: Resource status updates, command execution results for Backend processing
For detailed API documentation including request/response schemas, see: Complete API Documentation
βοΈ Configuration Files
.env: Environment variablesDB_USER, DB_PASSWORD, DB_NAME, DB_HOST, DB_PORT JWT_SECRET, JWT_EXPIRES_IN PORT, CLIENT_URLsrc/config/db.config.js: Sequelize database configurationsrc/config/auth.config.js: Authentication configuration
.env: Environment configurationVITE_API_URL=http://localhost:3000
appsettings.json: Main operational configuration- Server URL
- Reporting intervals
- Resource thresholds
- Logging settings
runtime_config.json: Machine-specific configuration- Agent ID and token
- Room assignment
- Position coordinates
The following resources provide detailed information about different aspects of the CMS:
| Document | Description |
|---|---|
| Backend API Documentation | Comprehensive API reference |
| Agent README | Agent overview and setup |
| Agent Architecture | Detailed agent architecture |
| Agent Comprehensive Guide | In-depth agent documentation |
| Agent Workflows | Agent communication flows |
We welcome contributions to the Computer Management System! Please contact the project maintainer for contribution guidelines.
Β© 2025 Computer Management System. All rights reserved.
Computer Management System
Streamlining IT management for organizations