Skip to content

teacupweb/habiterr

Repository files navigation

Habiterr

A free, open-source, minimalist habit tracker. Define custom routines, track daily habits, and visualize your progress with streaks, charts, and contribution heatmaps.

Built with Next.js 16, React 19, PostgreSQL, Prisma, and Tailwind CSS v4.


Features

  • Habit CRUD — Create, edit, toggle, and delete habits with custom icons and colors
  • Daily Tracking — Log completions each day with configurable rep targets
  • Streak Tracking — Automatic current and longest streak calculation
  • Visual Analytics
    • Weekly Bar Chart — Completed vs. total habits for the last 7 days
    • Contribution Heatmap — GitHub-style 90-day activity grid
    • Stats Cards — Current streak, completion rate, longest streak, total days tracked
  • Authentication — Email/password auth via Better Auth
  • Responsive Dark Theme — Built with Tailwind CSS v4 and shadcn/ui
  • JSON Routines — Define habits via JSON configuration

Tech Stack

Layer Technology
Framework Next.js 16.1.6 (App Router)
Frontend React 19.2.3, Tailwind CSS v4, shadcn/ui
Backend Next.js API Routes
Database PostgreSQL + Prisma ORM 7.3
Auth Better Auth 1.4 (email/password)
Validation Zod 4 + React Hook Form
Icons Lucide React, React Icons (Font Awesome)
Deploy Netlify

Getting Started

Prerequisites

  • Node.js 20+
  • PostgreSQL database
  • npm

Installation

git clone https://github.com/your-username/habiterr.git
cd habiterr
npm install

Environment Variables

Create a .env file in the project root:

DATABASE_URL="postgresql://user:password@localhost:5432/habiterr"
BETTER_AUTH_SECRET="your-secret-key"
BETTER_AUTH_URL="http://localhost:3000"

Generate a secret:

openssl rand -hex 32

Database Setup

npx prisma generate
npx prisma migrate dev

Run Development Server

npm run dev

Open http://localhost:3000.


API Endpoints

Method Endpoint Description
GET /api Health check
POST /api/auth/[...all] Better Auth handler (login, signup, session)
GET, POST, PUT, DELETE /api/habits Habit CRUD
PATCH, DELETE /api/habits/[id] Single habit update/delete
GET, POST, DELETE /api/activity Daily activity logs
PATCH /api/activity/[id] Update single activity
GET, POST /api/stats User stats (streaks, completion)
PATCH /api/stats/[id] Update single stats record

Database Models

  • User — Account management via Better Auth
  • Session — Auth sessions
  • Account — Auth provider accounts
  • Verification — Email verification tokens
  • Habit — User-defined habits (name, reps, icon, color, optional routine)
  • Routine — Groups of habits with optional auto-increment settings
  • Activity — Daily completion logs (completed / total per day)
  • Stats — Streak and completion snapshots

Scripts

Command Description
npm run dev Start development server
npm run build Build for production
npm start Start production server
npm run lint Run ESLint

Deployment

The project includes a netlify.toml for one-click deployment to Netlify.

  1. Push to GitHub
  2. Connect repo on Netlify
  3. Set environment variables (DATABASE_URL, BETTER_AUTH_SECRET, BETTER_AUTH_URL)
  4. Deploy

Contributing

This is a community-driven project. Feel free to open issues and pull requests on GitHub.


License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors