Skip to content

โปรไฟล์โปรเจกต์: habby

ข้อมูลตัวตน (Identity)

  • Name: habby
  • Display Name: Habby
  • Description: แอปติดตาม habit แบบ gamified — public mode พร้อม localStorage + owner mode พร้อม Redis
  • Repository: https://github.com/ktypez/habby

เทคโนโลยี (Technology)

  • Languages: JavaScript
  • Frameworks: Vite 8, Express 5
  • Runtime: Node.js
  • Package Manager: yarn
  • Build System: Vite build
  • Deployment Targets: Vercel (static + serverless)
  • Font: JetBrains Mono (self-hosted)

Dependencies

Core Dependencies

PackageVersionหน้าที่
express^5.2.1HTTP server + API routes
ioredis^5.11.1Redis client (Upstash)
cors^2.8.6CORS middleware

Dev Dependencies

PackageVersionหน้าที่
vite^8.0.0Build tool + dev server
vitest^4.1.9Testing framework

External Services

  • Redis (Upstash) — สำหรับ owner mode data storage
  • Vercel — static hosting + serverless functions

หมายเหตุ

  • ไม่มี frontend framework (vanilla JS)
  • ไม่มี UI library
  • ไม่มี linting tools
  • ไม่มี TypeScript

Development

คำสั่งทำอะไร
yarn installติดตั้ง dependencies
yarn devVite dev server (proxy /api → localhost:3001)
yarn dev:serverExpress backend (port 3001)
yarn buildbuild frontend ด้วย Vite → dist/
yarn previewpreview production build
yarn startเริ่ม production server
node node_modules/.bin/vitest runรันชุดทดสอบ (18 tests — streak + XP logic)

Deployment

push to GitHub → Vercel auto-deploys

Architecture

habby/
├── api/              # Backend API routes (serverless)
├── css/              # Global styles (neobrutalist theme)
├── js/               # Frontend logic (main.js)
├── lib/              # Shared utilities (logic.js — streak/XP calculations)
├── public/           # Static assets + service worker
│   ├── sw.js         # Service Worker (caching + notification clicks)
│   └── fonts/        # JetBrains Mono (self-hosted woff2)
├── scripts/          # Tool scripts (cleanup-archived.mjs)
├── tests/            # Vitest tests (streak + XP logic)
├── dist/             # Build output
├── index.html        # SPA entry point
├── server.js         # Express server (API + static hosting)
├── vite.config.js    # Vite configuration
├── vitest.config.js  # Vitest configuration
├── vercel.json       # Vercel deployment config
└── package.json

Key Files

ไฟล์หน้าที่
index.htmlSPA entry point
js/main.jsFrontend logic ทั้งหมด (SPA routing, UI, Storage adapter)
lib/logic.jsPure functions — calculateStreak, calcXpForCheckin, calcLevel
server.jsExpress server + API routes
api/Serverless API handlers สำหรับ Vercel
public/sw.jsService Worker — cache-first strategy + notification click handler
css/style.cssGlobal styles — neobrutalist theme
vite.config.jsVite build + dev server proxy config

Storage

Dual-mode — localStorage (guest) + Redis API (owner)

PWA

Service worker สำหรับ caching + notification clicks (ไม่มี manifest — ไม่รองรับ install prompt)

Entry Points

index.html (Vite), server.js (Express)

Open Knowledge Framework