A modern, full-stack habit tracking application built with Next.js, tRPC, and OpenAI integration. Track your habits, get AI-powered suggestions, and stay motivated with personalized messages. Now with comprehensive social features, settings management, and AI-powered challenges!
- 🔐 Secure authentication with Clerk
- 📊 Track daily habits and streaks with visual progress indicators
- ➕ Add, view, and complete habits (daily/weekly/monthly)
- 👫 Social features:
- Send, accept, and decline friend requests
- View your friends and pending requests
- Remove friends
- 🎉 Cheers system:
- Send and receive cheers (encouraging messages) on friends' habits
- View all cheers for a habit in a modal
- Cannot send cheers to yourself (button is disabled and tooltip explains why)
- Error and success messages are shown as modern toast popups
- ⚙️ Settings & Preferences:
- Theme switching (Light/Dark/System)
- Notification preferences
- Privacy settings
- Regional settings (timezone, language)
- 🔔 Notification System:
- In-app notifications for friend requests, cheers, and milestones
- Email and push notification support (placeholder)
- Mark as read, delete, and bulk management
- Real-time unread count
- 🏆 AI-Powered Challenges System:
- Create and join habit challenges
- AI-generated challenge suggestions based on user habits
- Leaderboards and progress tracking
- Challenge rewards and achievements
- Social competition features
- 🤖 AI Integration:
- OpenAI-powered habit suggestions
- AI-generated motivational messages
- Smart challenge recommendations
- Personalized insights and analytics
- 🌙 Dark mode support with system preference detection
- 📱 Responsive design with mobile-optimized navigation
- ⚡ Modern UI/UX:
- Toast popups for feedback
- Disabled buttons and tooltips for restricted actions
- Clean, mobile-friendly dashboard
- Horizontal scrolling for habit cards
- Keyboard navigation support
- Frontend: Next.js 14 (App Router), TailwindCSS, next-themes
- Backend: tRPC, Prisma ORM
- Database: PostgreSQL (Railway)
- Authentication: Clerk
- AI Integration: OpenAI API
- Data Fetching: TanStack Query
- State Management: React hooks with tRPC
- Deployment: Vercel
- Node.js 18+
- npm or yarn
- OpenAI API key
- Clerk account and API keys
- PostgreSQL database (Railway recommended)
- Clone the repository:
git clone https://github.com/yourusername/ai-powered-habit-tracker.git
cd ai-powered-habit-tracker- Install dependencies:
npm install- Set up environment variables:
cp .env.example .env.localFill in your environment variables in .env.local:
OPENAI_API_KEY- Your OpenAI API key for AI featuresCLERK_SECRET_KEY- Clerk secret key for authenticationNEXT_PUBLIC_CLERK_PUBLISHABLE_KEY- Clerk publishable keyDATABASE_URL- PostgreSQL connection string
- Initialize the database:
npx prisma generate
npx prisma migrate dev- Run the development server:
npm run devOpen http://localhost:3000 to view the application.
app/
├── api/trpc/ # tRPC API routes
├── (auth)/ # Authentication pages
├── (dashboard)/ # Main app pages (habits, friends, settings, challenges)
├── components/ # React components
│ ├── ui/ # Reusable UI primitives
│ ├── habits/ # Habit-related components
│ └── friends/ # Friend-related components
├── lib/ # Utility functions and services
│ ├── trpc/ # tRPC configuration and routers
│ └── prisma.ts # Database client
└── styles/ # Global styles
- Sign in (or sign up) securely with Clerk
- Add habits you want to track (with emoji and frequency)
- Mark habits as complete each day to build your streak
- Add friends by email, accept/decline requests, and manage your friend list
- Send and receive cheers to/from friends for extra motivation
- Customize settings including theme, notifications, and privacy preferences
- Join AI-powered challenges for extra motivation and social competition
- Receive smart notifications for important events and milestones
- All feedback (errors, successes) is shown as modern toast popups
- Navigate seamlessly with keyboard shortcuts and responsive design
npm run dev- Start development servernpm run build- Build for productionnpm run start- Start production servernpm run lint- Run ESLintnpm run format- Format code with Prettier
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.