habit-tracker

Habit Tracker

A gamified habit-tracking web app. You build habits, earn XP and level up, set goals, keep a journal, and take on challenges with friends. It’s written in plain PHP with a hand-rolled MVC structure and MySQL, without a framework.

Features

Architecture

index.php              landing page and login redirect
config/database.php    PDO connection
models/                User, Habit, Goal, Journal, Challenge, Community, Achievement, Notification
controllers/           one controller per feature, plus form-handling endpoints (process_*.php)
views/                 pages (dashboard, habits, goals, journal, challenges, community, analytics …)
utils/                 XP system, badge system, notification helpers
assets/                Bootstrap, custom CSS/JS, badge images
schema.sql             18-table MySQL schema

Data lives in 18 tables. The main groups are users and settings, habits and completions, goals, challenges with participants and tasks, the journal, levels and achievements, friends and friend requests, the leaderboard, and notifications.

Tech stack

PHP 7.4+ (PDO) · MySQL 5.7+ · Bootstrap · JavaScript · Chart.js · Apache (.htaccess)

Running locally

The easiest route is XAMPP, WAMP or MAMP, which bundle Apache, PHP and MySQL.

git clone https://github.com/aksaN000/habit-tracker.git
# place the folder in your web root, e.g. C:\xampp\htdocs\habit-tracker

mysql -u root -p -e "CREATE DATABASE habit_tracker"
mysql -u root -p habit_tracker < schema.sql

Then:

  1. Set your database credentials in config/database.php.
  2. Open http://localhost/habit-tracker.

INSTALLATION.md has the full guide, covering the database user, permissions and Apache mod_rewrite.

Repository notes

Built for CSE370 (Database Systems) at BRAC University.