FocusFlow is a minimalist, immersive focus timer built with Next.js App Router. It combines a distraction-light Pomodoro experience, task flow management, Clerk auth, and Supabase sync.
- Focus-first timer UI with keyboard shortcuts and animated progress states.
- Three background modes: gradient, lo-fi video, and wallpaper.
- Task management with sections (today, week, backlog) and optional duration/break settings.
- Clerk authentication with protected routes and modal sign-in.
- Supabase integration for authenticated data sync.
- PWA support enabled in production builds.
- Dev-only diagnostics panel for DB and API health checks.
- Next.js 16 (App Router)
- React 19 + TypeScript
- Tailwind CSS v4
- Zustand (persisted local state)
- Clerk (auth)
- Supabase (data)
- Framer Motion (UI animation)
- Node.js 20+ recommended
- npm (or equivalent package manager)
- Clerk project
- Supabase project
Create a .env.local file in the project root:
# Clerk
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=
CLERK_SECRET_KEY=
# Optional Clerk URLs (set for your deployment domain as needed)
NEXT_PUBLIC_CLERK_SIGN_IN_URL=/login
NEXT_PUBLIC_CLERK_SIGN_UP_URL=/signup
NEXT_PUBLIC_CLERK_AFTER_SIGN_IN_URL=/
NEXT_PUBLIC_CLERK_AFTER_SIGN_UP_URL=/
# Supabase
NEXT_PUBLIC_SUPABASE_URL=
NEXT_PUBLIC_SUPABASE_ANON_KEY=
# Legacy fallback key supported by this codebase (optional)
NEXT_PUBLIC_SUPABASE_PUBLISHABLE_DEFAULT_KEY=Notes:
NEXT_PUBLIC_SUPABASE_ANON_KEYis the primary key used by the app.- If
NEXT_PUBLIC_SUPABASE_ANON_KEYis missing, the app will tryNEXT_PUBLIC_SUPABASE_PUBLISHABLE_DEFAULT_KEY. - Configure a Clerk JWT template named
supabaseso authenticated requests can attachAuthorization: Bearer <token>for Supabase. - The quote endpoint currently uses a public upstream service and does not require an API key.
Install dependencies:
npm installRun development server:
npm run devnpm run dev
npm run build
npm run start
npm run lint/focus screen (public)/loginauth screen (public)/signupauth screen (public)/dashboardanalytics/dashboard view (protected)/api/quotesrandom quote endpoint (public)/api/health/supabaseSupabase health probe endpoint (protected)
Route protection is handled through Clerk middleware in proxy.ts.
Space: start/pause timerCtrl + Space: toggle task panel
Shortcuts are ignored while typing in input/textarea fields.
- Local timer state is persisted with key:
focus-flow-timer. - Local task state is persisted with key:
focus-flow-tasks. - Signed-in users can sync task/timer data through Supabase-backed flows.
PWA integration is configured with @ducanh2912/next-pwa:
- Enabled in production
- Disabled in development
Build and run production to validate service worker behavior:
npm run build
npm run start- Core focus experience and task flow are implemented.
- Dashboard widgets are currently mock-data UI.
- Supabase health endpoint is included for operational checks.