Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data β all from the browser, and deployed in milliseconds.
A flexible, polymorphic habit tracking application that allows users to create custom habits with contextual data capture. Track anythingβwater intake, workouts, meditation, readingβwith rich metadata tailored to each habit.
- Create unlimited custom habits with names, descriptions, icons, and colors
- Define custom JSON schemas for contextual data (e.g., water amounts, exercise types)
- Log events with optional polymorphic context matching your habit's schema
- Delete and manage habits and events
- View statistics: today's count, weekly stats, average per day
- Manual logging with optional structured data based on habit schema
- Polymorphic storage: Context is stored as flexible JSON in the database
- Schema validation: Events are validated against your habit's defined schema
- Event history: View all logged events with their metadata
- Create NFC tags linked to specific habits
- Customizable context templates for each tag (coming soon)
- Public tap URLs that log events without authentication
- Instant logging: Tap a physical NFC tag to instantly log an event
- Manage tags: Create, view, and delete NFC tags from the dashboard
- Dark theme with gradient backgrounds
- Responsive design works on mobile and desktop
- Tab navigation for Habits, Events, and NFC Tags
- Real-time updates with instant feedback
habits
βββ id (UUID)
βββ userId (FK)
βββ name (string)
βββ description (string)
βββ icon (emoji)
βββ color (hex)
βββ createdAt, updatedAt
habit_schemas
βββ id (UUID)
βββ habitId (FK)
βββ schema (JSON) β defines context fields
βββ createdAt, updatedAt
habit_events
βββ id (UUID)
βββ habitId (FK)
βββ userId (FK)
βββ timestamp
βββ context (JSON) β polymorphic data matching schema
βββ source (string: "manual", "nfc")
βββ createdAt
nfc_tags
βββ id (UUID)
βββ userId (FK)
βββ habitId (FK)
βββ token (unique)
βββ name (string)
βββ contextTemplate (JSON) β optional
βββ createdAt, updatedAt
POST /api/habitsβ Create a new habit with optional JSON schemaGET /api/habitsβ Get all user's habitsGET /api/habits/:idβ Get habit details with today's eventsGET /api/habits/:id/history?days=7β Get event history
POST /api/habits/:id/logβ Log an event with optional contextDELETE /api/habits/:habitId/events/:eventIdβ Delete an event
POST /api/nfc/tagβ Create NFC tagGET /api/nfc/tagsβ Get user's NFC tagsDELETE /api/nfc/tag/:idβ Delete NFC tagGET /api/nfc/tap/:tokenβ Public endpoint for NFC tap (logs event)
{ "amount": { "type": "number", "required": true, "placeholder": "ml" }, "source": { "type": "string", "required": false, "placeholder": "bottle/tap/filter" } }
{ "exerciseType": { "type": "string", "required": true, "placeholder": "push-ups, running, yoga" }, "sets": { "type": "number", "required": false }, "reps": { "type": "number", "required": false }, "duration": { "type": "number", "required": false, "placeholder": "minutes" } }
- Create a tag: Go to the NFC Tags tab, select a habit, click "Create NFC Tag"
- Get the tap URL: A URL is displayed (e.g.,
https://your-app.val.run/api/nfc/tap/token123) - Write to NFC tag: Use an NFC writing app (Android NFC Tools, iPhone Shortcuts) to write this URL
- Tap to log: Tapping the physical tag opens the URL and logs an event
Magic link authentication via email. No passwords required.
- React 18 with TypeScript
- Tailwind CSS for styling
- Better Auth with magic link plugin
- Deno runtime (Val Town)
- Hono web framework
- SQLite database (project-scoped)
- Better Auth for authentication
- Deno runtime (Val Town)
- Sign in with your email
- Create a habit with optional context schema
- Log events manually or via NFC tags
- View statistics and manage your habits
- Habit streaks and achievements
- Advanced filtering and search
- Data export (CSV, JSON)
- Habit templates
- Analytics dashboard
- Reminders and notifications
- Social sharing
- Habit recommendations
Built with β€οΈ on Val Town