How dmytro-shvetsov/employee-tracker works
Project Type and Purpose
• This is a full-stack employee productivity tracking solution composed of:
• A native desktop client (ETClient) built with Qt/C++ for data collection (network packets, screenshots, idle detection).
• A backend web application (ETWeb) using Django with Channels (WebSocket) and REST Framework for data ingestion, storage, authentication, and server-side logic.
• A single-page React frontend for managers to view real-time and historical employee activity via REST calls and WebSocket updates.
File Structure Analysis
• Top-level folders:
• ETClient – Qt project with UI, business logic, networking, and Pcap++ dependency subfolders.
• ETWeb – Django project containing:
– accounts, projects, employees apps (models, migrations, REST serializers/views).
– api endpoints under ETWeb/api for non-app-specific services.
– consumers.py, routing.py for WebSocket entry points.
– frontend submodule (React components, services, Webpack config).
• Build/deployment:
• ETClient.pro and deployment archives for client releases.
• ETWeb requirements.txt, Procfile, runtime.txt, webpack.config.js for deployment.
README Insights
• Desktop client collects: HTTP/SSL/TLS traffic stats, screenshots, idle prompts with WebSocket streams to server.
• Web app provides: authentication, project/user management, real-time status updates, activity log visualizations.
a. Main Components
1. ETClient Desktop Application
– UI Layer: AuthForm, MainWindow (Model-View-Presenter)
– Data Collection Layer: NetworkManager, Base/Http/SSL StatsCollectors, ScreenshotManager, IdleDetector
– Communication Layer: WebsocketClient (Qt WebSocket)
– Packet Capture Dependency: Pcap++ library modules (Ethernet, IP, TCP, SSL layers)
2. ETWeb Backend
– WebSocket Server: Django Channels consumer(s) handling incoming streams from clients
– REST API: Django REST Framework endpoints for frontend queries (accounts, projects, employees, logs)
– Authentication & Tokens: custom auth backends, token generation/signals
– Data Persistence: Relational database (e.g., PostgreSQL) storing user, project, activity records
– Business Logic: accounts, projects, employees Django apps
3. React Frontend
– Components: Auth, Dashboard, Charts, Forms under src/components
– Services: axios instance for REST, mailService, projectsService
– WebSocket Client: receives real-time status changes pushed by backend
– Routing and Layout containers
b. Interactions and Data Flows
1. Desktop client → Backend WebSocket
• On authorization success, open WebSocket to server (ETWeb/routing.py → consumers.py).
• Stream JSON payloads containing packet stats, screenshot data, idle status.
2. Backend → Database
• WebSocket consumer processes incoming messages → persists to DB via Django models.
3. Frontend → Backend REST
• React services call protected REST endpoints (login, fetch projects, fetch logs).
4. Backend → Frontend WebSocket
• On status changes or new data, Django Channels pushes updates over WebSocket to React client.
5. Frontend → User Browser
• Render UI, charts, notifications, pages (Auth, Dashboard, Project pages).
c. Architectural Patterns
• Client uses MVP (UI form, model, presenter) and loosely-coupled collectors and managers.
• Backend follows Django’s MVT with Channels for asynchronous messaging and REST for synchronous queries.
• Frontend is a standard React SPA with component-based design and services layer.
d. Key Technologies
• C++/Qt, Pcap++ on client
• Python/Django, Django REST Framework, Django Channels, WebSockets
• React, React-Router, Axios, Webpack, npm on frontend
• Relational database (PostgreSQL or similar)