Spaces:
Sleeping
Sleeping
metadata
title: Habit Journal
emoji: 📓
colorFrom: gray
colorTo: blue
sdk: docker
app_port: 7860
pinned: false
Habit Journal API
Personal habit journal API designed for a Hugging Face Docker Space. The
backend uses signed cookie sessions and durable JSONL files under DATA_ROOT.
Run locally
Set APP_PASSWORD and APP_SECRET_KEY, install requirements.txt, then run:
python -m venv .venv
.venv\Scripts\activate # Windows
pip install -r requirements.txt
uvicorn app.main:app --host 0.0.0.0 --port 7860
ENV=dev enables the OpenAPI endpoints for local development.
Environment
APP_PASSWORD: initial password used only whenconfig.jsonis absentAPP_SECRET_KEY: required session-signing keyDATA_ROOT: storage directory (default/data/loop_logger)ENV: runtime environment (defaultprod)APP_NAME: displayed application name (defaultHabit Journal)SESSION_MAX_AGE_SEC: signed-session lifetime (default604800)LOGIN_RATE_LIMIT/LOGIN_RATE_WINDOW_SEC: login throttlingAGENT_TOKEN: Bearer token forGET /api/agent/contextandPUT /api/agent/plan/{day}OPENROUTER_API_KEY/OPENROUTER_MODEL: optional coach model (else Rules backup)COACH_*: temperature, max tokens, history, trace limit (seeapp/config.py)SCHEDULE_*/RESCHEDULE_MIN_GAP_MIN: plan window and reschedule cooldownDEBUG_INCLUDE_FULL_BRIEF/MIN_STATS_N: debug paste and stats floor
Coach and schedule details: docs/BACKEND.md, docs/SCHEDULE.md, docs/ARCHITECTURE.md.
P1 finish checklist: docs/FINISH_AUDIT.md.
Frontend
Nav: Home | Plan | (+) Log | Daily | Settings (History via Home “See all”).
cd frontend
npm install
npm test
npm run build # writes to ../static for FastAPI
npm run dev # proxies /api to :7860
Docker builds the frontend in a Node stage and copies static/ into the image.
Service worker never caches /api/*.
Phone / Space verify
- Open the Space URL, log in.
- Confirm bottom nav includes Plan.
- Daily → Movement & freeze → save → reload → fields persist.
- After two indoors days (or set
stayed_indoors_all_daytwice), Home shows indoors banner → Move now. - Log intensity 9 + remedy “Labeling” → warning; coach/Rules should push interrupt/proof, not label-only.
Deploy to Hugging Face
git remote -v # expect hf → https://huggingface.co/spaces/Mbonea/Fastwhisper
git push hf master:main
Set secrets in the Space settings UI. Do not commit .env or tokens.
After rebuild, hard-refresh the PWA once so the new static/ + SW load.