Skip to content
comaeclipsePublic

About

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Cadence

A modern behavior tracking application for Applied Behavior Analysis (ABA) data collection and behavioral incident logging.

Overview

Cadence is a web application built with Next.js that provides a streamlined interface for tracking behavioral incidents, poop events, and other ABA data throughout the day. The app features an intuitive design with multi-level expandable forms for quick data entry and a PostgreSQL backend for reliable data persistence.

Purpose

Cadence is designed for parents, caregivers, therapists, and behavior analysts to track behavioral incidents with detailed information including behavior type, severity, duration, triggers, consequences, and function hypotheses. The app aims to make ABA data collection simple, accessible, and consistent.

Features

  • Multi-User Authentication: Secure login/registration with per-user data isolation and 7-day session expiry
  • AES-256-GCM Encryption: Server-side encryption for sensitive entry fields
  • Multi-Level Entry System: Expandable "add..." button revealing Incident, Poop, and Food logging options
  • Behavioral Incident Tracking: Log behavior type, duration, trigger, consequence, and notes
  • Poop Event Tracking: Quick-log consistency types (Soft, Normal, Hard, Formed, Loose, Watery)
  • Food Tracking: Log meals and food events with database persistence
  • Edit & Delete: Full CRUD on all entries with confirmation dialogs
  • Stopwatch Timer: Built-in nav bar stopwatch for timing incidents and handoffs
  • Calendar View: Visual month view with incident highlighting and day-level drill-down
  • PDF Export: ABC Data Sheet and detailed incident report generation
  • Child Profiles: Support for multiple children with easy switching
  • Real-time Toast Notifications: Immediate feedback for user actions
  • Mobile-First Design: iOS-style interface with bottom tab navigation

Tech Stack

Core Framework

  • Next.js 16.2.4 - React framework with App Router
  • React 19.2.5 - UI library
  • TypeScript 6 - Type-safe development

Database & Backend

  • Prisma 7.8 - Type-safe ORM
  • Neon PostgreSQL - Serverless Postgres database
  • Next.js API Routes - RESTful API endpoints

UI & Styling

  • Tailwind CSS 4 - Utility-first CSS framework
  • shadcn/ui - Component library built on Radix UI primitives
  • Radix UI - Accessible component primitives (Select, Slider, Dialog, Accordion, etc.)
  • Lucide React - Modern icon library (1000+ icons)
  • class-variance-authority - Component variant styling
  • tailwind-merge - Smart class merging

Forms & Validation

  • React Hook Form 7.65 - Performant form handling
  • Zod 4 - TypeScript-first schema validation

Additional Libraries

  • Sonner - Beautiful toast notifications
  • date-fns - Date manipulation and formatting
  • React Day Picker - Calendar component
  • Recharts - Charts and data visualization
  • React Swipeable - Touch gesture support
  • @tanstack/react-query - Data fetching and caching
  • next-themes - Dark/light mode theming

Getting Started

Prerequisites

  • Node.js 20+
  • npm or pnpm
  • Neon PostgreSQL database (get free at neon.tech)

Installation

  1. Clone the repository:
git clone https://github.com/comaeclipse/Cadence.git
cd Cadence
  1. Install dependencies:
npm install
  1. Set up environment variables — create a .env file in the project root:
DATABASE_URL="postgresql://..."  # Pooled connection
DIRECT_URL="postgresql://..."    # Direct connection (for migrations)
SESSION_SECRET="your-secret"     # Secret for session token signing
  1. Initialize the database:
npx prisma db push
npx prisma generate
  1. Run the development server:
npm run dev

Open http://localhost:3000 to see the app.

Database Schema

The app uses Prisma with the following main models:

  • Child - Child profiles
  • Incident - Behavioral incident logs with relations to behaviors, antecedents, consequences, interventions
  • Behavior, Antecedent, Consequence, Intervention, Location - Catalog items
  • Attachment - Media attachments for incidents

API Routes

  • POST /api/auth/login — Authenticate and issue session token
  • POST /api/auth/register — Create a new user account
  • GET/POST /api/entries — Consolidated entry listing
  • GET/POST /api/incidents — List and create incidents
  • GET/PATCH/DELETE /api/incidents/[id] — Individual incident operations
  • GET/POST /api/poops — Poop event tracking
  • GET/PATCH/DELETE /api/poops/[id] — Individual poop operations
  • GET/POST /api/foods — Food event tracking
  • GET/PATCH/DELETE /api/foods/[id] — Individual food operations
  • GET/POST /api/children — Child profile management
  • GET/POST /api/catalogs/[type] — Catalog management (behaviors, antecedents, etc.)
  • GET /api/reports/data — Aggregate data for PDF/report generation

Deployment

The app is configured for deployment on Vercel:

  1. Push to GitHub
  2. Connect repository to Vercel
  3. Add environment variables in Vercel dashboard
  4. Deploy automatically on push to master branch

Build uses Turbopack and generates Prisma Client automatically via postinstall script.

Roadmap

  • PostgreSQL integration with Prisma
  • Multi-level add button UI
  • Poop and food event tracking
  • Consequence field with custom input
  • Multi-select behaviors and consequences
  • Edit and delete entries
  • PDF export (ABC Data Sheet, detailed incident report)
  • Multi-user authentication with session management
  • Per-user data isolation
  • AES-256-GCM server-side field encryption
  • 7-day session expiry
  • Stopwatch timer for incident handoffs
  • Advanced analytics dashboard
  • Data export to CSV
  • Timeline view improvements
  • Catalog management UI
  • Push notifications / reminders

About

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages