Your AI-powered companion for better mental health and study productivity
Smart Desktop Buddies is my final year project for Software Engineering course at University of Malaya. It is a full-stack web application designed to help students and professionals improve their mental health, productivity, and overall well-being. The application combines mood tracking, task management, focus timers, calendar integration, and an AI chatbot companion to create a productivity and wellness solution.
- Django 5.2 - Python web framework
- Django REST Framework 3.15.2 - RESTful API development
- djangorestframework-simplejwt 5.3.1 - JWT authentication
- PostgreSQL - Database (SQLite for development)
- Google Calendar API - Calendar integration
- Google Gemini API - AI chatbot functionality
- Cryptography - Secure token encryption
- Next.js 15.2.4 - React framework
- React 18.2.0 - UI library
- TypeScript - Type safety
- Tailwind CSS - Styling
- shadcn/ui - Component library
- Recharts - Data visualization
- Next Themes - Dark mode support
Before you begin, ensure you have the following installed:
- Python 3.8+ - Download Python
- Node.js 18+ and npm - Download Node.js
- PostgreSQL 12+ (optional, SQLite used by default) - Download PostgreSQL
- Git - Download Git
git clone <repository-url>
cd smart-desktop-buddiescd backendWindows (PowerShell):
python -m venv venv
.\venv\Scripts\Activate.ps1Windows (Command Prompt):
python -m venv venv
venv\Scripts\activate.batmacOS/Linux:
python3 -m venv venv
source venv/bin/activatepip install -r requirements.txtcd coreCreate a .env file in the backend/core/ directory:
# Windows
copy .env.example .env
# macOS/Linux
cp .env.example .envEdit .env and add your configuration:
# Django Settings
# Generate using: python -c "from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())"
SECRET_KEY=your-generated-secret-key-here
DEBUG=True
# Google Calendar API (Optional - for calendar features)
# Get from: https://console.cloud.google.com/apis/credentials
GOOGLE_CLIENT_ID=your-google-client-id.apps.googleusercontent.com
GOOGLE_CLIENT_SECRET=your-google-client-secret
GOOGLE_REDIRECT_URI=http://localhost:8000/api/calendar/google/callback/
# Encryption Key (Optional - for calendar OAuth tokens)
# Generate using: python -c "from cryptography.fernet import Fernet; print(Fernet.generate_key().decode())"
ENCRYPTION_KEY=your-generated-encryption-key-here
# Gemini API (Optional - for AI chatbot)
# Get from: https://makersuite.google.com/app/apikey
GEMINI_API_KEY=your-gemini-api-key-here
# Email Configuration (Required for email verification and password reset)
EMAIL_HOST=smtp.gmail.com
EMAIL_PORT=587
EMAIL_USE_TLS=True
EMAIL_HOST_USER=your-email@gmail.com
EMAIL_HOST_PASSWORD=your-app-password
DEFAULT_FROM_EMAIL=your-email@gmail.com
FRONTEND_URL=http://localhost:3000Generating Keys:
# Django Secret Key
python -c "from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())"
# Encryption Key
python -c "from cryptography.fernet import Fernet; print(Fernet.generate_key().decode())"Gmail App Password Setup:
- Enable 2-factor authentication on your Gmail account
- Go to Google App Passwords
- Create an app password for "Mail"
- Use the generated 16-character password as
EMAIL_HOST_PASSWORD
python manage.py migratepython manage.py createsuperuserFollow the prompts to create an admin account.
python manage.py runserverThe backend API will be available at: http://localhost:8000
- API Base URL:
http://localhost:8000/api - Admin Panel:
http://localhost:8000/admin
Keep the backend server running in the first terminal.
cd frontendnpm installor if you prefer pnpm:
pnpm installnpm run devor with pnpm:
pnpm devThe frontend will be available at: http://localhost:3000
-
Backend Check
- Visit
http://localhost:8000/admin- Should show Django admin login - Visit
http://localhost:8000/api/auth/register/- Should show API endpoint
- Visit
-
Frontend Check
- Visit
http://localhost:3000- Should show the login/registration page
- Visit
-
Test Registration
- Create a new account
- Check your email for verification link
- Verify email and log in
Terminal 1 - Backend:
cd backend
.\venv\Scripts\Activate.ps1 # Windows PowerShell
cd core
python manage.py runserverTerminal 2 - Frontend:
cd frontend
npm run dev- Dashboard: Overview of tasks, mood, calendar events, and productivity metrics
- Mood Tracker: Log daily moods and view analytics
- Tasks: Create, edit, and manage tasks with due dates and priorities
- Focus Timer: Use Pomodoro technique (25-minute focus sessions)
- Calendar: Connect Google Calendar to view and sync events
- Chatbot: Interact with AI companion for support and motivation
- Analytics: View productivity and mood trends over time
- Settings: Manage profile, preferences, and calendar connections
- Go to Google Cloud Console
- Create a new project or select existing
- Enable Google Calendar API
- Create OAuth 2.0 credentials (Web application)
- Add authorized redirect URI:
http://localhost:8000/api/calendar/google/callback/ - Copy Client ID and Secret to
.envfile - Generate encryption key and add to
.env
- Go to Google AI Studio
- Create an API key
- Add to
.envasGEMINI_API_KEY
Database Connection Error
- Ensure PostgreSQL is running (if using PostgreSQL)
- Check database credentials in
.envfile - SQLite is used by default - no setup required
Migration Errors
python manage.py migrate --run-syncdbEnvironment Variables Not Loading
- Ensure
.envfile exists inbackend/core/directory - Check variable names match exactly (no spaces around
=) - Restart Django server after editing
.env - Verify
python-dotenvis installed:pip install python-dotenv
Port Already in Use
python manage.py runserver 8001
# Update frontend/lib/api.ts: const API_URL = 'http://localhost:8001/api';Module Not Found
rm -rf node_modules package-lock.json
npm installAPI Connection Failed
- Ensure backend server is running on port 8000
- Check CORS settings in
backend/core/core/settings.py - Verify API URL in
frontend/lib/api.ts
Email Not Sending
- Verify email configuration in
.envfile - Check Gmail app password is correct
- Ensure 2-factor authentication is enabled on Gmail account
- Never commit
.envfile - It contains sensitive credentials - Use
.env.exampleas a template for required variables - Generate new keys for production deployment
- Set
DEBUG=Falsein production - Use strong passwords for database and admin accounts
POST /api/auth/register/- User registrationPOST /api/auth/login/- User loginPOST /api/auth/token/refresh/- Refresh JWT tokenGET /api/auth/profile/- Get user profilePATCH /api/auth/profile/- Update user profilePOST /api/auth/change-password/- Change passwordGET /api/auth/verify-email/- Verify email addressPOST /api/auth/forgot-password/- Request password resetPOST /api/auth/reset-password/- Reset password
/api/mood-log/- Mood tracking/api/tasks/- Task management/api/screen-activity/- Activity tracking/api/motivation/- Goals and motivation/api/calendar/- Calendar integration/api/chatbot/- AI chatbot
This is a final year project (FYP) for academic purposes.
This is a personal project, but suggestions and feedback are welcome!