A full-stack habit tracking web app built with React + FastAPI + PostgreSQL. Track daily habits, build streaks, and navigate through weeks.
- Node.js v18+
- Python 3.11+
- PostgreSQL 17
- Open pgAdmin 4
- Create a new database called
habit_tracker - Open Query Tool and run:
CREATE TABLE habits (
id SERIAL PRIMARY KEY,
name VARCHAR(255) NOT NULL,
created_at TIMESTAMP DEFAULT NOW()
);
CREATE TABLE completions (
id SERIAL PRIMARY KEY,
habit_id INTEGER NOT NULL REFERENCES habits(id) ON DELETE CASCADE,
date DATE NOT NULL,
UNIQUE(habit_id, date)
);cd backend
python -m venv venv
venv\Scripts\activate
pip install -r requirements.txtCreate a .env file in the backend folder:
DATABASE_URL=postgresql://postgres:YOUR_PASSWORD@localhost:5432/habit_tracker
Then start the server:
uvicorn main:app --reloadBackend runs at http://localhost:8000
Open a new terminal in the root folder:
npm install
npm run devFrontend runs at http://localhost:5173
- Add, rename, and delete habits
- Weekly grid with toggleable checkmarks
- Today's column highlighted
- Future dates disabled
- Streak counter per habit
- Week navigation (previous, next, back to this week)
- Historical checkmarks persist across reloads
- Empty state when no habits exist
- Fully connected to PostgreSQL via FastAPI