Skip to content

anilveersingh1308/productivity-tracking-system

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Productivity Tracking System

A comprehensive full-stack web application for tracking daily tasks, measuring productivity metrics, and visualizing performance through real-time analytics.

Features

🎯 Task Management

  • Create, read, update, and delete tasks
  • Task prioritization (low, medium, high, urgent)
  • Task status tracking (todo, in progress, completed, cancelled)
  • Due date management
  • Recurring tasks support
  • Task tagging system
  • Estimated vs actual time tracking

⏱️ Time Tracking

  • Real-time time tracking sessions
  • Start, pause, and stop functionality
  • Time duration calculation
  • Session notes

📊 Analytics & Reporting

  • Daily productivity statistics
  • Weekly performance comparison
  • Monthly productivity overview
  • Task completion rates
  • Time efficiency analysis
  • Productivity score calculation (0-100)
  • Visual charts using Chart.js

🔄 Real-time Updates

  • WebSocket support for live task updates
  • Real-time synchronization across devices
  • Instant productivity metric updates

👤 User Management

  • JWT-based authentication
  • User registration and login
  • Profile management
  • User preferences (theme, timezone, notifications)
  • Activity logging

🔐 Security Features

  • JWT token-based authentication
  • Password hashing with bcrypt
  • CSRF protection
  • CORS configuration
  • Input validation and sanitization
  • Rate limiting
  • Role-based access control

Technology Stack

Backend

  • Framework: Django 4.2 with Django REST Framework
  • Database: PostgreSQL
  • Authentication: JWT (Simple JWT)
  • Real-time: Django Channels + Redis
  • Task Queue: Celery
  • API Documentation: Swagger/OpenAPI (drf-spectacular)

Frontend

  • Framework: React 18
  • State Management: Zustand
  • HTTP Client: Axios
  • Routing: React Router v6
  • Charts: Chart.js with react-chartjs-2
  • Styling: Tailwind CSS
  • Icons: React Icons

Infrastructure

  • Deployment: Docker, Docker Compose
  • Web Server: Nginx
  • ASGI Server: Daphne
  • WSGI Server: Gunicorn
  • Task Scheduler: Celery + Beat
  • Caching: Redis

Project Structure

Productivity-Tracking-System/
├── backend/
│   ├── config/
│   │   ├── settings.py
│   │   ├── urls.py
│   │   ├── wsgi.py
│   │   └── asgi.py
│   ├── core/
│   │   ├── models.py (User, UserPreference, ActivityLog)
│   │   ├── views/
│   │   ├── serializers.py
│   │   └── urls/
│   ├── tasks/
│   │   ├── models.py (Task, TimeTrackingSession, DailyProductivityLog)
│   │   ├── views.py
│   │   ├── serializers.py
│   │   ├── consumers.py (WebSocket)
│   │   ├── routing.py
│   │   └── signals.py
│   ├── analytics/
│   │   ├── views.py
│   │   ├── serializers.py
│   │   └── urls.py
│   ├── requirements.txt
│   └── manage.py
├── frontend/
│   ├── src/
│   │   ├── components/
│   │   │   ├── Layout/
│   │   │   ├── Task/
│   │   │   └── Analytics/
│   │   ├── pages/
│   │   ├── context/store.js
│   │   ├── services/
│   │   ├── App.js
│   │   └── index.js
│   ├── package.json
│   └── public/
└── docs/
    ├── API_DOCUMENTATION.md
    └── SETUP_DEPLOYMENT.md

Quick Start

Prerequisites

  • Python 3.9+
  • Node.js 16+
  • PostgreSQL 12+
  • Redis 6+

Backend Setup

cd backend
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt

cp .env.example .env
# Edit .env with your configuration

python manage.py migrate
python manage.py createsuperuser
python manage.py runserver

Frontend Setup

cd frontend
npm install
cp .env.example .env
# Edit .env with your API URL

npm start

Visit http://localhost:3000 to access the application.

API Endpoints

Authentication

  • POST /api/auth/register/ - Register new user
  • POST /api/auth/login/ - User login
  • POST /api/auth/logout/ - User logout
  • POST /api/auth/token/refresh/ - Refresh JWT token
  • POST /api/auth/change-password/ - Change password

Tasks

  • GET /api/tasks/ - List all tasks
  • POST /api/tasks/ - Create task
  • GET /api/tasks/{id}/ - Get task details
  • PUT /api/tasks/{id}/ - Update task
  • DELETE /api/tasks/{id}/ - Delete task
  • POST /api/tasks/{id}/mark_completed/ - Mark task as completed
  • GET /api/tasks/today/ - Get today's tasks
  • GET /api/tasks/overdue/ - Get overdue tasks

Time Tracking

  • POST /api/tasks/sessions/ - Start time session
  • POST /api/tasks/sessions/{id}/stop/ - Stop session
  • GET /api/tasks/sessions/active/ - Get active sessions

Analytics

  • GET /api/analytics/metrics/ - Get productivity metrics
  • GET /api/analytics/daily/ - Get daily statistics
  • GET /api/analytics/weekly/ - Get weekly statistics
  • GET /api/analytics/monthly/ - Get monthly statistics
  • GET /api/analytics/tasks/ - Get task analytics

Key Features Explained

Productivity Score Calculation

Score = (Completion Rate × 0.6) + (Time Efficiency × 0.4)
- Completion Rate: (Tasks Completed / Tasks Planned) × 100
- Time Efficiency: (Planned Time / Actual Time) × 100

Real-time Updates

WebSocket connection at /ws/tasks/ provides:

  • Task status updates
  • Productivity log changes
  • Activity notifications

Role-Based Access Control

  • User: Can manage own tasks and view own analytics
  • Admin: Full system access

Database Schema Highlights

  • Normalized design with proper foreign keys
  • Indexes on frequently queried fields
  • Unique constraints where appropriate
  • Cascading deletes for data integrity
  • Audit logging with ActivityLog model

Security Measures

✅ JWT token-based authentication ✅ Password hashing with Django's built-in system ✅ CSRF protection enabled ✅ CORS properly configured ✅ Input validation and sanitization ✅ SQL injection protection (ORM usage) ✅ XSS protection with React ✅ Rate limiting ready ✅ Secrets management via environment variables

Performance Optimization

  • Database query optimization with .select_related() and .prefetch_related()
  • Redis caching for frequently accessed data
  • Pagination on all list endpoints
  • Efficient WebSocket message handling
  • Static file compression
  • CDN-ready architecture

Testing

# Backend tests
cd backend
python manage.py test

# Frontend tests
cd frontend
npm test

Deployment Options

  1. Docker - Containerized deployment
  2. AWS EC2 - Traditional server deployment
  3. Azure App Service - Managed platform
  4. Heroku - Quick deployment (with minimal config)
  5. DigitalOcean - VPS deployment

See SETUP_DEPLOYMENT.md for detailed instructions.

Contributing

  1. Fork the repository
  2. Create feature branch (git checkout -b feature/amazing-feature)
  3. Commit changes (git commit -m 'Add amazing feature')
  4. Push to branch (git push origin feature/amazing-feature)
  5. Open Pull Request

License

This project is licensed under the MIT License.

Support

For issues, questions, or feature requests:

  1. Check the API Documentation
  2. Review the Setup & Deployment Guide
  3. Open an issue on GitHub

Roadmap

  • Mobile app (React Native)
  • Advanced reporting and export
  • Team collaboration features
  • Integration with calendar (Google Calendar, Outlook)
  • AI-powered productivity insights
  • Habit tracking
  • Goal setting and tracking
  • Pomodoro timer integration
  • Slack integration
  • Email reminders