haGIT is a Git-inspired habit tracking system designed for developers and technical users who prefer structured workflows over traditional habit-tracking interfaces.
Instead of checklists or streak counters, haGIT models habits using familiar version control concepts such as branches, commits, logs, and pushes. This allows habit actions to be recorded, organized, and synchronized in a workflow similar to Git.
The system consists of three primary components:
- haGIT CLI — a command-line interface for recording and managing habit actions locally.
- Web Dashboard — a Next.js web application that visualizes habit activity.
- Chrome Extension — a lightweight interface for quickly creating commits and managing habits.
Together, these components provide both developer-friendly workflows and visual insight into habit consistency.
The haGIT ecosystem follows a centralized architecture where multiple clients interact with a unified backend implemented using Next.js API routes.
flowchart LR
CLI[haGIT CLI]
EXT[Chrome Extension]
WEB[Next.js Dashboard]
API[Next.js API Routes]
DB[(PostgreSQL Database)]
CLI --> API
EXT --> API
WEB --> API
API --> DB
- The CLI records habit commits locally and pushes them to the server.
- The Chrome Extension allows quick habit management and commit creation.
- The Web Dashboard provides visual analytics and habit insights.
- Next.js API routes handle authentication, habits, commits, and database interaction.
- The database stores users, habits, and commit records.
All clients communicate with the same API routes to ensure consistent behavior across the ecosystem.
The haGIT platform uses modern JavaScript tooling across the CLI, dashboard, extension, and backend.
| Layer | Technology | Purpose |
|---|---|---|
| Frontend Framework | Next.js (App Router) | Dashboard UI and API routes |
| Language | TypeScript / JavaScript | Application development |
| Styling | TailwindCSS | Utility-first styling |
| UI Components | shadcn/ui | Accessible UI primitives |
| State Management | Zustand | Global application state |
| Data Fetching | TanStack Query | Server state synchronization |
| Forms | React Hook Form | Form handling and validation |
| ORM | Prisma | Database access layer |
| Database | PostgreSQL (Neon) | Managed cloud database |
| CLI Framework | Commander.js | Command parsing |
| CLI UX | Ora | Terminal spinners |
| HTTP Client | Axios | API requests |
| Terminal Styling | Chalk | CLI output formatting |
| Browser Extension | Chrome Extension (Manifest v3) | Quick habit interaction |
| Runtime | Node.js | Backend runtime for Next.js API routes |
The haGIT CLI is distributed via npm.
Install it globally:
npm install -g hagit-cli
Verify installation:
hagit --version
The CLI package is available at:
https://www.npmjs.com/package/hagit-cli
Global installation allows the hagit command to be executed from any directory.
The CLI provides a Git-like interface for managing habits.
| Command | Description | Example |
|---|---|---|
hagit init |
Initialize haGIT workspace | hagit init |
hagit login -t <token> |
Authenticate CLI with server | hagit login -t TOKEN |
hagit branch -m <habit> |
Create a new habit | hagit branch -m exercise |
hagit branch -d <habit> |
Delete an existing habit | hagit branch -d exercise |
hagit checkout <habit> |
Switch current habit | hagit checkout reading |
hagit commit -m <message> |
Record a habit action | hagit commit -m "morning run" |
hagit commit -d <commitId> |
Delete a commit | hagit commit -d 123 |
hagit log |
Show commit history | hagit log |
hagit status |
Display workspace state | hagit status |
hagit reset |
Clear unpushed commits | hagit reset |
hagit push |
Sync commits with server | hagit push |
A typical workflow using the CLI:
hagit init
hagit login -t <token>
hagit branch -m exercise
hagit checkout exercise
hagit commit -m "morning run"
hagit push
- Initialize workspace
Creates local configuration used to track habits and commits.
- Authenticate
Links the CLI with the user account via token authentication.
- Create habit
Defines a new habit branch.
- Switch habit
Sets the active habit context.
- Commit action
Records a completed habit action locally.
- Push commits
Synchronizes local commits with the server.
The web dashboard provides a visual interface for monitoring habit progress.
- Habit management
- Commit history visualization
- Contribution heatmaps
- Aggregated activity statistics
- User account management
- Token management for CLI authentication
The dashboard emphasizes visual insights and analytics, helping users identify patterns in their habit consistency.
The Chrome extension provides a fast interface for interacting with haGIT without opening the dashboard.
- Create commits quickly
- Manage habits
- View recent commits
- Authenticate using token
- Perform CRUD operations on habits and commits
The extension communicates with the same Next.js API routes used by the CLI and dashboard.
- Build the extension.
- Open the Chrome extensions page:
chrome://extensions
- Enable Developer Mode.
- Click Load unpacked.
- Select the extension build directory.
The entire system integrates CLI, extension, dashboard, and backend services.
sequenceDiagram
participant CLI
participant EXT
participant WEB
participant API
participant DB
CLI->>API: Push commits
EXT->>API: Create commit
WEB->>API: Fetch commits
API->>DB: Store / retrieve data
DB-->>API: Return results
API-->>WEB: Habit statistics
- CLI records habit actions locally.
- CLI pushes commits to the server.
- Next.js API routes store commits in the PostgreSQL database.
- The dashboard retrieves and visualizes the data.
- The extension allows quick commit entry and habit management.
A typical repository layout:
/cli
/extension
/prisma
/src
| Directory | Purpose |
|---|---|
/cli |
Command-line interface implementation |
/extension |
Chrome extension source code |
/prisma |
Database schema and migrations |
/src |
Next.js application including dashboard UI and API routes |
The Next.js API routes are implemented inside the /src directory, following the App Router structure.
Clone the repository and install dependencies:
npm install
npm run dev
npm run build
Run extension development mode:
npm run dev
Build production extension:
npm run build
The build output will contain the compiled extension ready to load in Chrome.
After running:
npm run build
the extension build directory will contain:
manifest.json
popup.html
assets
scripts
This folder can be loaded via the Chrome extensions page.
Authentication across the system uses JWT tokens.
Authentication flow:
- User signs in through the dashboard.
- A JWT token is generated.
- The token is used by the CLI and extension.
- Each request to the API routes is verified using the token.
This ensures secure authentication across all clients.
Each habit behaves like a branch in version control.
Example habits:
exercise
reading
meditation
coding
Commits represent completed habit actions:
exercise
├ morning run
├ gym session
└ stretching routine
This model allows habits to maintain independent histories while contributing to overall activity metrics.
haGIT is built around a simple idea:
Consistency improves when workflows are structured and visible.
By combining:
- developer-friendly CLI workflows
- quick browser extension interactions
- visual dashboard analytics
haGIT creates a system that integrates naturally into a developer’s daily workflow.
MIT License