I built a habit tracker app with Xano
Source: Dev.to
Overview
Habit tracker, the app I built, helps people log their daily routines and track completion. It also allows you to invite an accountability partner to keep you accountable with fulfilling your habits.
Live app (via Xano static hosting)
https://default-dev-8050f4-xn9g-tt4h-4ei5.n7e.xano.io/
Full code on GitHub
https://github.com/EmmanuelTheCoder/Lite-habit-tracker-xano
Contact
Email: tester@gmail.com
Backend Design
Database Tables
- Users – authentication enabled
- Habits (linked to users) – fields:
name,description,category,frequency,target_days(array),is_active,is_public - Habit_Logs –
habit_id,user_id,log_date(unique together),completed(boolean),notes,mood - Accountability_Partners –
user_id,partner_id,status(pending/accepted) - Encouragements – messages between partners
- Achievements – track user milestones
Core API Endpoints
- Auth:
signup,login - Habits: CRUD operations,
GET /habits(user’s habits) - Logs:
POST /habits/{id}/log– mark complete/incompleteGET /habits/{id}/logs– history
- Stats:
GET /habits/{id}/stats– current streak, completion rate, total completions - Dashboard:
GET /dashboard– today’s habits, overall stats - Partners: send/accept requests, view partner progress
- Encouragements: send/receive messages
Business Logic
- Calculate current streak (consecutive days completed)
- Calculate completion rate (percentage over a time period)
- Determine if a habit is due today based on
target_days - Prevent duplicate logs for the same date
- Auto‑award achievements (e.g., 7‑day streak, 30‑day streak)
Security
- All endpoints require authentication
- Users can only access their own data
- Partners can only see habits marked as public
- Proper indexing and data validation are applied
Development Experience
I didn’t have to do much work because my prompt was very detailed, and the Co‑pilot and the Xanoscript extension executed it well. The only adjustments were refining the user table and adding security.create_auth_token to the login and signup endpoints.
Xano proved to be a simple way to build full‑stack applications. Hosting the static frontend with a single click in VS Code was especially convenient, and setting up authentication was straightforward.
Challenges
- Lack of variable inspection or breakpoints made debugging more time‑consuming for complex applications. Fortunately, this project was simple, so I encountered fewer bugs.