An open API service indexing awesome lists of open source software.

https://github.com/swastikiiit/task-tracker

A modern task management and time tracking application built with Next.js, featuring AI-powered text suggestions, real-time timers, and comprehensive task organization. Create, edit, and track tasks with intelligent duration monitoring and daily productivity summaries.
https://github.com/swastikiiit/task-tracker

authentication backend cookie hooks jwt nextjs react restapi tailwindcss zustand

Last synced: 8 months ago
JSON representation

A modern task management and time tracking application built with Next.js, featuring AI-powered text suggestions, real-time timers, and comprehensive task organization. Create, edit, and track tasks with intelligent duration monitoring and daily productivity summaries.

Awesome Lists containing this project

README

          

# Task Tracker Pro ๐Ÿ“‹โฑ๏ธ

A modern, full-stack task management and time tracking application built with Next.js, featuring real-time timer functionality, AI-powered task suggestions, user authentication, and comprehensive task management.

## โœ… Live Demo

๐Ÿ”— **[Live Application](https://task-tracker-three-self.vercel.app)**

*Create your own account to get started - no demo credentials needed!*

## ๐Ÿš€ Features

- **User Authentication** - JWT-based secure login/signup
- **Task Management** - Create, edit, delete, and organize tasks
- **Time Tracking** - Start/stop timers for tasks with duration tracking
- **AI Task Suggestions** - Get intelligent task recommendations powered by Google Gemini
- **Status Management** - Track task progress (Pending, In Progress, Completed)
- **Daily Summary** - View time tracked and task completion statistics
- **Responsive Design** - Works seamlessly on desktop and mobile
- **Real-time Updates** - Instant UI updates with Zustand state management

## ๐Ÿ› ๏ธ Tech Stack

### Frontend
- **Next.js 15** - React framework with App Router
- **React 19** - UI library
- **Zustand** - Lightweight state management
- **Tailwind CSS** - Utility-first CSS framework
- **JavaScript** - Main programming language

### Backend
- **Next.js API Routes** - Serverless backend functions
- **MongoDB** - NoSQL database with Mongoose ODM
- **JWT** - JSON Web Tokens for authentication
- **bcryptjs** - Password hashing
- **Google Gemini AI** - AI-powered task suggestions

### Deployment
- **Vercel** - Frontend and API deployment
- **MongoDB Atlas** - Cloud database

## ๐Ÿ“ฆ Installation & Setup

### Prerequisites
- Node.js 18+
- npm or yarn
- Git
- MongoDB Atlas account (or local MongoDB)
- Google AI Studio API key

### Local Development Setup

1. **Clone the repository**
```bash
git clone https://github.com/SwastikIIIT/Task-Tracker.git
cd Task-Tracker
```

2. **Install dependencies**
```bash
npm install
```

3. **Environment Setup**
Create a `.env.local` file in the root directory:
```env
# MongoDB Connection
MONGO_URI="mongodb+srv://username:password@cluster.mongodb.net/tasktracker"

# JWT Secret (generate a strong random string)
JWT_SECRET="your-super-secret-jwt-key-here-make-it-long-and-complex"

# Google Gemini AI API Key
GEMINI_API_KEY="your-google-ai-studio-api-key"
```

4. **Database Setup**
- Create a MongoDB Atlas cluster or set up local MongoDB
- Update the `MONGO_URI` with your connection string
- The application will automatically create collections on first run

5. **Start Development Server**
```bash
npm run dev
```

6. **Open Application**
Navigate to `http://localhost:3000`

## ๐Ÿ“ Project Structure

```
Task-Tracker/
โ”œโ”€โ”€ app/ # Next.js App Router
โ”‚ โ”œโ”€โ”€ api/ # API routes
โ”‚ โ”‚ โ”œโ”€โ”€ auth/ # Authentication endpoints
โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ login/route.js
โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ signup/route.js
โ”‚ โ”‚ โ”œโ”€โ”€ tasks/ # Task CRUD operations
โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ route.js
โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ [id]/route.js
โ”‚ โ”‚ โ”œโ”€โ”€ time-logs/ # Time tracking endpoints
โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ route.js
โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ [id]/route.js
โ”‚ โ”‚ โ”œโ”€โ”€ summary/route.js # Dashboard data
โ”‚ โ”‚ โ””โ”€โ”€ ai-suggest/route.js # AI task suggestions
โ”‚ โ”œโ”€โ”€ components/ # React components (JSX)
โ”‚ โ”‚ โ”œโ”€โ”€ AuthForm.jsx # Login/signup forms
โ”‚ โ”‚ โ”œโ”€โ”€ Navbar.jsx # Navigation header
โ”‚ โ”‚ โ”œโ”€โ”€ TaskForm.jsx # Task creation form
โ”‚ โ”‚ โ”œโ”€โ”€ TaskList.jsx # Task listing
โ”‚ โ”‚ โ”œโ”€โ”€ TaskItem.jsx # Individual task component
โ”‚ โ”‚ โ”œโ”€โ”€ ActiveTimer.jsx # Active timer display
โ”‚ โ”‚ โ””โ”€โ”€ DailySummary.jsx # Dashboard summary
โ”‚ โ”œโ”€โ”€ stores/ # Zustand state stores
โ”‚ โ”‚ โ”œโ”€โ”€ authStore.js # Authentication state
โ”‚ โ”‚ โ””โ”€โ”€ taskStore.js # Task management state
โ”‚ โ”œโ”€โ”€ lib/ # Utility functions
โ”‚ โ”‚ โ”œโ”€โ”€ actions.js # API calling functions
โ”‚ โ”‚ โ”œโ”€โ”€ utils.js # Helper utilities
โ”‚ โ”‚ โ”œโ”€โ”€ middleware.js # JWT middleware
โ”‚ โ”‚ โ”œโ”€โ”€ auth.js # Authentication helpers
โ”‚ โ”‚ โ””โ”€โ”€ connect.js # MongoDB connection
โ”‚ โ”œโ”€โ”€ models/ # MongoDB/Mongoose models
โ”‚ โ”‚ โ”œโ”€โ”€ User.js # User schema
โ”‚ โ”‚ โ”œโ”€โ”€ Task.js # Task schema
โ”‚ โ”‚ โ””โ”€โ”€ Time-Log.js # Time log schema
โ”‚ โ””โ”€โ”€ page.jsx # Main application page
โ”œโ”€โ”€ public/ # Static assets
โ”œโ”€โ”€ package.json # Dependencies and scripts
โ””โ”€โ”€ README.md # Project documentation
```

## ๐Ÿ” Authentication

The application uses JWT-based authentication with the following features:
- โœ… **Secure Registration** - Email validation and password hashing with bcryptjs
- โœ… **Login/Logout** - Persistent sessions with token storage
- โœ… **Protected Routes** - API endpoints secured with JWT middleware
- โœ… **Auto-login** - Remember user sessions across browser refreshes

## ๐Ÿค– AI Features

- **Smart Task Suggestions** - Get AI-powered task recommendations using Google Gemini
- **Context-aware Suggestions** - AI considers your existing tasks and work patterns
- **Productivity Enhancement** - Intelligent suggestions to improve task organization

## ๐Ÿ“ฑ API Endpoints

### Authentication
- `POST /api/auth/signup` - User registration
- `POST /api/auth/login` - User login

### Tasks
- `GET /api/tasks` - Get user tasks
- `POST /api/tasks` - Create new task
- `PUT /api/tasks/[id]` - Update task
- `DELETE /api/tasks/[id]` - Delete task

### Time Tracking
- `GET /api/time-logs` - Get time logs
- `POST /api/time-logs` - Start timer
- `PUT /api/time-logs/[id]/stop` - Stop timer

### Dashboard & AI
- `GET /api/summary` - Get daily summary statistics
- `POST /api/ai-suggest` - Get AI task suggestions

## ๐ŸŽจ Screenshots

### LoginForm
![Dashboard](https://github.com/user-attachments/assets/d5b14a84-a5fb-4813-9a1c-e232f34d9be6
)

### DashBoard
![Task Management](https://github.com/user-attachments/assets/cedd1e06-9889-41f9-8854-da37fec60269
)

## ๐Ÿš€ Deployment

### Deploy to Vercel

1. **Connect Repository**
- Push code to GitHub
- Connect repository to Vercel

2. **Environment Variables**
Add these in Vercel dashboard:
```
MONGO_URI=your_mongodb_atlas_connection_string
JWT_SECRET=your_production_jwt_secret
GEMINI_API_KEY=your_google_ai_studio_api_key
```

3. **Deploy**
```bash
npm run build
vercel --prod
```

### Database Setup (Production)
- Set up MongoDB Atlas cluster
- Whitelist Vercel's IP addresses in Atlas
- Update `MONGO_URI` with production connection string

## ๐Ÿงช Testing

```bash
# Run development server
npm run dev

# Build for production
npm run build

# Start production server
npm start
```

## ๐Ÿ“ˆ Performance Features

- **Server-side Rendering** - Fast initial page loads
- **API Route Optimization** - Efficient MongoDB queries with Mongoose
- **Client-side State Management** - Efficient state updates with Zustand
- **Code Splitting** - Smaller bundle sizes with Next.js
- **Database Indexing** - Optimized MongoDB queries

## ๐Ÿ‘จโ€๐Ÿ’ป Author

**Swastik Sharma**
- GitHub: [@SwastikIIIT](https://github.com/SwastikIIIT)
- Email: swastikiiit.05@gmail.com

---

โญ **Star this repository if you found it helpful!**