A modern productivity application with separated frontend and backend architecture. Track your habits, boost your productivity, and compete with friends through gamification features.
This project consists of two separate applications:
- Frontend: Next.js 15 application with React, TypeScript, and Tailwind CSS
- Backend: Node.js API server with Express.js for authentication, habit management, and gamification
- Data Storage: JSON files in backend with API integration (transitioning to database)
- Authentication: JWT-based user authentication with bcrypt password hashing
- ๐ฑ Responsive Design - Seamless experience across desktop, tablet, and mobile devices
- ๐ฏ Habit Management UI - View habits from backend API
- โ๏ธ Habit CRUD UI - Add, edit, and delete habit interfaces with backend integration
- ๐ Dashboard Overview - Basic dashboard layout with placeholder widgets
- ๐ Real-time Navigation - Dynamic navigation with active route highlighting
- ๐จ Modern UI/UX - Clean interface built with Headless UI components
- โก Modal Interactions - Delete confirmation and edit modals
- ๐ User Authentication - Registration, login with JWT tokens and password hashing
- ๐ง Email Service Backend - Express server for email functionality
- ๐ท๏ธ Habit Completion Tracking - In-memory tracking that resets on page refresh
- ๐ฎ Gamification Foundation - User scoring system for habit completion tracking
- ๐ Competitive Leaderboards - Compare productivity scores with friends and global users
- ๐ฅ Streak Tracking - Long-term habit completion streaks with visual indicators
- ๐ Productivity Scoring - Points-based system for habit completion and consistency
- ๐ฅ Friend System - Add friends and compete in productivity challenges
- ๐๏ธ Achievement Badges - Unlock badges for milestones and consistent habits
- ๐ Analytics Dashboard - Habit statistics, progress charts, and productivity insights
- ๐ฏ Challenges & Goals - Create and join productivity challenges with friends
- ๐ฑ Push Notifications - Habit reminders and friend activity updates
- ๐พ Database Integration - Replace JSON files with PostgreSQL/MongoDB
- ๐ค Data Export/Import - Backup and restore functionality
- ๐ฑ Mobile App - React Native companion with full gamification
- Daily Completion: +10 points per habit completed
- Streak Bonuses: +5 extra points for each day in streak (max +50/day)
- Perfect Days: +25 bonus points for completing all habits
- Weekly Challenges: +100 points for weekly goal completion
- Monthly Milestones: +500 points for consistency achievements
- Friend Leaderboards: See how you rank against your friends
- Global Rankings: Compete with users worldwide
- Achievement Sharing: Share badges and milestones on social media
- Group Challenges: Team up with friends for group productivity goals
- Progress Comparison: Visual charts comparing your progress with friends
- Daily Streaks: Visual streak counters with fire emojis ๐ฅ
- Level System: Progress through productivity levels (Beginner โ Expert โ Master)
- Seasonal Events: Special challenges during holidays and events
- Productivity Insights: Weekly reports showing improvement areas
- Next.js 15 - React framework with App Router
- React 19 - Latest React with concurrent features
- TypeScript - Type-safe JavaScript
- Tailwind CSS 4 - Utility-first CSS framework
- Headless UI - Unstyled, accessible UI components
- Heroicons - Beautiful hand-crafted SVG icons
- Framer Motion - Production-ready motion library
- Node.js - JavaScript runtime
- Express.js 5 - Web application framework
- JWT - JSON Web Tokens for authentication
- bcrypt - Password hashing and security
- CORS - Cross-origin resource sharing
- dotenv - Environment variable management
- Nodemon - Development auto-restart
- ESLint - Code linting and formatting
- PostCSS - CSS processing and optimization
- Backend JSON Storage - User and habit data stored in
backend/data/
- Frontend API Integration - Frontend communicates with backend API
- JWT Authentication - Secure user sessions with token-based auth
- Password Security - bcrypt hashing for user passwords
- Future Database - Planned migration to PostgreSQL/MongoDB
productivity-app/
โโโ frontend/ # Next.js Frontend Application
โ โโโ app/ # Next.js App Router
โ โ โโโ (auth)/ # Authenticated routes
โ โ โ โโโ dashboard/ # Dashboard pages
โ โ โ โโโ habits/ # Habit management
โ โ โ โ โโโ add/ # Add habit page
โ โ โ โ โโโ edit/ # Edit habit pages
โ โ โ โโโ calendar/ # Calendar page
โ โ โ โโโ leaderboard/ # Friend rankings (planned)
โ โ โ โโโ layout.tsx # Dashboard layout
โ โ โ โโโ page.tsx # Dashboard home
โ โ โโโ login/ # Login page
โ โ โโโ signup/ # Signup page
โ โ โโโ layout.tsx # Root layout
โ โ โโโ page.tsx # Landing page
โ โ โโโ globals.css # Global styles
โ โโโ components/ # Shared React components
โ โ โโโ Habits/ # Habit-related components
โ โ โ โโโ Habit.tsx # Individual habit card
โ โ โ โโโ HabitsPage.tsx # Habits page container
โ โ โโโ Gamification/ # Gamification components (planned)
โ โ โ โโโ Leaderboard.tsx # Friend rankings
โ โ โ โโโ ScoreDisplay.tsx # User score widget
โ โ โ โโโ StreakCounter.tsx# Streak visualization
โ โ โโโ Navbar.tsx # Navigation component
โ โ โโโ Home/ # Landing page components
โ โโโ types/ # TypeScript definitions
โ โ โโโ habit.ts # Habit type definitions
โ โ โโโ user.ts # User and auth types
โ โ โโโ types.ts # General type definitions
โ โโโ utils/ # Utility functions
โ โ โโโ habits.json # Static habit data (legacy)
โ โ โโโ habitFunctions.ts # Habit manipulation functions
โ โ โโโ users.json # Static user data (legacy)
โ โ โโโ userFunctions.ts # User utility functions
โ โ โโโ auth.ts # Authentication helpers
โ โโโ public/ # Static assets
โ โโโ package.json # Frontend dependencies
โโโ backend/ # Node.js Backend API
โ โโโ controllers/ # Business logic controllers
โ โ โโโ authController.ts # User registration and login
โ โ โโโ userController.ts # User profile management
โ โ โโโ emailController.ts # Email handling logic
โ โ โโโ habitController.ts # Habit CRUD operations
โ โโโ routes/ # API route definitions
โ โ โโโ auth.ts # Authentication endpoints
โ โ โโโ users.ts # User management endpoints
โ โ โโโ email.ts # Email endpoints
โ โ โโโ habits.ts # Habit endpoints
โ โโโ models/ # Data models and types
โ โ โโโ User.ts # User interface definitions
โ โ โโโ Habit.ts # Habit interface definitions
โ โโโ data/ # JSON data storage
โ โ โโโ users.json # User data with scores and streaks
โ โ โโโ habits.json # Habit data persistence
โ โโโ index.ts # Main Express server
โ โโโ package.json # Backend dependencies
โโโ issue.md # Development task tracking
โโโ .gitignore # Git ignore rules
โโโ README.md # This documentation
- Node.js 18+ installed on your machine
- npm or yarn package manager
- Clone the repository
git clone https://github.com/Leorev01/ProductivityApp2.0
cd productivity-app
- Install dependencies for both frontend and backend
Frontend:
cd frontend
npm install
Backend:
cd ../backend
npm install
- Set up environment variables
Backend (.env file):
# Create backend/.env
PORT=4000
JWT_SECRET=your-super-secret-jwt-key-here
NODE_ENV=development
- Run the applications
Start the backend server (Terminal 1):
cd backend
node index.ts
# Backend will run on http://localhost:4000
Start the frontend development server (Terminal 2):
cd frontend
npm run dev
# Frontend will run on http://localhost:3000
- Open your browser
- Frontend App: http://localhost:3000
- Backend API: http://localhost:4000
npm run dev # Development server (port 3000)
npm run build # Production build
npm run start # Production server
npm run lint # Code linting
node index.ts # Start server (port 4000)
# Note: No dev script configured yet
Method | Endpoint | Description | Status |
---|---|---|---|
POST |
/api/auth/register |
Register new user | โ Implemented |
POST |
/api/auth/login |
User login with JWT | โ Implemented |
Method | Endpoint | Description | Status |
---|---|---|---|
GET |
/api/users/profile |
Get user profile | โ Implemented |
PUT |
/api/users/profile |
Update user profile | ๐ง In Progress |
GET |
/api/users/leaderboard |
Get friend rankings | ๐ง Planned |
Method | Endpoint | Description | Status |
---|---|---|---|
GET |
/api/habits |
Get all habits | โ Implemented |
POST |
/api/habits |
Create new habit | ๐ง In Progress |
PUT |
/api/habits/:id |
Update existing habit | ๐ง In Progress |
DELETE |
/api/habits/:id |
Delete habit | ๐ง In Progress |
Method | Endpoint | Description | Status |
---|---|---|---|
POST |
/api/email/send-email |
Send email with habit data | โ Implemented |
Register user:
curl -X POST http://localhost:4000/api/auth/register \
-H "Content-Type: application/json" \
-d '{
"email": "[email protected]",
"password": "securepassword123"
}'
Login user:
curl -X POST http://localhost:4000/api/auth/login \
-H "Content-Type: application/json" \
-d '{
"email": "[email protected]",
"password": "securepassword123"
}'
Get habits (authenticated):
curl -X GET http://localhost:4000/api/habits \
-H "Authorization: Bearer your-jwt-token-here"
Response Examples:
// Registration/Login Success
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"user": {
"id": 1,
"email": "[email protected]"
}
}
// Habits Response
{
"habits": [
{
"id": 1,
"userId": 1,
"title": "Morning Exercise",
"description": "30 minutes of cardio",
"createdAt": "2025-01-01"
}
]
}
- Complete Separation: Frontend and backend are independent applications
- JWT Authentication: Secure token-based authentication system
- API Communication: Frontend calls backend REST API endpoints
- Real-time Updates: Planned WebSocket integration for live leaderboards
- Password Hashing: bcrypt with salt rounds for secure password storage
- JWT Tokens: Secure session management with expiration
- Input Validation: Server-side validation for all user inputs
- CORS Protection: Configured for secure cross-origin requests
- User Scoring System: Points tracked per user with daily/weekly calculations
- Streak Tracking: Consecutive day counters for habit completion
- Social Features: Friend relationships and competitive leaderboards
- Achievement System: Badge unlocking based on user milestones
Frontend (React) โ Backend API (Express) โ JSON Storage โ Future Database
โ
JWT Authentication
โ
Gamification Engine
interface UserScore {
userId: number;
totalPoints: number;
dailyPoints: number;
weeklyPoints: number;
currentStreak: number;
longestStreak: number;
level: number;
badges: Badge[];
}
- ๐ฅ Streak Master: 30-day habit streak
- โญ Perfect Week: Complete all habits for 7 days
- ๐ Quick Starter: Complete habits for first 7 days
- ๐ช Consistency Champion: 90% habit completion over 30 days
- ๐ Leaderboard Leader: Top 10 in weekly rankings
- Daily Challenges: Complete specific habit combinations
- Weekly Competitions: Compete with friends on weekly scores
- Seasonal Events: Special challenges during holidays
- Team Challenges: Group competitions with shared goals
Frontend:
NEXT_PUBLIC_API_URL=https://your-backend-url.com/api
Backend:
PORT=4000
NODE_ENV=production
JWT_SECRET=your-production-jwt-secret
DATABASE_URL=your-database-connection-string
- Frontend: Vercel (recommended for Next.js)
- Backend: Railway, Heroku, or DigitalOcean
- Database: PostgreSQL (recommended for production)
- File Storage: AWS S3 for user-uploaded content
- PostgreSQL Integration - Replace JSON files with proper database
- Real-time WebSockets - Live leaderboard updates and friend activity
- Advanced Analytics - Detailed productivity insights and trends
- Mobile Push Notifications - Habit reminders and social updates
- Guild System - Create and join productivity communities
- Seasonal Championships - Monthly and yearly competitions
- Custom Challenges - User-created challenge templates
- Reward Store - Spend points on virtual rewards and real-world prizes
- Social Feed - Activity streams showing friend achievements
- Mentorship Program - Connect experienced users with beginners
- AI Habit Recommendations - Machine learning for personalized suggestions
- Integration APIs - Connect with fitness trackers and other apps
- Habit Templates - Pre-built habit sets for common goals
- Progress Photos - Visual progress tracking with image uploads
- Calendar Integration - Sync with Google Calendar and other services
- Data Analytics - Advanced reporting and trend analysis
- Start backend server with
cd backend && node index.ts
(port 4000) - Start frontend server with
cd frontend && npm run dev
(port 3000) - Frontend automatically reloads on file changes
- Backend requires manual restart on changes (TypeScript compilation)
- Authentication fully functional with registration and login
โ Completed:
- User registration and login with JWT
- Password hashing with bcrypt
- Basic habit management UI
- Backend API structure
- Frontend-backend communication
๐ง In Progress:
- Complete habit CRUD operations
- User profile management
- Frontend authentication integration
๐ Planned:
- Friend system and social features
- Leaderboards and scoring system
- Achievement badges
- Database migration
- Gamification System - Implement scoring, streaks, and achievements
- Friend System - Social features and friend management
- Database Migration - Move from JSON to PostgreSQL/MongoDB
- Mobile App - React Native companion app
- Real-time Features - WebSocket integration for live updates
- Follow TypeScript best practices
- Implement proper error handling
- Add comprehensive testing
- Maintain security best practices
- Update documentation for new features
- Consider scalability in architecture decisions
- Backend Development - API endpoints and business logic
- Frontend Development - React components and UI/UX
- Gamification Design - Scoring systems and achievement mechanics
- Mobile Development - React Native app development
- DevOps - Deployment and infrastructure setup
This project is open source and available under the MIT License.
If you have any questions or run into issues:
- Open an issue on GitHub
- Join our Discord community (coming soon)
- Check out the documentation wiki
Current Status: Active development with authentication system implemented. Gamification features and social competitive elements are the next major milestone. The app is transitioning from JSON storage to a full database solution.
Built with โค๏ธ for the productivity community. Let's make habit building fun and social! ๐