{"id":28624503,"url":"https://github.com/josipcunko/taskflow","last_synced_at":"2026-04-29T23:31:29.188Z","repository":{"id":295008553,"uuid":"987182358","full_name":"JosipCunko/taskflow","owner":"JosipCunko","description":null,"archived":false,"fork":false,"pushed_at":"2026-03-30T14:26:41.000Z","size":17110,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-03-30T16:29:34.812Z","etag":null,"topics":["firebase","framer-motion","next-auth","nextjs14","tailwindcss","typescript"],"latest_commit_sha":null,"homepage":"https://optaskflow.vercel.app","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JosipCunko.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-05-20T17:39:51.000Z","updated_at":"2026-03-30T14:27:04.000Z","dependencies_parsed_at":"2025-09-24T17:30:14.893Z","dependency_job_id":null,"html_url":"https://github.com/JosipCunko/taskflow","commit_stats":null,"previous_names":["josipcunko/taskflow"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/JosipCunko/taskflow","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JosipCunko%2Ftaskflow","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JosipCunko%2Ftaskflow/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JosipCunko%2Ftaskflow/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JosipCunko%2Ftaskflow/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JosipCunko","download_url":"https://codeload.github.com/JosipCunko/taskflow/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JosipCunko%2Ftaskflow/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32448351,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T22:27:22.272Z","status":"ssl_error","status_checked_at":"2026-04-29T22:10:49.234Z","response_time":110,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["firebase","framer-motion","next-auth","nextjs14","tailwindcss","typescript"],"created_at":"2025-06-12T07:37:50.605Z","updated_at":"2026-04-29T23:31:29.181Z","avatar_url":"https://github.com/JosipCunko.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TaskFlow - All-in-One Productivity \u0026 Life Management System\n\nTaskFlow is a comprehensive, modern productivity platform that goes beyond simple task management. It's your personal command center for life optimization, combining intelligent task organization, fitness tracking, nutrition monitoring, AI assistance, and gamified progress tracking—all wrapped in a beautiful, offline-capable Progressive Web App.\n\nWhether you're planning your day, tracking your workouts, monitoring your nutrition, or getting AI-powered productivity insights, TaskFlow brings everything together in one seamless, distraction-free experience. Built with cutting-edge technologies and designed for both desktop and mobile, it adapts to your workflow and keeps you productive even without an internet connection.\n\n## ✨ What Makes TaskFlow Special\n\n- **🌐 Offline-First**: Full offline functionality with PWA support—work anywhere, anytime, even without internet\n- **🤖 AI-Powered**: Integrated AI assistant with multi-model support (GPT, Claude, Gemini) for intelligent productivity insights\n- **🏋️ Holistic Approach**: Not just tasks—track workouts, nutrition, and habits all in one beautiful interface\n- **📊 Gamification**: Earn points, maintain streaks, unlock achievements, and rate your task experiences\n- **⚡ Lightning Fast**: Optimistic UI updates, instant feedback, and smooth animations for delightful UX\n- **🎨 Beautiful Design**: Modern dark theme with polished animations and attention to detail\n- **📱 True PWA**: Install on any device, get push notifications, and enjoy native app experience\n- **🔐 Privacy First**: Your data is yours—secure Firebase backend with granular security rules\n\n## 🚀 Core Capabilities at a Glance\n\n| Feature              | Description                                                                |\n| -------------------- | -------------------------------------------------------------------------- |\n| **Smart Tasks**      | Advanced scheduling, repeating tasks, priorities, tags, and risk detection |\n| **Today View**       | Visual 24-hour timeline with time-blocking and drag-and-drop scheduling    |\n| **Fitness Tracking** | Workout logging, templates, exercise library, and progress visualization   |\n| **Nutrition**        | macro tracking, meal logging, and daily goals                              |\n| **AI Assistant**     | Multi-model AI with function calling and contextual help                   |\n| **Analytics**        | Streaks, achievements, completion rates, and performance insights          |\n| **Notifications**    | Smart notification system with priority levels and inbox management        |\n\n## 💰 Subscription Plans\n\nTaskFlow offers flexible pricing tiers designed to scale with your productivity needs:\n\n### Base Plan ($0/month)\n\n- Unlimited tasks \u0026 notes\n- Calendar \u0026 scheduling\n- 1 AI prompt per day\n- Health \u0026 fitness tracking\n- Mobile PWA support\n\n### Pro Plan ($4.99/month)\n\n- Everything in Base\n- 10 AI prompts per day\n- Analytics dashboard\n- Advanced insights\n- 7-day free trial available\n\n### Ultra Plan ($14.99/month)\n\n- Everything in Pro\n- Unlimited AI prompts\n- Early access to new features\n\n**🔄 Flexible Billing**: Cancel or change plans anytime. Secure payment processing through Stripe with customer portal access.\n\n## 🌟 Key Features\n\n### 1. Smart Task Management\n\n- **Comprehensive Task Creation**: Create tasks with titles, detailed descriptions, due dates, specific start times, and estimated durations.\n- **Visual Organization**: Assign custom icons and colors for quick visual identification and categorization.\n- **Prioritization**: Mark tasks as high-priority to keep focus on what matters most.\n- **Advanced Scheduling**:\n  - **Repeating Tasks**: Define complex repetition rules, including daily/weekly intervals, specific days of the week, or a target number of completions per week.\n  - **Manual Rescheduling**: Easily delay tasks, with tracking for how many times a task has been postponed.\n- **Status \u0026 Progress Tracking**:\n  - Monitor task status as `pending`, `completed`, or `delayed`.\n  - Set reminders for important deadlines.\n- **Gamification \u0026 Feedback Loop**:\n  - **Experience Points**: Earn points for completing tasks, contributing to your overall progress and unlocking achievements.\n  - **Task Experience Rating**: After completing a task, rate your experience (`bad`, `okay`, `good`, `best`) to reflect on your performance and mood.\n- **Contextual Details**: Add optional information like location to your tasks.\n- **Risk Identification**: The system automatically flags tasks that are at risk of being missed, helping you proactively manage your workload.\n\n### 2. Advanced Tagging \u0026 Customization\n\n- **Custom Tags**: Create personalized tags for tasks (e.g., morning routine, fitness, personal, health, work).\n- **Color Coding**: Custom color palette for visual task organization.\n- **Icon Selection**: Choose from a wide range of task icons for better visual organization.\n\n### 3. Advanced Notification System\n\n- **Smart Notifications**: Intelligent, contextual alerts based on task behavior and patterns.\n- **Multiple Notification Types**:\n  - **Task Alerts**: Overdue, due soon, and at-risk notifications for repeating tasks.\n  - **Gamification Alerts**: Streak milestones, achievements unlocked, and weekly performance summaries.\n  - **System Alerts**: Important announcements and updates.\n- **Priority Levels**: Notifications are categorized as `URGENT`, `HIGH`, `MEDIUM`, or `LOW`, with clear visual indicators.\n- **Real-time Inbox**: A central hub for all notifications, featuring:\n  - Unread counts broken down by priority and type.\n  - Filtering and search capabilities.\n  - Archiving and read/unread status management.\n- **Automatic Generation \u0026 Cleanup**: Notifications are automatically created by system triggers and expired ones are removed to keep the inbox relevant.\n\n### 4. Progress Tracking \u0026 Analytics\n\n- **Advanced Gamification Engine**:\n  - **Multi-Tier Achievement System**: Points milestones, streak milestones, and task completionist achievements with automatic unlocking.\n  - **Dynamic Streak Tracking**: Real-time streak monitoring with best streak records and consistency rewards.\n  - **Reward Points System**: Earn points for task completion with tiered milestone unlocks and progress visualization.\n- **Comprehensive Analytics Dashboard**:\n  - **Session Analytics**: Detailed tracking of app usage time, page views, and active engagement metrics.\n  - **Performance Insights**: Productivity scores, consistency ratings, and trend analysis with visual charts.\n  - **Task Analytics**: Event-based tracking of task creation, completion, delays, and behavioral patterns.\n  - **Time Management Intelligence**: On-time completion rates, delay analysis, and productive hour identification.\n- **Activity Audit Trail**: Immutable log of all user interactions with detailed task lifecycle tracking and historical data export.\n- **Progress Visualization**: Interactive charts showing productivity trends, point growth, achievement progress, and performance metrics over time.\n\n### 5. Health \u0026 Nutrition Tracker\n\n- **Advanced Nutrition Intelligence**: Comprehensive nutrition tracking with barcode scanning, NutriScore ratings, and NOVA food processing classifications.\n- **Barcode Scanning**: Scan product barcodes for instant nutritional information, ingredients, and health ratings.\n- **Smart Food Database**: Extensive food library with detailed nutritional profiles, including micro-nutrients and health classifications.\n- **NutriScore \u0026 NOVA Classification**: Automatic food quality assessment with color-coded health ratings (A-E) and processing level indicators (1-4).\n- **Dietary Filters**: Identify vegan, vegetarian, and allergen-specific foods with comprehensive labeling.\n- **Daily Nutrition Dashboard**:\n  - Visual progress bars showing calories, protein, carbs, and fat intake vs. personalized goals.\n  - Historical tracking with nutrition graphs and trends analysis.\n- **Advanced Meal Logging**:\n  - Log foods for breakfast, lunch, dinner, or snacks with flexible serving sizes.\n  - Saved meals system for quick re-logging of favorite foods.\n  - Automatic nutrient calculation with detailed micro-nutrient tracking.\n- **Personalized Goal Setting**: Set custom daily targets for calories and macronutrients with smart recommendations.\n\n### 6. Advanced Fitness Tracking Module\n\n- **Comprehensive Workout Logging**:\n\n  - **Workout Sessions**: Create and track detailed workout sessions with duration, exercises, sets, reps, and weights.\n  - **Exercise Library**: Access to extensive exercise database with categories and muscle group targeting.\n  - **Real-time Workout Timer**: Built-in workout duration tracking and rest timers between sets.\n  - **Session Notes**: Add personal notes and observations to each workout session.\n\n- **Workout Templates**:\n\n  - **Template Creation**: Save frequently used workout routines as reusable templates.\n  - **Quick Start**: Launch workouts instantly from saved templates with pre-loaded exercises.\n  - **Template Management**: Organize and categorize workout templates by type (Push, Pull, Legs, etc.).\n\n- **Progress Visualization \u0026 Analytics**:\n\n  - **Interactive Charts**: Visualize progress over time with line graphs showing weight, volume, and strength trends.\n  - **Exercise-Specific Analysis**: Detailed progress tracking for individual exercises with historical data and personal record tracking.\n\n- **Personal Records**: Automatic tracking of your best weights, reps, and performance metrics for each exercise.\n\n- **Progressive Overload Intelligence**:\n\n  - **Smart Suggestions**: AI-powered recommendations based on previous performance data.\n  - **Last Performance Hints**: See your previous workout stats for each exercise to guide progressive overload.\n  - **Strength Progression**: Automatic suggestions for weight and rep increases based on historical data.\n\n- **Dashboard \u0026 Analytics**:\n  - **Weekly Overview**: Calendar view showing workout frequency and consistency.\n  - **Workout Statistics**: Track weekly workout count, total sessions, and average duration.\n  - **Recent Activity**: Quick access to recent workouts and performance summaries.\n\n### 7. AI Assistant \u0026 Automation\n\n- **Advanced Multi-Model AI**: Integrated AI assistant with support for cutting-edge models including GPT-4.1, GPT-5, Claude Sonnet 4, and Claude 3.5 Haiku.\n- **Multiple AI Providers**: Seamless integration with CrayonAI, ThesysAI, and OpenRouter for diverse AI capabilities and optimal performance.\n- **Intelligent Function Calling**: AI can directly interact with your tasks, retrieve data, create new tasks, update existing ones, and perform complex operations on your behalf.\n- **Contextual Productivity Coaching**: AI understands your current app context, task history, and productivity patterns to provide personalized recommendations and insights.\n- **Persistent Chat History**: Full conversation history with model tracking and function call results for continuous productivity coaching.\n- **Usage Limits \u0026 Billing**: Daily AI prompt limits based on subscription tier (1/day Base, 10/day Pro, unlimited Ultra) with automatic reset and usage tracking.\n- **Advanced Chat Features**: Model switching mid-conversation, function result visualization, and streaming responses for enhanced user experience.\n\n### 8. Notes\n\n- **Personal Notes**: A dedicated space to create, view, edit, and delete personal notes.\n- **Simple \u0026 Effective**: Each note has a title and content, with automatic tracking of the last update time.\n\n### 10. Tutorial \u0026 Onboarding\n\n- **Interactive Tutorial**: First-time user tutorial with step-by-step guidance through key features.\n- **Contextual Tooltips**: Helpful hints and tips throughout the app for feature discovery.\n- **Skip \u0026 Resume**: Users can skip tutorials or resume them later from settings.\n\n### 11. User Profile \u0026 Settings\n\n- **Personalized Experience**: Customize notification preferences for reminders and achievements.\n- **Authentication Management**: Securely manage your account connected via Email/Password, Google, or GitHub.\n- **Activity Log**: Comprehensive audit trail of all task interactions and system events.\n- **Achievement Showcase**: Display unlocked achievements and progress toward new milestones.\n\n### 12. Progressive Web App (PWA) \u0026 Offline Support\n\n- **Install as Native App**: Add TaskFlow to your home screen on any device (iOS, Android, desktop) for app-like experience.\n- **Offline Functionality**: Full offline support with service workers—access your tasks even without internet.\n- **Offline Mode Detection**: Automatic detection of network status with dedicated offline page and graceful degradation.\n- **Background Sync**: Smart synchronization when connection is restored.\n- **App Shortcuts**: Quick access shortcuts in the PWA for common actions (Add Task, Today's Tasks, Fitness, Health).\n- **Push Notifications**: Receive native push notifications for task reminders and achievements (when installed as PWA).\n- **App Update Notifications**: Automatic detection and user-friendly prompts for PWA updates with seamless installation.\n- **Installable**: Beautiful install prompt with app icon and description for easy installation.\n\n### 13. Today's View \u0026 Daily Planning\n\n- **Visual Time Grid**: Interactive 24-hour timeline view showing your scheduled tasks with visual time blocks.\n- **Scheduled vs Whole-Day Tasks**: Separate views for time-specific tasks and general daily tasks.\n- **Quick Task Creation**: Add tasks directly to today's schedule with one click.\n- **Time Block Visualization**: See your day at a glance with color-coded time blocks for each task.\n- **Priority Indicators**: Visual priority badges on scheduled tasks.\n\n### 14. User Experience \u0026 Design\n\n- **Modern Dark UI**: A clean, dark-themed interface designed for focus and clarity with carefully crafted color palette.\n- **Fully Responsive**: Pixel-perfect experience across desktop, tablet, and mobile devices with adaptive layouts.\n- **Intuitive Navigation**: Animated sidebar with logical organization and quick access to all features.\n- **Smooth Animations**: Polished micro-interactions powered by Framer Motion for delightful user experience.\n- **Performant \u0026 Fast**:\n  - **Optimistic UI Updates**: Instant feedback on actions like task creation or completion.\n  - **Seamless Loading**: Utilizes React Suspense for smooth loading transitions without jarring layout shifts.\n  - **Fast Navigation**: Built on the Next.js App Router for near-instant page loads.\n  - **Efficient Caching**: Smart client-side caching for improved performance.\n- **Accessibility**: Built with accessibility in mind—keyboard navigation, ARIA labels, and screen reader support.\n- **Visual Feedback**: Toast notifications, loading states, and error handling for clear communication.\n- **Customizable Themes**: Personal color preferences for tasks and visual organization.\n\n## 🛠️ Technology Stack\n\n### Frontend\n\n- **Next.js 15+**: React framework with App Router for optimal performance and server-side rendering.\n- **React 19+**: Latest version for modern UI development with concurrent features.\n- **TypeScript**: Type-safe development with full type coverage.\n- **Tailwind CSS**: Utility-first CSS framework for responsive design with custom theme.\n- **Framer Motion**: Smooth animations, transitions, and micro-interactions.\n- **Lucide React**: Modern, customizable icon library with 1000+ icons.\n- **React Hot Toast**: Beautiful toast notifications with custom styling.\n- **React Tooltip**: Enhanced tooltip functionality for better UX.\n- **Recharts**: Interactive, responsive charts for fitness progress and analytics visualization.\n- **Service Workers**: Offline support, background sync, and push notifications.\n\n### Backend \u0026 Authentication\n\n- **Firebase**: Comprehensive Backend-as-a-Service platform\n  - **Firestore**: NoSQL real-time database for tasks, notes, health data, workouts, and AI chat history.\n  - **Firebase Authentication**: Secure user authentication with Email/Password and Google sign-in.\n  - **Firebase Cloud Messaging (FCM)**: Push notification delivery for web and mobile.\n  - **Firebase Admin SDK**: Server-side operations with elevated privileges.\n  - **Custom Tokens**: Bridge between NextAuth and Firebase for seamless authentication.\n- **NextAuth.js v5**: Modern authentication framework integrating multiple providers:\n  - **Credentials Provider**: Firebase custom tokens for Google Sign-In \u0026 Email/Password.\n  - **GitHub OAuth**: Third-party authentication integration.\n  - **Session Management**: Secure, encrypted JWT sessions.\n- **Server Actions**: Next.js server-side functions for secure data operations.\n\n### APIs \u0026 External Services\n\n- **Stripe**: Payment processing and subscription management with webhooks and customer portal integration.\n- **CrayonAI**: Advanced AI model orchestration and streaming capabilities.\n- **ThesysAI**: Additional AI model provider for enhanced conversational experiences.\n- **ZXing WASM**: Barcode scanning and QR code processing for nutrition tracking.\n\n### Development Tools \u0026 Infrastructure\n\n- **ESLint**: Code quality and style enforcement with custom rules.\n- **TypeScript**: Static type checking with strict mode.\n- **Git**: Version control with GitHub integration.\n- **Environment Variables**: Secure configuration management for API keys and secrets.\n- **Service Worker API**: Native browser API for offline functionality.\n\n## 📱 Application Structure\n\n### Main Routes\n\n- **`/`**: Landing page\n- **`/webapp`** (Dashboard): Overview of tasks, analytics, and performance metrics with visual charts.\n- **`/webapp/today`**: Today's view with interactive time grid and daily task planning.\n- **`/webapp/tasks`**: Comprehensive task management interface with filtering and bulk actions.\n- **`/webapp/calendar`**: Beautiful calendar view of tasks with month/week navigation.\n- **`/webapp/completed`**: Archive of completed tasks with experience ratings and statistics.\n- **`/webapp/notes`**: Personal notes management with create, edit, and delete functionality.\n- **`/webapp/health`**: Nutrition tracking with calorie counting, and macro goals.\n- **`/webapp/fitness`**: Workout logging, exercise library, templates, and progress visualization.\n- **`/webapp/ai`**: AI assistant chat interface with multi-model support and function calling.\n- **`/webapp/inbox`**: Notification center with filtering, priority indicators, and read/unread management.\n- **`/webapp/profile`**: User profile, achievements, and account settings.\n- **`/login`**: Authentication page with Email/Password, Google, and GitHub sign-in options.\n- **`/offline`**: Dedicated offline mode page shown when internet connection is lost.\n\n## 🔒 Security Features\n\n- **Secure Authentication**: Support for Google Sign-in, Email/Password, and GitHub OAuth, managed by NextAuth.js and Firebase.\n- **Custom Firebase Tokens**: Secure bridge between NextAuth sessions and Firebase authentication.\n- **Protected API Routes**: All API endpoints require authentication and validate user permissions.\n- **Server Actions Security**: Server-side operations protected by NextAuth session validation.\n- **Firestore Security Rules**: Granular security rules ensuring users can only access their own data.\n- **Row-Level Security**: Each document includes userId validation at the database level.\n- **Environment Variable Management**: Sensitive keys and configurations secured via environment variables.\n- **Secure Session Handling**: Encrypted JWT sessions managed by NextAuth.js with httpOnly cookies.\n- **Advanced Security Headers**: Comprehensive HTTP security headers including X-Frame-Options, X-Content-Type-Options, Referrer-Policy, Permissions-Policy, and Strict-Transport-Security.\n- **Performance Monitoring**: Real-time performance tracking with request timing headers, user agent logging, and analytics integration.\n- **Feature Flag Security**: Environment-based feature toggles for controlled rollout and beta testing capabilities.\n- **XSS Protection**: Input sanitization and output encoding to prevent cross-site scripting.\n- **CSRF Protection**: Built-in CSRF token validation for all state-changing operations.\n- **Rate Limiting**: Protection against API abuse and brute force attacks.\n- **Admin Operations**: Separate admin SDK operations with elevated privileges for system tasks.\n\n## 🚀 Getting Started\n\n1.  **Clone the repository**:\n    ```bash\n    git clone https://your-repository-url.git\n    cd taskflow\n    ```\n2.  **Install dependencies**:\n    ```bash\n    npm install\n    # or yarn install\n    ```\n3.  **Set up environment variables**:\n\n    - Copy `.env.example` to `.env.local`:\n      ```bash\n      cp .env.example .env.local\n      ```\n    - **Required Variables**:\n      - Firebase project configuration (API key, project ID, etc.)\n      - `NEXTAUTH_SECRET` and `NEXTAUTH_URL` for authentication\n      - Firebase Admin SDK credentials path\n      - Stripe configuration (`STRIPE_PUBLISHABLE_KEY`, `STRIPE_SECRET_KEY`, `STRIPE_WEBHOOK_SECRET`)\n    - **Optional Variables**:\n      - `GITHUB_ID` and `GITHUB_SECRET` for GitHub OAuth (callback URL: `http://localhost:3000/api/auth/callback/github`)\n      - `OPENAI_API_KEY` for OpenAI GPT models in AI assistant\n      - `CRAYON_API_KEY` for CrayonAI integration\n      - `THESYS_API_KEY` for ThesysAI integration\n\n4.  **Run the development server**:\n\n    ```bash\n    npm run dev\n    # or yarn dev\n    ```\n\n    Open [http://localhost:3000](http://localhost:3000) in your browser.\n\n## Some Typescript types\n\n#### Task Schema\n\n```typescript\ninterface Task {\n  id: string;\n  userId: string;\n  title: string;\n  description?: string;\n  icon: string;\n  color: string;\n  isPriority: boolean;\n  isReminder: boolean;\n  delayCount: number;\n  autoDelay?: boolean; // Automatically delay task to next day if missed\n  tags?: string[];\n  createdAt: number;\n  updatedAt: number;\n  experience?: \"bad\" | \"okay\" | \"good\" | \"best\";\n  location?: string;\n  dueDate: number;\n  startDate?: number;\n  startTime?: { hour: number; minute: number };\n  completedAt?: number;\n  /**Delayed is pending but rescheduled */\n  status: \"pending\" | \"completed\" | \"delayed\";\n  isRepeating?: boolean;\n  repetitionRule?: RepetitionRule;\n  duration?: {\n    hours: number;\n    minutes: number;\n  };\n  risk?: boolean;\n  points: number;\n}\n```\n\n```typescript\ninterface AppUser {\n  uid: string;\n  displayName: string;\n  email: string;\n  photoURL: string;\n  createdAt: number;\n  provider: string;\n  notifyReminders: boolean;\n  notifyAchievements: boolean;\n  rewardPoints: number;\n  achievements: Achievement[];\n  completedTasksCount: number;\n  currentStreak: number;\n  bestStreak: number;\n  lastLoginAt?: number;\n  nutritionGoals: UserNutritionGoals;\n  // Anonymous user fields\n  isAnonymous?: boolean;\n  anonymousCreatedAt?: number;\n}\n```\n\n## Firebase Authentication \u0026 Firestore Security Rules\n\n#### Understanding the Authentication Issue\n\nThe main reason my firebase rules are failing is almost certainly that `request.auth` is null when your client-side code tries to access Firestore.\n\nWhen you use NextAuth.js, it manages user authentication and creates its own session. However, this session is separate from Firebase Authentication. For `request.auth` to be populated in your Firestore security rules, the user must be explicitly signed into Firebase on the client using the Firebase SDK.\n\nThe fact that changing the tasks rule to `allow read, update, delete: if true;` works is a strong indicator that the client is not authenticated with Firebase.\n\n#### The Solution: Custom Firebase Tokens\n\nTo fix this, I linked the NextAuth session to a Firebase session. When a user is authenticated with NextAuth, Next.js backend generates a Firebase custom token.\n\nClient-side code fetches this custom token. The client then uses `signInWithCustomToken()` from the Firebase SDK to sign the user into Firebase.\n\nOnce the user is signed in with the custom token, `request.auth` will be correctly populated in your security rules, and they will start working as you expect.\n\nA component like `AuthProvider.tsx` is the perfect place to orchestrate this client-side logic.\n\n#### Server vs Client Authentication\n\nOn the server, you are authenticated with NextAuth, but you are not authenticated with Firebase.\nThese are two completely separate authentication systems.\n\nThink of it like this:\n\n- **NextAuth.js** is the Front Door Security Guard for your entire application building. They check your ID (from Google, GitHub, etc.) and give you a session cookie, which is like an ID badge that proves you're allowed inside the building.\n- **Firebase** is a Secure Vault inside the building. This vault has its own separate, high-tech lock. Your building ID badge won't open the vault. You need a specific key card (a Firebase Auth token) that is only valid for the vault.\n\n#### How `getServerSession(authOptions)` Works\n\nThe Front Door Security Guard (`getServerSession`) works because you carry your ID badge (the NextAuth session cookie) with you everywhere you go inside the building.\n\n- When a user logs in through a NextAuth provider, NextAuth creates a secure, encrypted, httpOnly cookie in the user's browser.\n- Every single request the browser makes to your Next.js server—whether it's to render a Server Component, call a Route Handler, or execute a Server Action—automatically includes this cookie.\n- `getServerSession(authOptions)` is a server-side function that knows how to find this cookie in the incoming request, decrypt it using your `NEXTAUTH_SECRET`, and validate it.\n\nSo, on the server, you can always ask \"Is this person allowed in the building?\" and `getServerSession` will give you a reliable \"yes\" or \"no\" and tell you who they are, because the proof is sent with every request.\n\n#### Why Firebase Fails on the Server (Without the Admin SDK)\n\n**On the Client:** When we call `signInWithCustomToken` in the `FirebaseAuthProvider`, the Firebase client-side SDK establishes a session in the browser. It stores its own authentication token in the browser's IndexedDB. When your client-side code makes a request to Firestore, the SDK automatically attaches this token. Security rules see the token and say, \"Okay, this key card is valid, open the vault.\"\n\n**On the Server:** Your server-side code (in a Server Component or Server Action) is a completely separate environment. It has no browser and no access to the IndexedDB where the client's Firebase token is stored. The `signInWithCustomToken` call that happened in the browser is completely invisible to it.\n\nWhen your server-side code tries to use the standard Firebase SDK (the one initialized in `firebase.ts`), it's like walking up to the vault with no key card at all. Firestore sees an unauthenticated request and correctly denies it, giving you the \"Missing or insufficient permissions\" error.\n\n#### The Solution Implemented (Bridging the Gap)\n\n**The Master Key (admin-sdk):** The Firebase Admin SDK is initialized with your service account credentials. This is the equivalent of a master key that can open any vault, bypassing the normal security rules. It's designed specifically for trusted server environments. This is why I created all the `-admin.ts` files—to ensure that any time our server needs to access the vault, it uses its master key.\n\n## 🌐 Browser Support \u0026 Compatibility\n\nTaskFlow is built with modern web standards and supports all major browsers:\n\n| Browser              | Version | PWA Support | Offline Mode | Notes                           |\n| -------------------- | ------- | ----------- | ------------ | ------------------------------- |\n| **Chrome**           | 90+     | ✅ Full     | ✅ Full      | Recommended for best experience |\n| **Edge**             | 90+     | ✅ Full     | ✅ Full      | Chromium-based, full support    |\n| **Firefox**          | 88+     | ⚠️ Partial  | ✅ Full      | PWA install may vary by OS      |\n| **Safari**           | 14+     | ⚠️ Limited  | ✅ Full      | iOS: Add to Home Screen         |\n| **Opera**            | 76+     | ✅ Full     | ✅ Full      | Chromium-based                  |\n| **Samsung Internet** | 14+     | ✅ Full     | ✅ Full      | Android devices                 |\n\n**Requirements:**\n\n- JavaScript enabled\n- LocalStorage and IndexedDB support\n- Service Worker support for offline functionality\n- Modern CSS Grid and Flexbox support\n\n**Mobile Support:**\n\n- iOS 14+ (Safari, Chrome)\n- Android 8+ (Chrome, Firefox, Samsung Internet)\n- Responsive design adapts to all screen sizes\n- Touch-optimized interface\n\n## 🎯 Use Cases\n\nTaskFlow is perfect for:\n\n- **Productivity Enthusiasts**: Power users who want an all-in-one solution for life management\n- **Fitness \u0026 Health Conscious**: Track workouts and nutrition alongside daily tasks\n- **Remote Workers**: Manage work tasks, habits, and personal goals in one place\n- **Students**: Organize assignments, study schedules, and personal projects\n- **Freelancers**: Track projects, deadlines, and maintain work-life balance\n- **Digital Nomads**: Offline-first design perfect for unreliable internet connections\n- **Habit Builders**: Gamification and streaks help build lasting positive habits\n- **Data-Driven Individuals**: Comprehensive analytics and insights into your productivity\n\n## 🤝 Contributing\n\nThis is currently a personal project, but contributions, issues, and feature requests are welcome! Feel free to:\n\n1. Fork the repository\n2. Create a feature branch (`git checkout -b feature/AmazingFeature`)\n3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)\n4. Push to the branch (`git push origin feature/AmazingFeature`)\n5. Open a Pull Request\n\n## 📞 Contact \u0026 Support\n\nFor questions, feedback, or support:\n\n- **Issues**: Open an issue on GitHub\n- **Email**: ultrabrzitranzijent@gmail.com\n\n---\n\n**Built with ❤️ by Josip Čunko**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjosipcunko%2Ftaskflow","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjosipcunko%2Ftaskflow","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjosipcunko%2Ftaskflow/lists"}