Habit Tracking Platform designed to build consistency.
Features β’ Quick Start β’ Contributing
Habitzy is a habit tracking platform designed to help users build consistency through gamification.
- Create, track, edit, and delete habits
- Monitor daily progress with streaks and leaderboards
- Easy to use drag-and-drop habits ordering
- Secure JWT authentication & authorization
- Manage profiles and customizable settings
- Dockerized deployment
# Development
docker compose -f docker-compose.dev.yml up --build
# Production
docker compose -f docker-compose.prod.yml up --build -d# Clone the repository
git clone https://github.com/DevHanza/habitzy.git
# Go to the repository folder
cd habitzy
# Install dependencies
(cd frontend && npm install) && (cd backend && npm install)-
Set up environment variables by copying
.example.envand renaming it to.envin both the./frontendand./backendfolders -
Start the application.
# Start the Frontend
cd ./frontend;
npm run dev;
# Start the Backend
cd ./backend;
npm run dev;
# For Production, refer to: https://www.frontendundefined.com/posts/tutorials/vite-production-build/- MongoDB Atlas: https://www.mongodb.com/cloud/atlas/register
- MongoDB connection string guide: https://www.mongodb.com/resources/products/fundamentals/mongodb-connection-string
- Brevo SMTP setup guide: https://help.brevo.com/hc/en-us/articles/7959631848850-Create-and-manage-your-SMTP-keys
- React
- React Router
- Chakra UI
- Pragmatic Drag and Drop
- Frimousse
- check-password-strength
- Lucide Icons
- @number-flow/react
- Node.js
- Express.js
- MongoDB
- Mongoose
- cors
- dotenv
- bcrypt
- jsonwebtoken
- cookie-parser
- express-rate-limit
- nodemailer
- nodemon
- Docker
- GitHub Actions
- Nginx
Frontend (React)
β
βΌ
API Calls (HTTP/REST)
β
ββββββ΄βββββ
βΌ βΌ
Express + Node.js Backend
β
βΌ
MongoDB Database
- Improved performance using
React.memo,useMemo, anduseCallbackfor memoization. - Indexed MongoDB queries to speed up data retrieval.
- Used React Context for simpler and lighter state management.
Preventing unnecessary re-renders of all habit cards when updating a single card.
β
Solved using `React.memo` and memoized callbacks.
Keeping drag-and-drop habit ordering synchronized between frontend state and backend.
β
Solved with shared ordering utilities and optimistic state updates.
Ending user streaks automatically without depending on external schedulars or systems.
β
Solved with date comparison logic + storing dailylogs of users in DB.
Sharing authentication state across multiple React contexts without circular re-render bugs.
β
Solved by separating context responsibilities and memoizing provider values.
Creating a Docker setup that works for both development and production environments.
β
Solved using separate Docker Compose configurations.
Building Habitzy helped me strengthen my understanding of:
- Managing authentication and backend communication using React Context.
- Practical use of React memoization techniques for performance optimization.
- JWT-based authentication and authorization workflows.
- Database indexing for improving query performance.
- Docker for both development and production deployment.
- Add optimistic UI updates
habitzy/
βββ backend/
β βββ Dockerfile
β βββ package.json
β βββ package-lock.json
β βββ src/
β βββ index.js # App entry point
β βββ server.js # Server bootstrap
β βββ config/
β β βββ db.js # MongoDB connection setup
β βββ controllers/ # Business logic layer
β βββ middleware/ # Request middlewares
β βββ models/ # MongoDB schemas
β βββ routes/ # API routes
β βββ utils/ # Helper functions
β
βββ frontend/
β βββ Dockerfile
β βββ index.html
β βββ vite.config.js
β βββ nginx.conf
β βββ package.json
β βββ package-lock.json
β βββ eslint.config.js
β βββ jsconfig.json
β βββ public/ # Static assets
β βββ dist/ # Production build output
β βββ src/
β βββ main.jsx # React entry point
β βββ App.jsx # Root component
β βββ routes.jsx # App routing
β βββ index.css
β βββ api/ # API layer
β βββ assets/ # Images, animations, lottie files
β βββ components/ # Reusable UI components
β βββ context/ # Global state management
β βββ hooks/ # Custom React hooks
β βββ pages/ # App pages/routes
β βββ services/ # Service layer (if used)
β βββ theme/ # UI theme configuration
β βββ utils/ # Helper utilities
β
βββ docker-compose.dev.yml
βββ docker-compose.prod.yml
βββ LICENSE
Pull requests are welcome.
For major changes, please open an issue first to discuss proposed improvements.
This project is licensed under the MIT License β free for personal and commercial use.
See LICENSE for details.
Hosted for free on Cloudflare Pages.