A full-stack web application for tracking habits with AI-powered recommendations. Built with React, Node.js, and Flask.
-
User Authentication
- Secure registration and login
- Protected routes
- Token-based authentication
-
Habit Tracking
- Create, read, update, and delete habits
- Track daily progress
- Visual progress indicators
- Customizable habit frequencies
-
AI Recommendations
- Personalized habit suggestions
- Category-based recommendations
- Smart habit matching based on user preferences
- Fallback recommendations system
- React with TypeScript
- Vite for build tooling
- Tailwind CSS for styling
- shadcn/ui component library
- React Query for data fetching
- React Router for navigation
- Node.js with Express
- MySQL database
- JWT for authentication
- bcrypt for password hashing
- Python with Flask
- scikit-learn for recommendations
- NumPy and Pandas for data processing
- Node.js (v14 or higher)
- Python 3.8+
- MySQL
- Clone the repository:
git clone <repository-url>
cd habit-tracker
- Install frontend dependencies:
npm install
- Install backend dependencies:
cd backend
npm install
- Install Python dependencies:
cd AI-Service
pip install -r requirements.txt
- Set up environment variables:
Create a
.env
file in the backend directory with:
MYSQL_HOST=localhost
MYSQL_USER=your_username
MYSQL_PASSWORD=your_password
MYSQL_DATABASE=habit_tracker
JWT_SECRET=your_secret_key
- Initialize the database:
mysql -u root -p
CREATE DATABASE habit_tracker;
- Start the Node.js backend:
cd backend
npm start
- Start the Flask recommendation service:
cd AI-Service
python app.py
- Start the frontend development server:
npm run dev
The application will be available at http://localhost:8080
├── src/ # Frontend source code
│ ├── components/ # React components
│ ├── pages/ # Page components
│ └── utils/ # Utility functions
├── backend/ # Node.js backend
│ ├── routes/ # API routes
│ └── middleware/ # Custom middleware
└── AI-Service/ # Python AI service
└── app.py # Flask application
- POST
/api/auth/register
- User registration - POST
/api/auth/login
- User login
- GET
/api/habits
- Get user habits - POST
/api/habits
- Create new habit - PUT
/api/habits/:id
- Update habit - DELETE
/api/habits/:id
- Delete habit
- GET
/api/recommendations
- Get habit recommendations
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.