Habit and task tracker app.
  • Ruby 79.5%
  • HTML 13.4%
  • Dockerfile 3.7%
  • JavaScript 1.6%
  • CSS 1.2%
  • Other 0.6%
Find a file
Seth Fenske 81b437cc72
Some checks failed
CI / scan_ruby (push) Has been cancelled
CI / scan_js (push) Has been cancelled
CI / lint (push) Has been cancelled
CI / test (push) Has been cancelled
Created API to get unscheduled Habits.
2026-05-30 17:01:41 -05:00
.github Rails Project Creation 2026-02-28 20:28:46 -06:00
.vscode Use new exctension package to debug ruby on rails. 2026-04-06 21:19:20 -05:00
app Created API to get unscheduled Habits. 2026-05-30 17:01:41 -05:00
bin Rails Project Creation 2026-02-28 20:28:46 -06:00
config Fixing config. CORS and Timezone 2026-03-17 22:53:49 -05:00
db Added log status skipped and updated logs from date to date time. 2026-04-27 20:07:47 -05:00
lib Rails Project Creation 2026-02-28 20:28:46 -06:00
log Rails Project Creation 2026-02-28 20:28:46 -06:00
public Rails Project Creation 2026-02-28 20:28:46 -06:00
storage Rails Project Creation 2026-02-28 20:28:46 -06:00
test Rails Project Creation 2026-02-28 20:28:46 -06:00
tmp Rails Project Creation 2026-02-28 20:28:46 -06:00
vendor Rails Project Creation 2026-02-28 20:28:46 -06:00
.dockerignore Rails Project Creation 2026-02-28 20:28:46 -06:00
.gitattributes Rails Project Creation 2026-02-28 20:28:46 -06:00
.gitignore Don't track ruby mate files 2026-04-11 13:27:04 -05:00
.rubocop.yml Rails Project Creation 2026-02-28 20:28:46 -06:00
.ruby-version Rails Project Creation 2026-02-28 20:28:46 -06:00
config.ru Rails Project Creation 2026-02-28 20:28:46 -06:00
Dockerfile Rails Project Creation 2026-02-28 20:28:46 -06:00
Gemfile Use new exctension package to debug ruby on rails. 2026-04-06 21:19:20 -05:00
Gemfile.lock Updated gemfiles 2026-05-30 17:00:51 -05:00
Rakefile Rails Project Creation 2026-02-28 20:28:46 -06:00
README.md Updated install instructions to be smoother next time 2026-03-03 12:19:09 -06:00

🌿 Roots & Rhythm — Habit Tracker API

A personal habit tracker built to learn the GitLab tech stack: Rails · Grape · PostgreSQL (backend) + Vue (frontend, coming soon).


Tech Stack

Layer Technology Why
Framework Ruby on Rails 7.1 Convention over configuration
API DSL Grape GitLab's API framework
Database PostgreSQL GitLab's primary data store
Auth Grape + JWT (bcrypt) Token-based, stateless REST auth
Frontend Vue 3 (coming soon) GitLab's frontend framework

Getting Started

#0 Prerequisites
dnf group install development-tools
dnf install ruby-devel zlib-devel postgresql-server postgresql-devel libyaml-devel
rails update
gem install bundler -v 4.0.7


# 1. Install dependencies
bundle install

# 2. Set up the database
rails db:create db:migrate db:seed

# 3. Start the server
rails server
# API available at http://localhost:3000/api/v1

API Reference

Auth

Method Endpoint Description Auth?
POST /api/v1/auth/register Create account No
POST /api/v1/auth/login Get JWT token No

Register:

POST /api/v1/auth/register
{ "email": "john@example.com", "name": "John", "password": "secret123" }

 { "token": "eyJ...", "user": { "id": 1, "name": "John", "email": "..." } }

Login:

POST /api/v1/auth/login
{ "email": "john@example.com", "password": "secret123" }

 { "token": "eyJ..." }

For all protected endpoints, pass the token as:

Authorization: Bearer eyJ...

Habits

Method Endpoint Description
GET /api/v1/habits List all your habits
GET /api/v1/habits/dashboard Today's habits + streaks
POST /api/v1/habits Create a new habit
PUT /api/v1/habits/:id Update a habit
DELETE /api/v1/habits/:id Delete a habit

Create a habit:

POST /api/v1/habits
{
  "name": "Read the Bible",
  "category": "faith",      // faith | health | family | mind
  "frequency": "daily"      // daily | weekly | monthly
}

Dashboard response:

GET /api/v1/habits/dashboard
{
  "date": "2026-02-28",
  "habits": [
    {
      "id": 1,
      "name": "Read the Bible",
      "category": "faith",
      "frequency": "daily",
      "today_status": "done",   // done | missed | pending
      "streak": 12,
      "note": null
    }
  ],
  "summary": { "total": 7, "done": 5, "missed": 0, "pending": 2 }
}

Habit Logs (check-ins)

Method Endpoint Description
GET /api/v1/habits/:id/logs Log history for a habit
POST /api/v1/habits/:id/logs Mark done/missed for a date
GET /api/v1/logs/range?from=&to= All logs in a date range

Mark a habit done (with a note):

POST /api/v1/habits/1/logs
{
  "status": "done",
  "logged_on": "2026-02-28",
  "note": "Studied Philippians 4, notes on contentment and peace."
}

Project Structure

app/
  api/
    root_api.rb           # Mounts all Grape APIs
    v1/
      auth_helper.rb      # JWT encode/decode + authenticate! helper
      auth_api.rb         # POST /auth/register, /auth/login
      habits_api.rb       # CRUD + dashboard
      habit_logs_api.rb   # Check-ins (done/missed/skipped)
  models/
    user.rb               # has_secure_password, streak calculation
    habit.rb              # categories, frequencies, validations
    habit_log.rb          # one log per habit per day
db/
  schema.sql              # Full PostgreSQL schema reference

Next Steps

  1. Rails migrations — translate db/schema.sql into db/migrate/ files
  2. Seedsdb/seeds.rb with sample habits for development
  3. Tests — RSpec request specs for each endpoint
  4. Vue frontend — Vue 3 + Pinia store + Axios hitting this API
  5. Swagger docs — add grape-swagger for auto-generated API docs

Learning Resources